This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
forked from Faiiev/taichi-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changelog: - Magisk version detecting moved into runtime script instead of one-time check during install. - Live loading sepolicy rules for legacy Magisk version from sepolicy.rule file Rewritten post-fs-data.sh and scripts.sh - Added missing paths in uninstall.sh - Upgrade to the latest module installer format - Fixed some bugs.
- Loading branch information
Showing
9 changed files
with
105 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Declare files that will always have LF line endings on checkout. | ||
META-INF/** text eol=lf | ||
*.prop text eol=lf | ||
*.sh text eol=lf | ||
*.md text eol=lf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
system/** binary | ||
taichi binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
#!/system/bin/sh | ||
|
||
# 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%/*} | ||
|
||
rm /data/misc/taichi | ||
# This script will be executed in post-fs-data mode | ||
|
||
WATCH_FILE="/data/misc/taichi" | ||
ENFORCE_FILE="/data/misc/taichi_enforce" | ||
LOG_FILE="/data/local/tmp/taichi.log" | ||
SEPOLICY_FILE="${MODDIR}/sepolicy.rule" | ||
|
||
rm -f "{WATCH_FILE}" | ||
rm -f "{ENFORCE_FILE}" | ||
rm -f "{LOG_FILE}" | ||
|
||
[[ -f ${MODDIR}/sepolicy.rule ]] && exit 0 | ||
# Load utility functions | ||
[ -f "/data/adb/magisk/util_functions.sh" ] && . /data/adb/magisk/util_functions.sh | ||
[ "${MAGISK_VER_CODE}" -ge 20110 ] && exit 0 | ||
|
||
if [[ $(getprop ro.build.version.sdk) -ge 29 ]]; then | ||
AB_UPDATE=$(getprop ro.build.ab_update) | ||
SAR=$(getprop ro.build.system_root_image) | ||
if [[ ${AB_UPDATE} != "true" ]] || ([[ ${AB_UPDATE} == "true" ]] && [[ ${SAR} == "false" ]]); then | ||
touch /data/misc/taichi_enforce | ||
setenforce 0 | ||
exit 0 | ||
fi | ||
fi | ||
AB_UPDATE=$(getprop ro.build.ab_update) | ||
grep ' / ' /proc/mounts | grep -qv 'rootfs' && SAR="true" || SAR="false" | ||
[ "${AB_UPDATE}" != "true" ] || ([ "${AB_UPDATE}" == "true" ] && [ "${SAR}" == "false" ]) && ENFORCE="true" || ENFORCE="false" | ||
|
||
magiskpolicy --live "allow system_server system_server process { execmem }"\ | ||
"allow system_server apk_data_file file *"\ | ||
"allow system_server app_data_file file *"\ | ||
"allow system_server dalvikcache_data_file file { execute }"\ | ||
"allow system_server system_file file { execute_no_trans }" | ||
if ([ $(getprop ro.build.version.sdk) -ge 29 ] && [ "${ENFORCE}" == "true" ]) || [ ! -f "${SEPOLICY_FILE}" ]; then | ||
touch "${ENFORCE_FILE}" >&2 | ||
setenforce 0 | ||
else | ||
grep -v '^#' < "${SEPOLICY_FILE}" | while read RULE; do | ||
magiskpolicy --live "${RULE}" | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,34 @@ | ||
#!/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 | ||
|
||
TAICHI_LOG=/data/local/tmp/taichi.log | ||
logcat > ${TAICHI_LOG} & | ||
LOGCAT_PID=$! | ||
|
||
log() { | ||
echo "[$(date +"%H:%M:%S:%3N %d-%m-%Y")] $1" | tee -a ${TAICHI_LOG} | ||
} | ||
WATCH_FILE="/data/misc/taichi" | ||
ENFORCE_FILE="/data/misc/taichi_enforce" | ||
|
||
timeout=10 | ||
WATCH_FILE=/data/misc/taichi | ||
while ((timeout > 0)) && [[ ! -f ${WATCH_FILE} ]]; | ||
do | ||
while [ ! -f "${WATCH_FILE}" ] && [ "$timeout" -gt 0 ]; do | ||
timeout=$((timeout-1)) | ||
sleep 1 | ||
((timeout -= 1)) | ||
done | ||
|
||
if [[ ! -f ${WATCH_FILE} ]]; then | ||
setprop ctl.restart zygote_secondary | ||
if [ ! -f "${WATCH_FILE}" ]; then | ||
setprop ctl.restart zygote_secondary >&2 | ||
else | ||
rm ${WATCH_FILE} | ||
rm -f "${WATCH_FILE}" | ||
fi | ||
|
||
max_wait=300 | ||
interval=1 | ||
BOOT_COMPLETED=false | ||
while [[ "$max_wait" -gt 0 ]]; do | ||
if [[ "$(getprop sys.boot_completed)" = "1" ]];then | ||
BOOT_COMPLETED=true | ||
log "BOOT_COMPLETED" | ||
break | ||
fi | ||
sleep ${interval} | ||
log "WAIT FOR BOOT_COMPLETE" | ||
max_wait=$((max_wait-1)) | ||
until [ $(getprop sys.boot_completed) -eq 1 ]; do | ||
sleep 1 | ||
done | ||
|
||
ENFORCE_FILE=/data/misc/taichi_enforce | ||
if [[ -f ${ENFORCE_FILE} ]] && [[ "${BOOT_COMPLETED}" = "true" ]];then | ||
log "RESTORE SELinux" | ||
rm ${ENFORCE_FILE} | ||
if [ -f "${ENFORCE_FILE}" ]; then | ||
rm -f "${ENFORCE_FILE}" | ||
setenforce 1 | ||
fi | ||
|
||
kill ${LOGCAT_PID} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Set what you want to display when installing your module | ||
print_modname() { | ||
ui_print "*******************************" | ||
ui_print " TaiChi - Magisk " | ||
ui_print " " | ||
ui_print " by @weishu " | ||
ui_print " " | ||
ui_print " https://taichi.cool " | ||
ui_print "*******************************" | ||
} | ||
|
||
on_install() { | ||
ui_print "- Extracting module files" | ||
unzip -oj "$ZIPFILE" taichi module.prop uninstall.sh 'common/*' -d $MODPATH >&2 | ||
unzip -o "$ZIPFILE" 'system/*' -d $MODPATH >&2 | ||
|
||
chmod 0100 $MODPATH/taichi | ||
$MODPATH/taichi $MODPATH $MODPATH | ||
rm -f $MODPATH/taichi 2>&1 >/dev/null | ||
|
||
[ $? -eq 0 ] && ui_print "Installed." || abort "Install error: $?" | ||
} | ||
|
||
set_permissions() { | ||
ui_print "- Setting permissions" | ||
# The following is the default rule, DO NOT remove | ||
set_perm_recursive $MODPATH 0 0 0755 0644 | ||
# set_perm $MODPATH/system/lib/libmedia_legacy.so 0 0 0644 u:object_r:system_lib_file:s0 | ||
} | ||
|
||
SKIPUNZIP=1 | ||
print_modname | ||
on_install | ||
set_permissions |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
id=taichi | ||
name=Taichi | ||
version=v6.1.4 | ||
versionCode=614 | ||
version=v6.1.5 | ||
versionCode=615 | ||
author=weishu | ||
description=Use Xposed modules with Taichi in Magisk. | ||
minMagisk=17000 | ||
description=Use Xposed modules with Taichi in Magisk. |
Oops, something went wrong.