add option to replace or backup-restore
This commit is contained in:
parent
6b815b9e85
commit
cf7f31ab1f
|
@ -56,6 +56,31 @@ else
|
||||||
$FUNCTION "DOWN"
|
$FUNCTION "DOWN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ui_print " "
|
||||||
|
ui_print " Vol+ = Replace previous config (mandatory for first install)"
|
||||||
|
ui_print " "
|
||||||
|
ui_print " Vol- = Use previous config"
|
||||||
|
ui_print " "
|
||||||
|
|
||||||
|
CONFIG_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
|
||||||
|
|
||||||
|
if $FUNCTION; then
|
||||||
|
ui_print "Replace old config"
|
||||||
|
ui_print " "
|
||||||
|
cp -af $MODPATH/system/etc/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
|
||||||
|
ui_print "* Backing up config file"
|
||||||
|
cp $CONFIG_FILE $TMPDIR
|
||||||
|
ui_print "* Restoring config files"
|
||||||
|
cp -af $TMPDIR/dnscrypt-proxy.toml $CONFIG_FILE
|
||||||
|
else
|
||||||
|
abort "First install have to choose replace mode"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ui_print " "
|
ui_print " "
|
||||||
ui_print " Vol+ = Auto redirect DNS request with iptables"
|
ui_print " Vol+ = Auto redirect DNS request with iptables"
|
||||||
ui_print " "
|
ui_print " "
|
||||||
|
|
16
install.sh
16
install.sh
|
@ -149,14 +149,8 @@ on_install() {
|
||||||
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-x86_64
|
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-x86_64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CONFIG_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
|
|
||||||
CONFIG_PATH=$TMPDIR/config
|
CONFIG_PATH=$TMPDIR/config
|
||||||
|
|
||||||
if [ -f "$CONFIG_FILE" ]; then
|
|
||||||
ui_print "* Backing up config file"
|
|
||||||
cp $CONFIG_FILE $TMPDIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
unzip -o "$ZIPFILE" 'config/*' 'binary/*' -d $TMPDIR 2>/dev/null
|
unzip -o "$ZIPFILE" 'config/*' 'binary/*' -d $TMPDIR 2>/dev/null
|
||||||
|
|
||||||
ui_print "* Creating binary path"
|
ui_print "* Creating binary path"
|
||||||
|
@ -179,16 +173,6 @@ on_install() {
|
||||||
abort "Config file is missing!"
|
abort "Config file is missing!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$CONFIG_FILE" ]; then
|
|
||||||
ui_print "* Copying config files"
|
|
||||||
cp -af $CONFIG_PATH/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
|
|
||||||
ui_print "* Restoring config files"
|
|
||||||
cp -af $TMPDIR/dnscrypt-proxy.toml $CONFIG_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
. $TMPDIR/option.sh
|
. $TMPDIR/option.sh
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue