Merge pull request #35 from Magisk-Modules-Repo/newmagisk

Newmagisk
This commit is contained in:
Affif Mukhlashin 2019-04-28 02:11:57 +07:00 committed by GitHub
commit f1fe4ce665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1371 additions and 265 deletions

View File

@ -1,55 +1,47 @@
#!/sbin/sh #!/sbin/sh
##########################################################################################
#
# Magisk Module Template Install Script
# by topjohnwu
#
##########################################################################################
TMPDIR=/dev/tmp TMPDIR=/dev/tmp
INSTALLER=$TMPDIR/install MOUNTPATH=/dev/magisk_img
# Always mount under tmp
MOUNTPATH=$TMPDIR/magisk_img
# Default permissions # Default permissions
umask 022 umask 022
# Initial cleanup # Initial cleanup
rm -rf $TMPDIR 2>/dev/null rm -rf $TMPDIR 2>/dev/null
mkdir -p $INSTALLER mkdir -p $TMPDIR
# echo before loading util_functions # echo before loading util_functions
ui_print() { echo "$1"; } ui_print() { echo "$1"; }
require_new_magisk() { require_new_magisk() {
ui_print "*******************************" ui_print "***********************************"
ui_print " Please install Magisk v17.0+! " ui_print " Please install the latest Magisk! "
ui_print "*******************************" ui_print "***********************************"
exit 1 exit 1
} }
imageless_magisk() {
[ $MAGISK_VER_CODE -gt 18100 ]
return $?
}
########################################################################################## ##########################################################################################
# Environment # Environment
########################################################################################## ##########################################################################################
OUTFD=$2 OUTFD=$2
ZIP=$3 ZIPFILE=$3
mount /data 2>/dev/null mount /data 2>/dev/null
# Load utility functions # Load utility functions
if [ -f /data/adb/magisk/util_functions.sh ]; then if [ -f /data/adb/magisk/util_functions.sh ]; then
. /data/adb/magisk/util_functions.sh . /data/adb/magisk/util_functions.sh
elif [ -f /data/magisk/util_functions.sh ]; then NVBASE=/data/adb
NVBASE=/data
. /data/magisk/util_functions.sh
else else
require_new_magisk require_new_magisk
fi fi
# Use alternative image if in BOOTMODE
$BOOTMODE && IMG=$NVBASE/magisk_merge.img
# Preperation for flashable zips # Preperation for flashable zips
setup_flashable setup_flashable
@ -59,9 +51,6 @@ mount_partitions
# Detect version and architecture # Detect version and architecture
api_level_arch_detect 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 # Setup busybox and binaries
$BOOTMODE && boot_actions || recovery_actions $BOOTMODE && boot_actions || recovery_actions
@ -70,22 +59,28 @@ $BOOTMODE && boot_actions || recovery_actions
########################################################################################## ##########################################################################################
# Extract common files # 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!" [ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
# Load configurations # Load install script
. $INSTALLER/config.sh . $TMPDIR/install.sh
# Check the installed magisk version if imageless_magisk; then
MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop` $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
[ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk MODULEROOT=$NVBASE/$MODDIRNAME
MODID=`grep_prop id $INSTALLER/module.prop` else
MODPATH=$MOUNTPATH/$MODID $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 print_modname
# Please leave this message in your flashable zip for credits :)
ui_print "******************************" ui_print "******************************"
ui_print "Powered by Magisk (@topjohnwu)" ui_print "Powered by Magisk (@topjohnwu)"
ui_print "******************************" ui_print "******************************"
@ -94,48 +89,52 @@ ui_print "******************************"
# Install # 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 # Create mod paths
rm -rf $MODPATH 2>/dev/null rm -rf $MODPATH 2>/dev/null
mkdir -p $MODPATH mkdir -p $MODPATH
# custom install begin on_install
install_dnscrypt_proxy
# custom install end
# Remove placeholder # Remove placeholder
rm -f $MODPATH/system/placeholder 2>/dev/null 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 # Handle replace folders
for TARGET in $REPLACE; do for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace mktouch $MODPATH$TARGET/.replace
done 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" ui_print "- Setting permissions"
set_permissions set_permissions
@ -143,11 +142,10 @@ set_permissions
# Finalizing # Finalizing
########################################################################################## ##########################################################################################
# Unmount magisk image and shrink if possible cd /
unmount_magisk_img imageless_magisk || unmount_magisk_img
$BOOTMODE || recovery_cleanup $BOOTMODE || recovery_cleanup
rm -rf $TMPDIR rm -rf $TMPDIR $MOUNTPATH
ui_print "- Done" ui_print "- Done"
exit 0 exit 0

View File

@ -16,17 +16,17 @@ Just flash and forget.
- DNS server address is 127.0.0.1:53 for ipv4 and [::1]:53 for ipv6 - 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 - 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 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 1.1.1.1 --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 1.1.1.1 --dport 53 -j DNAT --to-destination [::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 1.1.1.1 --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 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 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 1.1.1.1 --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 1.1.1.1 --dport 53 -j DNAT --to-destination [::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 1.1.1.1 --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 (post-installing)
@ -34,21 +34,14 @@ Just flash and forget.
- 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/Basic-dnscrypt-proxy.toml-editing)
## Changelog ## Changelog
### v2.8.1
- Update Magisk 18100 requirements
### v2.8.0 ### v2.8.0
- Update binary files to 2.0.22 - Update binary files to 2.0.22
### v2.7.0 ### v2.7.0
- Update binary files to 2.0.21 - Update binary files to 2.0.21
### v2.6.0 ### v2.6.0
- Update binary files to 2.0.19 - 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) [older version changelog](changelog.md)

View File

@ -1,9 +1,11 @@
# Changelog # Changelog
## Changelog ## Changelog
### v2.8.1
- Update Magisk 18100 requirements
### v2.8.0 ### v2.8.0
- Update binary files 2.0.22 - Update binary files 2.0.22
### v2.7.0 ### v2.7.0
- Update binary files 2.0.21 - Update binary files 2.0.21
### v2.6.0 ### v2.6.0
- Update binary files to 2.0.19 - Update binary files to 2.0.19
### v2.5.0 ### v2.5.0
@ -12,7 +14,7 @@
## v2.4.0 ## v2.4.0
* Update binary files to 2.0.14 * Update binary files to 2.0.14
## v2.3.0 ## 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. * Add option to choose auto redirect DNS or manually set with 3rd-party app.
## v2.2.0 ## v2.2.0
* Update binary files to 2.0.8 * Update binary files to 2.0.8

View File

@ -1,19 +1,19 @@
keytest() { keytest() {
ui_print " - Vol Key Test -" ui_print " - Vol Key Test -"
ui_print " Press Vol Up:" 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 return 0
} }
chooseport() { chooseport() {
#note from chainfire @xda-developers: getevent behaves weird when piped, and busybox grep likes that even less than toolbox/toybox grep #note from chainfire @xda-developers: getevent behaves weird when piped, and busybox grep likes that even less than toolbox/toybox grep
while (true); do while (true); do
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events /system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $TMPDIR/events
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then if (`cat $TMPDIR/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then
break break
fi fi
done 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 return 0
else else
return 1 return 1
@ -40,7 +40,7 @@ chooseportold() {
} }
# Keycheck binary by someone755 @Github, idea for code below by Zappo @xda-developers # Keycheck binary by someone755 @Github, idea for code below by Zappo @xda-developers
KEYCHECK=$INSTALLER/common/keycheck KEYCHECK=$TMPDIR/common/keycheck
chmod 755 $KEYCHECK chmod 755 $KEYCHECK
if keytest; then if keytest; then
@ -69,6 +69,6 @@ else
ui_print " " ui_print " "
ui_print " Manual mode" ui_print " Manual mode"
ui_print " deleting iptables rules" ui_print " deleting iptables rules"
sed -i -e '/for/,$d' $INSTALLER/common/service.sh sed -i -e '/for/,$d' $TMPDIR/common/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 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 fi

View File

@ -1,7 +1,9 @@
#!/system/bin/sh #!/system/bin/sh
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... # Do NOT assume where your module will be located.
# This will make your scripts compatible even if Magisk change its mount point in the future # 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%/*} MODDIR=${0%/*}
# This script will be executed in post-fs-data mode # This script will be executed in post-fs-data mode
# More info in the main Magisk thread

View File

@ -10,12 +10,12 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
ping -c 1 download.dnscrypt.info ping -c 1 download.dnscrypt.info
if [[ $? == 0 ]]; if [[ $? == 0 ]];
then 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 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 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 1.1.1.1 --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 1.1.1.1 --dport 53 -j DNAT --to-destination [::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 1.1.1.1 --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; break;
else else
sleep 5 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

212
install.sh Executable file
View File

@ -0,0 +1,212 @@
##########################################################################################
#
# 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.1 *"
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_FILE=$MODPATH/system/etc/dnscrypt-proxy/dnscrypt-proxy.toml
CONFIG_PATH=$TMPDIR/config
if [ -f "$CONFIG_FILE" ]; then
ui_print "* Backing up config file"
cp $CONFIG_FILE $TMPDIR
fi
unzip -o "$ZIP" '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
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/common/install.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/xbin/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 id=dnscrypt-proxy
name=DNSCrypt-Proxy 2 name=DNSCrypt-Proxy 2
version=v2.8.0 version=v2.8.1
versionCode=17 versionCode=18
author=bluemeda 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 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