2020-01-04 23:06:14 +00:00
|
|
|
ui_print " "
|
|
|
|
ui_print "******************************"
|
|
|
|
ui_print "* dnscrypt-proxy-android *"
|
2022-03-25 09:58:38 +00:00
|
|
|
ui_print "* 2.1.1-2 *"
|
2020-01-04 23:06:14 +00:00
|
|
|
ui_print "******************************"
|
|
|
|
ui_print "* quindecim *"
|
|
|
|
ui_print "******************************"
|
|
|
|
ui_print " "
|
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Get architecture specific binary file
|
2021-01-04 08:14:55 +00:00
|
|
|
if [ "$ARCH" == "arm" ];then
|
2021-01-05 09:02:07 +00:00
|
|
|
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-arm
|
2021-01-04 08:14:55 +00:00
|
|
|
elif [ "$ARCH" == "arm64" ];then
|
2021-01-05 09:02:07 +00:00
|
|
|
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-arm64
|
2021-01-04 08:14:55 +00:00
|
|
|
elif [ "$ARCH" == "x86" ];then
|
2021-01-05 09:02:07 +00:00
|
|
|
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-i386
|
2021-01-04 08:14:55 +00:00
|
|
|
elif [ "$ARCH" == "x64" ];then
|
2021-01-05 09:02:07 +00:00
|
|
|
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-x86_64
|
2021-01-04 08:14:55 +00:00
|
|
|
fi
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Set destination paths
|
|
|
|
CONFIG_PATH=$MODPATH/config
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Create the path for the binary file
|
|
|
|
ui_print "* Creating the binary path."
|
2021-01-04 08:14:55 +00:00
|
|
|
mkdir -p $MODPATH/system/bin
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Create the path for the configuration files
|
|
|
|
ui_print "* Creating the config. path."
|
2021-04-09 14:51:29 +00:00
|
|
|
mkdir -p /storage/emulated/0/dnscrypt-proxy
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Copy the binary files into the right folder
|
2021-01-04 08:14:55 +00:00
|
|
|
if [ -f "$BINARY_PATH" ]; then
|
2021-01-05 09:02:07 +00:00
|
|
|
ui_print "* Copying the binary files."
|
2021-01-04 08:14:55 +00:00
|
|
|
cp -af $BINARY_PATH $MODPATH/system/bin/dnscrypt-proxy
|
|
|
|
else
|
2021-01-05 09:02:07 +00:00
|
|
|
abort "The binary file for your $ARCH device is missing!"
|
2021-01-04 08:14:55 +00:00
|
|
|
fi
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Backup an existing config file before proceed
|
2021-04-09 14:51:29 +00:00
|
|
|
CONFIG_FILE="/storage/emulated/0/dnscrypt-proxy/dnscrypt-proxy.toml"
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-04 08:14:55 +00:00
|
|
|
if [ -f "$CONFIG_FILE" ]; then
|
2021-01-05 09:02:07 +00:00
|
|
|
ui_print "* Backing up the existing config. file before proceed."
|
2021-01-04 08:14:55 +00:00
|
|
|
cp -af $CONFIG_FILE ${CONFIG_FILE}-`date +%Y%m%d%H%M`.bak
|
|
|
|
fi
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Copy the configuration files into the right folder
|
2021-01-04 08:14:55 +00:00
|
|
|
if [ -d "$CONFIG_PATH" ]; then
|
2021-03-07 08:24:45 +00:00
|
|
|
ui_print "* Copying the configuration files into the dnscrypt-proxy folder."
|
2021-04-09 14:51:29 +00:00
|
|
|
cp -af $CONFIG_PATH/* /storage/emulated/0/dnscrypt-proxy/
|
2021-01-04 08:14:55 +00:00
|
|
|
else
|
2021-01-05 09:02:07 +00:00
|
|
|
abort "Configuration file (.toml) is missing!"
|
2021-01-04 08:14:55 +00:00
|
|
|
fi
|
2020-01-04 23:06:14 +00:00
|
|
|
|
2021-01-05 09:02:07 +00:00
|
|
|
# Set the right permissions to the dnscrypt-proxy binary file
|
|
|
|
ui_print "* Setting up the right permissions to the dnscrypt-proxy binary file."
|
2020-09-16 16:24:43 +00:00
|
|
|
set_perm_recursive $MODPATH 0 0 0755 0755
|
|
|
|
set_perm $MODPATH/system/bin/dnscrypt-proxy 0 0 0755
|
2021-01-05 09:02:07 +00:00
|
|
|
|
|
|
|
# Cleanup unneeded binary files
|
|
|
|
ui_print "* Cleaning up the unnecessary files."
|
|
|
|
rm -r $MODPATH/binary
|