dnscrypt-proxy-android/customize.sh

68 lines
2.2 KiB
Bash
Raw Permalink Normal View History

ui_print " "
ui_print "******************************"
ui_print "* dnscrypt-proxy-android *"
2023-02-07 20:09:18 +00:00
ui_print "* 2.1.4 *"
ui_print "******************************"
ui_print "* quindecim *"
ui_print "******************************"
ui_print " "
# Get architecture specific binary file
2021-01-04 08:14:55 +00:00
if [ "$ARCH" == "arm" ];then
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-arm
2021-01-04 08:14:55 +00:00
elif [ "$ARCH" == "arm64" ];then
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-arm64
2021-01-04 08:14:55 +00:00
elif [ "$ARCH" == "x86" ];then
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-i386
2021-01-04 08:14:55 +00:00
elif [ "$ARCH" == "x64" ];then
BINARY_PATH=$MODPATH/binary/dnscrypt-proxy-x86_64
2021-01-04 08:14:55 +00:00
fi
# Set destination paths
CONFIG_PATH=$MODPATH/config
# 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
# Create the path for the configuration files
ui_print "* Creating the config. path."
mkdir -p /storage/emulated/0/dnscrypt-proxy
# Copy the binary files into the right folder
2021-01-04 08:14:55 +00:00
if [ -f "$BINARY_PATH" ]; then
ui_print "* Copying the binary files."
2021-01-04 08:14:55 +00:00
cp -af $BINARY_PATH $MODPATH/system/bin/dnscrypt-proxy
else
abort "The binary file for your $ARCH device is missing!"
2021-01-04 08:14:55 +00:00
fi
# Backup an existing config file before proceed
CONFIG_FILE="/storage/emulated/0/dnscrypt-proxy/dnscrypt-proxy.toml"
2021-01-04 08:14:55 +00:00
if [ -f "$CONFIG_FILE" ]; then
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
# Copy the configuration files into the right folder
2021-01-04 08:14:55 +00:00
if [ -d "$CONFIG_PATH" ]; then
ui_print "* Copying the configuration files into the dnscrypt-proxy folder."
cp -af $CONFIG_PATH/* /storage/emulated/0/dnscrypt-proxy/
2021-01-04 08:14:55 +00:00
else
abort "Configuration file (.toml) is missing!"
2021-01-04 08:14:55 +00:00
fi
# 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
# Set Private DNS mode off
2022-12-06 23:12:06 +00:00
ui_print "* Disabling Android 9+ Private DNS mode."
settings put global private_dns_mode off
# Cleanup unneeded binary files
ui_print "* Cleaning up the unnecessary files."
rm -r $MODPATH/binary