-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aac83e1
commit 0cbacbb
Showing
7 changed files
with
234 additions
and
0 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,36 @@ | ||
#!/sbin/sh | ||
|
||
################# | ||
# 初始化 | ||
################# | ||
|
||
umask 022 | ||
|
||
# 加载util_functions之前 | ||
ui_print() { echo "$1"; } | ||
|
||
require_new_magisk() { | ||
ui_print "*******************************" | ||
ui_print " 请安装 Magisk v20.4+! " | ||
ui_print "*******************************" | ||
exit 1 | ||
} | ||
|
||
######################### | ||
# 本地 util_functions.sh | ||
######################### | ||
|
||
OUTFD=$2 | ||
ZIPFILE=$3 | ||
|
||
mount /data 2>/dev/null | ||
|
||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk | ||
. /data/adb/magisk/util_functions.sh | ||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk | ||
|
||
install_module | ||
|
||
on_install | ||
|
||
exit 0 |
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 @@ | ||
#MAGISK |
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,143 @@ | ||
########################################################################################## | ||
# | ||
# Magisk模块安装脚本 | ||
# | ||
########################################################################################## | ||
########################################################################################## | ||
# | ||
# 使用说明: | ||
# | ||
# 1. 将文件放入系统文件夹(删除placeholder文件) | ||
# 2. 在module.prop中填写您的模块信息 | ||
# 3. 在此文件中配置和调整 | ||
# 4. 如果需要开机执行脚本,请将其添加到post-fs-data.sh或service.sh | ||
# 5. 将其他或修改的系统属性添加到system.prop | ||
# | ||
########################################################################################## | ||
########################################################################################## | ||
# | ||
# 安装框架将导出一些变量和函数。 | ||
# 您应该使用这些变量和函数来进行安装。 | ||
# | ||
# !请不要使用任何Magisk的内部路径,因为它们不是公共API。 | ||
# !请不要在util_functions.sh中使用其他函数,因为它们也不是公共API。 | ||
# !不能保证非公共API在版本之间保持兼容性。 | ||
# | ||
# 可用变量: | ||
# | ||
# MAGISK_VER (string):当前已安装Magisk的版本的字符串(字符串形式的Magisk版本) | ||
# MAGISK_VER_CODE (int):当前已安装Magisk的版本的代码(整型变量形式的Magisk版本) | ||
# BOOTMODE (bool):如果模块当前安装在Magisk Manager中,则为true。 | ||
# MODPATH (path):你的模块应该被安装到的路径 | ||
# TMPDIR (path):一个你可以临时存储文件的路径 | ||
# ZIPFILE (path):模块的安装包(zip)的路径 | ||
# ARCH (string): 设备的体系结构。其值为arm、arm64、x86、x64之一 | ||
# IS64BIT (bool):如果$ARCH(上方的ARCH变量)为arm64或x64,则为true。 | ||
# API (int):设备的API级别(Android版本) | ||
# | ||
# 可用函数: | ||
# | ||
# ui_print <msg> | ||
# 打印(print)<msg>到控制台 | ||
# 避免使用'echo',因为它不会显示在定制recovery的控制台中。 | ||
# | ||
# abort <msg> | ||
# 打印错误信息<msg>到控制台并终止安装 | ||
# 避免使用'exit',因为它会跳过终止的清理步骤 | ||
# | ||
########################################################################################## | ||
|
||
########################################################################################## | ||
# 变量 | ||
########################################################################################## | ||
|
||
# 如果您需要更多的自定义,并且希望自己做所有事情 | ||
# 请在custom.sh中标注SKIPUNZIP=1 | ||
# 以跳过提取操作并应用默认权限/上下文上下文步骤。 | ||
# 请注意,这样做后,您的custom.sh将负责自行安装所有内容。 | ||
SKIPUNZIP=0 | ||
# 如果您需要调用Magisk内部的busybox | ||
# 请在custom.sh中标注ASH_STANDALONE=1 | ||
ASH_STANDALONE=0 | ||
|
||
########################################################################################## | ||
# 替换列表 | ||
########################################################################################## | ||
|
||
# 列出你想在系统中直接替换的所有目录 | ||
# 查看文档,了解更多关于Magic Mount如何工作的信息,以及你为什么需要它 | ||
|
||
# 按照以下格式构建列表 | ||
# 这是一个示例 | ||
REPLACE_EXAMPLE=" | ||
/system/app/Youtube | ||
/system/priv-app/SystemUI | ||
/system/priv-app/Settings | ||
/system/framework | ||
" | ||
|
||
# 在这里建立您自己的清单 | ||
REPLACE=" | ||
" | ||
########################################################################################## | ||
# 安装设置 | ||
########################################################################################## | ||
|
||
# 如果SKIPUNZIP=1你将可能会需要使用以下代码 | ||
# 当然,你也可以自定义安装脚本,需要时请删除# | ||
# 将 $ZIPFILE 提取到 $MODPATH | ||
# ui_print "- 解压模块文件" | ||
# unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2 | ||
# 删除多余文件 | ||
# rm -rf \ | ||
# $MODPATH/system/placeholder $MODPATH/customize.sh \ | ||
# $MODPATH/*.md $MODPATH/.git* $MODPATH/LICENSE 2>/dev/null | ||
|
||
########################################################################################## | ||
# 权限设置 | ||
########################################################################################## | ||
|
||
# 请注意,magisk模块目录中的所有文件/文件夹都有$MODPATH前缀-在所有文件/文件夹中保留此前缀 | ||
# 一些例子: | ||
|
||
# 对于目录(包括文件): | ||
# set_perm_recursive <目录> <所有者> <用户组> <目录权限> <文件权限> <上下文> (默认值是: u:object_r:system_file:s0) | ||
|
||
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644 | ||
# set_perm_recursive $MODPATH/system/vendor/lib/soundfx 0 0 0755 0644 | ||
|
||
# 对于文件(不包括文件所在目录) | ||
# set_perm <文件名> <所有者> <用户组> <文件权限> <上下文> (默认值是: u:object_r:system_file:s0) | ||
|
||
# set_perm $MODPATH/system/lib/libart.so 0 0 0644 | ||
# set_perm /data/local/tmp/file.txt 0 0 644 | ||
|
||
on_install() { | ||
# mars | ||
touch "${MODPATH}/.replace" | ||
thermals_mars=$(find /system/vendor/etc/ -maxdepth 1 -name '*k1a*' -not -name '*thermald*' -not -name '*nolimits*') | ||
ui_print "mars: replacing all thermal confs with nolimits" | ||
for thermal_mars in $thermals_mars; do | ||
ui_print "$thermal_mars" | ||
[[ ! -d $MODPATH/${thermal_mars%/*} ]] && mkdir -p $MODPATH/${thermal_mars%/*} | ||
cp /system/vendor/etc/thermal-k1a-nolimits.conf "${MODPATH}/$thermal_mars" | ||
done | ||
|
||
# star | ||
thermals_star=$(find /system/vendor/etc/ -maxdepth 1 -name 'thermal-*' -not -name '*k1a*' -not -name '*nolimits*') | ||
ui_print "star: replacing all thermal confs with nolimits" | ||
for thermal_star in $thermals_star; do | ||
ui_print "$thermal_star" | ||
[[ ! -d $MODPATH/${thermal_star%/*} ]] && mkdir -p $MODPATH/${thermal_star%/*} | ||
cp /system/vendor/etc/thermal-k1a-nolimits.conf "${MODPATH}/$thermal_star" | ||
done | ||
|
||
[[ -f /data/current ]] && rm -rf /data/current | ||
chattr -i /data/vendor/thermal | ||
chattr -i /data/vendor/thermal/config | ||
rm -rf /data/vendor/thermal/config/* | ||
chattr +i /data/vendor/thermal/config | ||
} | ||
|
||
# 默认权限请勿删除 | ||
set_perm_recursive $MODPATH 0 0 0755 0644 |
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,6 @@ | ||
id=MIUI_thmnlmts | ||
name=MIUI Thermal Nolimits (mars, star) | ||
version=v7 | ||
versionCode=7 | ||
author=HankAviator | ||
description=Apply nolimits conf for all thermal conf, for Mi 11 Pro and Mi 11 Ultra |
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,8 @@ | ||
#!/system/bin/sh | ||
# 不要假设您的模块将位于何处。 | ||
# 如果您需要知道此脚本和模块的放置位置,请使用$MODDIR | ||
# 这将确保您的模块仍能正常工作 | ||
# 即使Magisk将来更改其挂载点 | ||
MODDIR=${0%/*} | ||
|
||
# 此脚本将在post-fs-data模式下执行 |
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,37 @@ | ||
#!/system/bin/sh | ||
# 不要假设您的模块将位于何处。 | ||
# 如果您需要知道此脚本和模块的放置位置,请使用$MODDIR | ||
# 这将确保您的模块仍能正常工作 | ||
# 即使Magisk将来更改其挂载点 | ||
MODDIR=${0%/*} | ||
|
||
# 此脚本将在late_start service 模式执行 | ||
|
||
# 等待开机30秒后开始执行 | ||
# sleep 30 | ||
|
||
# 清理内存 | ||
# killall -9 com.miui.bugreport | ||
# killall -9 com.android.updater | ||
# killall -9 com.miui.analytics | ||
# killall -9 com.miui.voiceassist | ||
# killall -9 com.google.android.marvin.talkback | ||
|
||
# 内存大于8GB设备关闭ZRAM,8GB=8388608,6GB=6291456 | ||
# MemTotalStr=`cat /proc/meminfo | grep MemTotal` | ||
# MemTotalKB=${MemTotalStr:16:8} | ||
# if [[ $MemTotalKB -gt 8388608 ]]; then | ||
# echo "尝试关闭ZRAM" | ||
# swapoff /dev/block/zram0 2>/dev/null | ||
# echo 1 > /sys/block/zram0/reset | ||
# sleep 30 | ||
# zramdisksize=`cat /sys/block/zram0/disksize` | ||
# if [[ $zramdisksize -ne 0 ]]; then | ||
# echo "再次尝试关闭ZRAM" | ||
# swapoff /dev/block/zram0 2>/dev/null | ||
# echo 1 > /sys/block/zram0/reset | ||
# fi | ||
# fi | ||
|
||
# 结束 | ||
exit 0 |
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,3 @@ | ||
# 这个文件将被 resetprop 读取 | ||
# 示例: 改变 dpi | ||
# ro.sf.lcd_density=320 |