Skip to content

Commit

Permalink
rewrite codes
Browse files Browse the repository at this point in the history
Signed-off-by: yanbuyu <[email protected]>
  • Loading branch information
yanbuyu committed Feb 11, 2022
1 parent ee15b5f commit 44f5227
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 38 deletions.
8 changes: 6 additions & 2 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mount -o ro -t auto /system_ext 2>/dev/null;

#释放文件
mkdir -p $TMPDIR
unzip -o "$ZIPFILE" module.prop module_pro.prop post-fs-data.sh "props/*" "release/*" customize.sh 'scripts/*' -d $TMPDIR >&2
unzip -o "$ZIPFILE" module.prop module_pro.prop post-fs-data.sh "props/*" "release/*" customize.sh "uninstall.sh" 'scripts/*' -d $TMPDIR >&2

log=$(cat $TMPDIR/release/changelog.md | tr -s "\n" "\n")
ui_print "$log"
Expand All @@ -69,6 +69,9 @@ ui_print " "
[ ! -f $TMPDIR/scripts/getinfo.sh ] && abort "! Unable to extract getinfo.sh!"
. $TMPDIR/scripts/getinfo.sh

##移除旧版检测模块
rm -rf $NVBASE/modules/checkCTSModule

##
create_props

Expand All @@ -77,7 +80,8 @@ cp -af $TMPDIR/module.prop $MODPATH/module.prop
cp -af $TMPDIR/module_pro.prop $MODPATH/module_pro.prop
cp -af $TMPDIR/system.prop $MODPATH/system.prop
cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
cp -af $TMPDIR/scripts/init.d $MODPATH/init.d
cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
sed -i "s/REPLACE_SDK/$SDK/g" $MODPATH/post-fs-data.sh

##取消挂载
umount product 2>/dev/null;
Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=XiaomiCTSPass
name=Xiaomi CTS Pass
version=v1.4.2
versionCode=142
version=v1.4.3
versionCode=143
author=yanbuyu
description=强制小米设备通过谷歌CTS测试,github开源地址:https://github.com/yanbuyu/XiaomiCTSPass
updateJson=https://raw.githubusercontent.com/yanbuyu/XiaomiCTSPass/master/release/XiaomiCTSPass.json
6 changes: 0 additions & 6 deletions module_pro.prop

This file was deleted.

32 changes: 25 additions & 7 deletions post-fs-data.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
#!/sbin/sh
currentDir=$(dirname $0)
modulesDir=$(dirname $currentDir)
newModule=$modulesDir/checkCTSModule
mkdir -p $newModule
cp -af $currentDir/module_pro.prop $newModule/module.prop
##自启脚本
mount -o remount,rw -t auto /data

##变量
MODDIR=${0%/*}
MODSDIR=$(dirname ${MODDIR%/*})/XiaomiCTSPass
systemprop=$MODDIR/system.prop
systemprop_bak=$MODDIR/system.prop.bak
moduleprop=$MODDIR/module.prop
##检测安卓版本
SDK=$(getprop ro.build.version.sdk)
cat $currentDir/init.d | sed "s#REPLACE_SDK#$SDK#g;s#REPLACE_MODULE#$currentDir#g" >$newModule/post-fs-data.sh
[[ "$SDK" != REPLACE_SDK ]] && rm -rf $MODDIR
##比对指纹
fingerprint=$(getprop ro.build.fingerprint)
mkdir -p $MODSDIR
log=$MODSDIR/fingerprint_record.log
if [ -f "$log" ];then
getline=$(cat $log | sed 's/\n//g;s/\r//g')
if [ "$getline" == "$fingerprint" ];then
[[ -f $systemprop_bak ]] && mv -f $systemprop_bak $systemprop
sed -i "s#description=.*#description=强制小米设备通过谷歌CTS测试,github开源地址:https://github.com/yanbuyu/XiaomiCTSPass#" $moduleprop
else
[[ -f $systemprop ]] && mv -f $systemprop $systemprop_bak
sed -i "s#description=.*#description=🤔该设备似乎刚更新完系统,请重启设备以激活XiaomiCTSPass#" $moduleprop
fi
fi
echo "$fingerprint" >$log
21 changes: 0 additions & 21 deletions scripts/init.d

This file was deleted.

4 changes: 4 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/sbin/sh
MODDIR=${0%/*}
MODSDIR=$(dirname ${MODDIR%/*})/XiaomiCTSPass
rm -rf $MODSDIR

0 comments on commit 44f5227

Please sign in to comment.