From 19eff34a4f77be74fed5d45820786891089e7507 Mon Sep 17 00:00:00 2001 From: bluemeda Date: Wed, 7 Mar 2018 02:14:20 +0700 Subject: [PATCH] bug fixing --- config.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/config.sh b/config.sh index 184552f..ac80ee5 100755 --- a/config.sh +++ b/config.sh @@ -105,10 +105,11 @@ install_dnscrypt_proxy(){ BINARY_PATH=$INSTALLER/binary/dnscrypt-proxy-arm64 fi - CONFIG_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml + CONFIG_FILE=$MODDIR/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml CONFIG_PATH=$INSTALLER/config - if [ ! -f "$CONFIG_FILE"]; then + if [ -f "$CONFIG_FILE" ]; then + ui_print "* Backing up config file" cp $CONFIG_FILE $TMPDIR fi @@ -121,24 +122,27 @@ install_dnscrypt_proxy(){ mkdir -p $MODPATH/system/etc/dnscrypt-proxy 2>/dev/null if [ -f "$BINARY_PATH" ]; then - ui_print "Copying binary for $ARCH" + ui_print "* Copying binary for $ARCH" cp -af $BINARY_PATH $MODPATH/system/xbin/dnscrypt-proxy else abort "Binary file for $ARCH is missing!" fi if [ -d "$CONFIG_PATH" ]; then - ui_print "Copying example and license files" + ui_print "* Copying example and license files" cp -af $CONFIG_PATH/* $MODPATH/system/etc/dnscrypt-proxy else abort "Config file is missing!" fi - if [ ! -f $CONFIG_FILE]; then - ui_print "copying config files" - cp -af $CONFIG_PATH/example-dnscrypt-proxy.toml $MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml + 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:5353/g' $CONFIG_FILE + sed -i -e 's/\[::1\]:53/\[::1\]:5353/g' $CONFIG_FILE else - cp -af $TMPDIR/dnscrypt-proxy.toml $MODPATH/system/etc/dnscrypt-proxy.toml + ui_print "* Restoring config files" + cp -af $TMPDIR/dnscrypt-proxy.toml $CONFIG_FILE fi }