fix failed to backup config file

This commit is contained in:
Affif Mukhlashin 2019-05-01 11:35:47 +07:00 committed by GitHub
parent 74c3a0b264
commit f2ce3f2fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -63,19 +63,21 @@ ui_print " Vol- = Use previous config"
ui_print " "
CONFIG_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
OLD_CONFIG_FILE=$(echo $CONFIG_FILE|sed s/modules_update/modules/)
if $FUNCTION; then
ui_print "Replace old config"
ui_print " "
cp -af $MODPATH/system/etc/example-dnscrypt-proxy.toml $CONFIG_FILE
cp -af $MODPATH/system/etc/dnscrypt-proxy/example-dnscrypt-proxy.toml $CONFIG_FILE
sed -i -e 's/127.0.0.1:53/127.0.0.1:5354/g' $CONFIG_FILE
sed -i -e 's/\[::1\]:53/\[::1\]:5354/g' $CONFIG_FILE
else
if [ -f "$CONFIG_FILE" ]; then
if [ -f "$OLD_CONFIG_FILE" ]; then
ui_print "* Backing up config file"
cp $CONFIG_FILE $TMPDIR
ui_print "* Restoring config files"
cp -af $TMPDIR/dnscrypt-proxy.toml $CONFIG_FILE
cp -af OLD_CONFIG_FILE $CONFIG_FILE
else
abort "First install have to choose replace mode"
fi