forked from yanbuyu/XiaomiCTSPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-fs-data.sh
executable file
·27 lines (26 loc) · 1 KB
/
post-fs-data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/sbin/sh
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)
[[ "$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