mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-09 16:01:46 +00:00
Merge remote-tracking branch 'refs/remotes/Neilpang/master'
This commit is contained in:
commit
3241890bec
11
le.sh
11
le.sh
@ -272,12 +272,13 @@ _setopt() {
|
|||||||
__val="$4"
|
__val="$4"
|
||||||
__end="$5"
|
__end="$5"
|
||||||
if [ -z "$__opt" ] ; then
|
if [ -z "$__opt" ] ; then
|
||||||
echo usage: $0 '"file" "opt" "=" "value" [";"]'
|
echo usage: _setopt '"file" "opt" "=" "value" [";"]'
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$__conf" ] ; then
|
if [ ! -f "$__conf" ] ; then
|
||||||
touch "$__conf"
|
touch "$__conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -H -n "^$__opt$__sep" "$__conf" > /dev/null ; then
|
if grep -H -n "^$__opt$__sep" "$__conf" > /dev/null ; then
|
||||||
_debug OK
|
_debug OK
|
||||||
if [[ "$__val" == *"&"* ]] ; then
|
if [[ "$__val" == *"&"* ]] ; then
|
||||||
@ -285,6 +286,14 @@ _setopt() {
|
|||||||
fi
|
fi
|
||||||
text="$(cat $__conf)"
|
text="$(cat $__conf)"
|
||||||
printf "$text" | sed "s|^$__opt$__sep.*$|$__opt$__sep$__val$__end|" > "$__conf"
|
printf "$text" | sed "s|^$__opt$__sep.*$|$__opt$__sep$__val$__end|" > "$__conf"
|
||||||
|
|
||||||
|
elif grep -H -n "^#$__opt$__sep" "$__conf" > /dev/null ; then
|
||||||
|
if [[ "$__val" == *"&"* ]] ; then
|
||||||
|
__val="$(echo $__val | sed 's/&/\\&/g')"
|
||||||
|
fi
|
||||||
|
text="$(cat $__conf)"
|
||||||
|
printf "$text" | sed "s|^#$__opt$__sep.*$|$__opt$__sep$__val$__end|" > "$__conf"
|
||||||
|
|
||||||
else
|
else
|
||||||
_debug APP
|
_debug APP
|
||||||
echo "$__opt$__sep$__val$__end" >> "$__conf"
|
echo "$__opt$__sep$__val$__end" >> "$__conf"
|
||||||
|
Loading…
Reference in New Issue
Block a user