Merge pull request #1 from Magisk-Modules-Repo/master

Syncing
This commit is contained in:
Euler Alves 2019-06-06 12:44:26 -03:00 committed by GitHub
commit 6f4fcbfb28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1407 additions and 275 deletions

View File

@ -1,55 +1,47 @@
#!/sbin/sh
##########################################################################################
#
# Magisk Module Template Install Script
# by topjohnwu
#
##########################################################################################
TMPDIR=/dev/tmp
INSTALLER=$TMPDIR/install
# Always mount under tmp
MOUNTPATH=$TMPDIR/magisk_img
MOUNTPATH=/dev/magisk_img
# Default permissions
umask 022
# Initial cleanup
rm -rf $TMPDIR 2>/dev/null
mkdir -p $INSTALLER
mkdir -p $TMPDIR
# echo before loading util_functions
ui_print() { echo "$1"; }
require_new_magisk() {
ui_print "*******************************"
ui_print " Please install Magisk v17.0+! "
ui_print "*******************************"
ui_print "***********************************"
ui_print " Please install the latest Magisk! "
ui_print "***********************************"
exit 1
}
imageless_magisk() {
[ $MAGISK_VER_CODE -gt 18100 ]
return $?
}
##########################################################################################
# Environment
##########################################################################################
OUTFD=$2
ZIP=$3
ZIPFILE=$3
mount /data 2>/dev/null
# Load utility functions
if [ -f /data/adb/magisk/util_functions.sh ]; then
. /data/adb/magisk/util_functions.sh
elif [ -f /data/magisk/util_functions.sh ]; then
NVBASE=/data
. /data/magisk/util_functions.sh
NVBASE=/data/adb
else
require_new_magisk
fi
# Use alternative image if in BOOTMODE
$BOOTMODE && IMG=$NVBASE/magisk_merge.img
# Preperation for flashable zips
setup_flashable
@ -59,9 +51,6 @@ mount_partitions
# Detect version and architecture
api_level_arch_detect
# You can get the Android API version from $API, the CPU architecture from $ARCH
# Useful if you are creating Android version / platform dependent mods
# Setup busybox and binaries
$BOOTMODE && boot_actions || recovery_actions
@ -70,22 +59,28 @@ $BOOTMODE && boot_actions || recovery_actions
##########################################################################################
# Extract common files
unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
[ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
# Load configurations
. $INSTALLER/config.sh
[ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
# Load install script
. $TMPDIR/install.sh
# Check the installed magisk version
MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop`
[ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk
MODID=`grep_prop id $INSTALLER/module.prop`
MODPATH=$MOUNTPATH/$MODID
if imageless_magisk; then
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
MODULEROOT=$NVBASE/$MODDIRNAME
else
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
IMG=$NVBASE/$IMGNAME
request_zip_size_check "$ZIPFILE"
mount_magisk_img
MODULEROOT=$MOUNTPATH
fi
MODID=`grep_prop id $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$MODID
# Print mod name
print_modname
# Please leave this message in your flashable zip for credits :)
ui_print "******************************"
ui_print "Powered by Magisk (@topjohnwu)"
ui_print "******************************"
@ -94,48 +89,52 @@ ui_print "******************************"
# Install
##########################################################################################
# Get the variable reqSizeM. Use your own method to determine reqSizeM if needed
request_zip_size_check "$ZIP"
# This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM
mount_magisk_img
# Create mod paths
rm -rf $MODPATH 2>/dev/null
mkdir -p $MODPATH
# custom install begin
install_dnscrypt_proxy
# custom install end
on_install
# Remove placeholder
rm -f $MODPATH/system/placeholder 2>/dev/null
# Custom uninstaller
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
# Auto Mount
if imageless_magisk; then
$SKIPMOUNT && touch $MODPATH/skip_mount
else
$SKIPMOUNT || touch $MODPATH/auto_mount
fi
# prop files
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
# Module info
cp -af $TMPDIR/module.prop $MODPATH/module.prop
if $BOOTMODE; then
# Update info for Magisk Manager
if imageless_magisk; then
mktouch $NVBASE/modules/$MODID/update
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
else
mktouch /sbin/.magisk/img/$MODID/update
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
fi
fi
# post-fs-data mode scripts
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
# service mode scripts
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
# Handle replace folders
for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace
done
# Auto Mount
$AUTOMOUNT && touch $MODPATH/auto_mount
# prop files
$PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
# Module info
cp -af $INSTALLER/module.prop $MODPATH/module.prop
if $BOOTMODE; then
# Update info for Magisk Manager
mktouch /sbin/.core/img/$MODID/update
cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop
fi
# post-fs-data mode scripts
$POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
# service mode scripts
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
ui_print "- Setting permissions"
set_permissions
@ -143,11 +142,10 @@ set_permissions
# Finalizing
##########################################################################################
# Unmount magisk image and shrink if possible
unmount_magisk_img
cd /
imageless_magisk || unmount_magisk_img
$BOOTMODE || recovery_cleanup
rm -rf $TMPDIR
rm -rf $TMPDIR $MOUNTPATH
ui_print "- Done"
exit 0

View File

@ -16,43 +16,44 @@ Just flash and forget.
- DNS server address is 127.0.0.1:53 for ipv4 and [::1]:53 for ipv6
- If you use AfWall, you can write this enter custom script
```
iptables -t nat -A OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:53
iptables -t nat -A OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:53
ip6tables -t nat -A OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:53
ip6tables -t nat -A OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:53
iptables -t nat -A OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:53
iptables -t nat -A OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:53
ip6tables -t nat -A OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:53
ip6tables -t nat -A OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:53
```
and this shutdown script
```
iptables -t nat -D OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:53
iptables -t nat -D OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:53
ip6tables -t nat -D OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:53
ip6tables -t nat -D OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:53
iptables -t nat -D OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:53
iptables -t nat -D OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:53
ip6tables -t nat -D OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:53
ip6tables -t nat -D OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:53
```
## Configuration (post-installing)
- Configuration located on `/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml`
- For more detailed configuration please refer to [official documentation](https://github.com/jedisct1/dnscrypt-proxy/wiki/Basic-dnscrypt-proxy.toml-editing)
- For more detailed configuration please refer to [official documentation](https://github.com/jedisct1/dnscrypt-proxy/wiki/Configuration)
## Changelog
### v2.8.5
- Fix #40
### v2.8.4
- Fix failed to copy or backup config file
### v2.8.3
- Fix permission issue
- Add option to replace or backup-restore config file
### v2.8.2
- Fix "binary file is missing"
### v2.8.1
- Update Magisk 18100 requirements
### v2.8.0
- Update binary files to 2.0.22
### v2.7.0
- Update binary files to 2.0.21
### v2.6.0
- Update binary files to 2.0.19
### v2.5.0
- Update binary files to 2.0.16
- Add exception for cloudflare fallback resolver.
- Update Magisk Module Template 17000
### v2.4.0
- Update binary files to 2.0.14
### v2.3.0
- Update binary files to 2.0.10 ([changelog](https://github.com/jedisct1/dnscrypt-proxy/blob/master/ChangeLog))
- Add option to choose auto redirect DNS or manually set with 3rd-party app.
[older version changelog](changelog.md)
[Full changelog](changelog.md)
## Credit
- DNSCrypt-Proxy2 upstream | [jedisct1](https://github.com/jedisct1/dnscrypt-proxy)
- Keycheck binary | [someone755](https://github.com/someone755/kerneller/tree/master/extract/tools)
- Idea for keycheck code implementation | [Zappo @xda-developers](https://forum.xda-developers.com/showpost.php?p=71016567&postcount=98)
- [All contributor](https://github.com/Magisk-Modules-Repo/dnscrypt-proxy/graphs/contributors)

View File

@ -1,9 +1,20 @@
# Changelog
## Changelog
### v2.8.5
- Fix #40
### v2.8.4
- Fix failed to copy or backup config file
### v2.8.3
- Fix permission issue
- Add option to replace or backup-restore config file
### v2.8.2
- Fix "binary file is missing"
### v2.8.1
- Update Magisk 18100 requirements
### v2.8.0
- Update binary files 2.0.22
- Update binary files 2.0.22
### v2.7.0
- Update binary files 2.0.21
- Update binary files 2.0.21
### v2.6.0
- Update binary files to 2.0.19
### v2.5.0
@ -12,7 +23,7 @@
## v2.4.0
* Update binary files to 2.0.14
## v2.3.0
* Update binary files to 2.0.8
* Update binary files to 2.0.10
* Add option to choose auto redirect DNS or manually set with 3rd-party app.
## v2.2.0
* Update binary files to 2.0.8

37
common/install.sh → common/option.sh Normal file → Executable file
View File

@ -1,19 +1,19 @@
keytest() {
ui_print " - Vol Key Test -"
ui_print " Press Vol Up:"
(/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events) || return 1
(/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $TMPDIR/events) || return 1
return 0
}
chooseport() {
#note from chainfire @xda-developers: getevent behaves weird when piped, and busybox grep likes that even less than toolbox/toybox grep
while (true); do
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $TMPDIR/events
if (`cat $TMPDIR/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then
break
fi
done
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUMEUP >/dev/null`); then
if (`cat $TMPDIR/events 2>/dev/null | /system/bin/grep VOLUMEUP >/dev/null`); then
return 0
else
return 1
@ -40,7 +40,7 @@ chooseportold() {
}
# Keycheck binary by someone755 @Github, idea for code below by Zappo @xda-developers
KEYCHECK=$INSTALLER/common/keycheck
KEYCHECK=$TMPDIR/keycheck
chmod 755 $KEYCHECK
if keytest; then
@ -56,6 +56,31 @@ else
$FUNCTION "DOWN"
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/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
ui_print "* Backing up config file"
cp -af $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 " Vol+ = Auto redirect DNS request with iptables"
ui_print " "
@ -69,6 +94,6 @@ else
ui_print " "
ui_print " Manual mode"
ui_print " deleting iptables rules"
sed -i -e '/for/,$d' $INSTALLER/common/service.sh
sed -i -e '/for/,$d' $TMPDIR/service.sh
sed -i -e "s/'127.0.0.1.*'/'127.0.0.1:53', '[::1]:53'/g" $MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
fi

View File

@ -1,7 +1,9 @@
#!/system/bin/sh
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
# This will make your scripts compatible even if Magisk change its mount point in the future
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# if Magisk change its mount point in the future
MODDIR=${0%/*}
# This script will be executed in post-fs-data mode
# More info in the main Magisk thread

View File

@ -1,21 +1,21 @@
#!/system/bin/sh
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
# This will make your scripts compatible even if Magisk change its mount point in the future
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# if Magisk change its mount point in the future
MODDIR=${0%/*}
# This script will be executed in late_start service mode
# More info in the main Magisk thread
for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
ping -c 1 download.dnscrypt.info
if [[ $? == 0 ]];
then
$MODDIR/system/xbin/dnscrypt-proxy -config $MODDIR/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml &
$MODDIR/system/bin/dnscrypt-proxy -config $MODDIR/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml &
sleep 15
iptables -t nat -A OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:5354
iptables -t nat -A OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination 127.0.0.1:5354
ip6tables -t nat -A OUTPUT -p tcp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:5354
ip6tables -t nat -A OUTPUT -p udp ! -d 1.1.1.1 --dport 53 -j DNAT --to-destination [::1]:5354
iptables -t nat -A OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:5354
iptables -t nat -A OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination 127.0.0.1:5354
ip6tables -t nat -A OUTPUT -p tcp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:5354
ip6tables -t nat -A OUTPUT -p udp ! -d 9.9.9.9 --dport 53 -j DNAT --to-destination [::1]:5354
break;
else
sleep 5

159
config.sh
View File

@ -1,159 +0,0 @@
##########################################################################################
#
# Magisk Module Template Config Script
# by topjohnwu
#
##########################################################################################
##########################################################################################
#
# Instructions:
#
# 1. Place your files into system folder (delete the placeholder file)
# 2. Fill in your module's info into module.prop
# 3. Configure the settings in this file (config.sh)
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
# 5. Add your additional or modified system properties into common/system.prop
#
##########################################################################################
##########################################################################################
# Configs
##########################################################################################
# Set to true if you need to enable Magic Mount
# Most mods would like it to be enabled
AUTOMOUNT=true
# Set to true if you need to load system.prop
PROPFILE=false
# Set to true if you need post-fs-data script
POSTFSDATA=false
# Set to true if you need late_start service script
LATESTARTSERVICE=true
##########################################################################################
# Installation Message
##########################################################################################
# Set what you want to show when installing your mod
print_modname() {
ui_print "*******************************"
ui_print " DNSCrypt-Proxy2 "
ui_print " Magisk Module "
ui_print "*******************************"
ui_print " v2.6.0 "
ui_print " bluemeda "
ui_print "*******************************"
}
##########################################################################################
# Replace list
##########################################################################################
# List all directories you want to directly replace in the system
# Check the documentations for more info about how Magic Mount works, and why you need this
# This is an example
REPLACE="
/system/app/Youtube
/system/priv-app/SystemUI
/system/priv-app/Settings
/system/framework
"
# Construct your own list here, it will override the example above
# !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now
REPLACE="
"
##########################################################################################
# Permissions
##########################################################################################
set_permissions() {
# Only some special files require specific permissions
# The default permissions should be good enough for most cases
# Here are some examples for the set_perm functions:
# set_perm_recursive <dirname> <owner> <group> <dirpermission> <filepermission> <contexts> (default: u:object_r:system_file:s0)
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
# set_perm <filename> <owner> <group> <permission> <contexts> (default: u:object_r:system_file:s0)
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
# The following is default permissions, DO NOT remove
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm $MODPATH/system/xbin/dnscrypt-proxy 0 0 0755
}
##########################################################################################
# Custom Functions
##########################################################################################
# This file (config.sh) will be sourced by the main flash script after util_functions.sh
# If you need custom logic, please add them here as functions, and call these functions in
# update-binary. Refrain from adding code directly into update-binary, as it will make it
# difficult for you to migrate your modules to newer template versions.
# Make update-binary as clean as possible, try to only do function calls in it.
install_dnscrypt_proxy(){
if [ "$ARCH" == "arm" ];then
BINARY_PATH=$INSTALLER/binary/dnscrypt-proxy-arm
elif [ "$ARCH" == "arm64" ];then
BINARY_PATH=$INSTALLER/binary/dnscrypt-proxy-arm64
elif [ "$ARCH" == "x86" ];then
BINARY_PATH=$INSTALLER/binary/dnscrypt-proxy-x86
elif [ "$ARCH" == "x64" ];then
BINARY_PATH=$INSTALLER/binary/dnscrypt-proxy-x86_64
fi
OLD_CONFIG_FILE=$MODDIR/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
NEW_CONFIG_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
CONFIG_PATH=$INSTALLER/config
if [ -f "$OLD_CONFIG_FILE" ]; then
ui_print "* Backing up config file"
cp $OLD_CONFIG_FILE $TMPDIR
fi
unzip -o "$ZIP" 'config/*' 'binary/*' -d $INSTALLER 2>/dev/null
ui_print "* Creating binary path"
mkdir -p $MODPATH/system/xbin 2>/dev/null
ui_print "* Creating config path"
mkdir -p $MODPATH/system/etc/dnscrypt-proxy 2>/dev/null
if [ -f "$BINARY_PATH" ]; then
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"
cp -af $CONFIG_PATH/* $MODPATH/system/etc/dnscrypt-proxy
else
abort "Config file is missing!"
fi
if [ ! -f "$OLD_CONFIG_FILE" ]; then
ui_print "* Copying config files"
cp -af $CONFIG_PATH/example-dnscrypt-proxy.toml $NEW_CONFIG_FILE
sed -i -e 's/127.0.0.1:53/127.0.0.1:5354/g' $NEW_CONFIG_FILE
sed -i -e 's/\[::1\]:53/\[::1\]:5354/g' $NEW_CONFIG_FILE
else
ui_print "* Restoring config files"
cp -af $TMPDIR/dnscrypt-proxy.toml $NEW_CONFIG_FILE
fi
. $INSTALLER/common/install.sh
}

1059
config/public-resolvers.md Normal file

File diff suppressed because it is too large Load Diff

196
install.sh Executable file
View File

@ -0,0 +1,196 @@
##########################################################################################
#
# Magisk Module Installer Script
#
##########################################################################################
##########################################################################################
#
# Instructions:
#
# 1. Place your files into system folder (delete the placeholder file)
# 2. Fill in your module's info into module.prop
# 3. Configure and implement callbacks in this file
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
# 5. Add your additional or modified system properties into common/system.prop
#
##########################################################################################
##########################################################################################
# Config Flags
##########################################################################################
# Set to true if you do *NOT* want Magisk to mount
# any files for you. Most modules would NOT want
# to set this flag to true
SKIPMOUNT=false
# Set to true if you need to load system.prop
PROPFILE=false
# Set to true if you need post-fs-data script
POSTFSDATA=false
# Set to true if you need late_start service script
LATESTARTSERVICE=true
##########################################################################################
# Replace list
##########################################################################################
# List all directories you want to directly replace in the system
# Check the documentations for more info why you would need this
# Construct your list in the following format
# This is an example
REPLACE_EXAMPLE="
/system/app/Youtube
/system/priv-app/SystemUI
/system/priv-app/Settings
/system/framework
"
# Construct your own list here
REPLACE="
"
##########################################################################################
#
# Function Callbacks
#
# The following functions will be called by the installation framework.
# You do not have the ability to modify update-binary, the only way you can customize
# installation is through implementing these functions.
#
# When running your callbacks, the installation framework will make sure the Magisk
# internal busybox path is *PREPENDED* to PATH, so all common commands shall exist.
# Also, it will make sure /data, /system, and /vendor is properly mounted.
#
##########################################################################################
##########################################################################################
#
# The installation framework will export some variables and functions.
# You should use these variables and functions for installation.
#
# ! DO NOT use any Magisk internal paths as those are NOT public API.
# ! DO NOT use other functions in util_functions.sh as they are NOT public API.
# ! Non public APIs are not guranteed to maintain compatibility between releases.
#
# Available variables:
#
# MAGISK_VER (string): the version string of current installed Magisk
# MAGISK_VER_CODE (int): the version code of current installed Magisk
# BOOTMODE (bool): true if the module is currently installing in Magisk Manager
# MODPATH (path): the path where your module files should be installed
# TMPDIR (path): a place where you can temporarily store files
# ZIPFILE (path): your module's installation zip
# ARCH (string): the architecture of the device. Value is either arm, arm64, x86, or x64
# IS64BIT (bool): true if $ARCH is either arm64 or x64
# API (int): the API level (Android version) of the device
#
# Availible functions:
#
# ui_print <msg>
# print <msg> to console
# Avoid using 'echo' as it will not display in custom recovery's console
#
# abort <msg>
# print error message <msg> to console and terminate installation
# Avoid using 'exit' as it will skip the termination cleanup steps
#
# set_perm <target> <owner> <group> <permission> [context]
# if [context] is empty, it will default to "u:object_r:system_file:s0"
# this function is a shorthand for the following commands
# chown owner.group target
# chmod permission target
# chcon context target
#
# set_perm_recursive <directory> <owner> <group> <dirpermission> <filepermission> [context]
# if [context] is empty, it will default to "u:object_r:system_file:s0"
# for all files in <directory>, it will call:
# set_perm file owner group filepermission context
# for all directories in <directory> (including itself), it will call:
# set_perm dir owner group dirpermission context
#
##########################################################################################
##########################################################################################
# If you need boot scripts, DO NOT use general boot scripts (post-fs-data.d/service.d)
# ONLY use module scripts as it respects the module status (remove/disable) and is
# guaranteed to maintain the same behavior in future Magisk releases.
# Enable boot scripts by setting the flags in the config section above.
##########################################################################################
# Set what you want to display when installing your module
print_modname() {
ui_print " "
ui_print "*******************************"
ui_print "* DNSCrypt-Proxy2 *"
ui_print "* Magisk Module *"
ui_print "*******************************"
ui_print "* v2.8.6-alpha1 *"
ui_print "* bluemeda *"
ui_print "*******************************"
ui_print " "
}
# Copy/extract your module files into $MODPATH in on_install.
on_install() {
# The following is the default implementation: extract $ZIPFILE/system to $MODPATH
# Extend/change the logic to whatever you want
if [ "$ARCH" == "arm" ];then
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-arm
elif [ "$ARCH" == "arm64" ];then
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-arm64
elif [ "$ARCH" == "x86" ];then
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-x86
elif [ "$ARCH" == "x64" ];then
BINARY_PATH=$TMPDIR/binary/dnscrypt-proxy-x86_64
fi
CONFIG_PATH=$TMPDIR/config
unzip -o "$ZIPFILE" 'config/*' 'binary/*' -d $TMPDIR 2>/dev/null
ui_print "* Creating binary path"
mkdir -p $MODPATH/system/bin 2>/dev/null
ui_print "* Creating config path"
mkdir -p $MODPATH/system/etc/dnscrypt-proxy 2>/dev/null
if [ -f "$BINARY_PATH" ]; then
ui_print "* Copying binary for $ARCH"
cp -af $BINARY_PATH $MODPATH/system/bin/dnscrypt-proxy
else
abort "Binary file for $ARCH is missing!"
fi
if [ -d "$CONFIG_PATH" ]; then
ui_print "* Copying example and license files"
cp -af $CONFIG_PATH/* $MODPATH/system/etc/dnscrypt-proxy
else
abort "Config file is missing!"
fi
. $TMPDIR/option.sh
}
# Only some special files require specific permissions
# This function will be called after on_install is done
# The default permissions should be good enough for most cases
set_permissions() {
# The following is the default rule, DO NOT remove
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm $MODPATH/system/bin/dnscrypt-proxy 0 0 0755
# Here are some examples:
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
}
# You can add more functions to assist your custom script code

View File

@ -1,7 +1,6 @@
id=dnscrypt-proxy
name=DNSCrypt-Proxy 2
version=v2.8.0
versionCode=17
version=v2.8.6-alpha1
versionCode=23
author=bluemeda
description=A flexible DNS proxy, with support for modern encrypted DNS protocols such as DNSCrypt v2 and DNS-over-HTTP/2. Using DNSCrypt-proxy 2.0.21
minMagisk=1700
description=A flexible DNS proxy, with support for modern encrypted DNS protocols such as DNSCrypt v2 and DNS-over-HTTP/2. Using DNSCrypt-proxy 2.0.22