Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
Signed-off-by: yanbuyu <yanbuyuby@163.com>
  • Loading branch information
yanbuyu committed Jan 11, 2022
1 parent d346a19 commit 95e9019
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#### 特别说明
- 系统跨版本升级时会自动比对fingerprint(指纹)属性,所以每次系统升级后会自动禁用XiaomiCTSPass模块;更新完开机后,重启一次,即可自动启用XiaomiCTSPass模块
- 刷完后必须开启magisk hide(在v1.2.6及其后的版本中,XiaomiCTSPass模块将自动开启magisk hide)
- 刷完后必须开启magisk hide
- 若系统是2021年8月份后的MIUI版本,XiaomiCTSPass模块必须搭配[Universal SafetyNet Fix模块](https://github.com/kdrag0n/safetynet-fix)使用
- 禁用或启用XiaomiCTSPass模块时,需重新载入参数,首次开机时间变长属于正常情况

Expand Down
15 changes: 11 additions & 4 deletions codes.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ print_modname() {
ui_print "*******************************"
}

magiskhide enable
#magiskhide enable

create_props(){
propfile=$INSTALLER/props/${miuidevice}_sdk${SDK}.prop
propfile=$INSTALLER/props/${DEVICE}_sdk${SDK}.prop
if [ -f $propfile ];then
propsuffix=$(grep "ro.build.fingerprint=" $propfile | cut -d'=' -f2)
rm -f $MODPATH/system.prop
Expand All @@ -25,10 +25,17 @@ create_props(){
cp -af $INSTALLER/module.prop $MODPATH/module.prop
cp -af $INSTALLER/post-fs-data.sh $MODPATH/post-fs-data.sh
##
ui_print "- 当前机型代号:$miuidevice"
ui_print "- 当前设备代号:$DEVICE"
ui_print "- 当前设备型号:$MODEL"
ui_print "- 当前安卓SDK版本:$SDK"
ui_print "- 当前安卓版本:$ANDROID"
ui_print "- github地址:https://github.com/yanbuyu/XiaomiCTSPass"
else
abort "! 暂未收录该机型或该版本"
ui_print "- 当前设备代号:$DEVICE"
ui_print "- 当前设备型号:$MODEL"
ui_print "- 当前安卓SDK版本:$SDK"
ui_print "- 当前安卓版本:$ANDROID"
ui_print "- github地址:https://github.com/yanbuyu/XiaomiCTSPass"
abort "! 暂未收录该机型或该版本,您可按照开源地址上的说明自行适配"
fi
}
108 changes: 56 additions & 52 deletions scripts/getinfo.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,56 +1,60 @@
#!/sbin/sh

getpropPro(){
propValue=`grep "${1}=" $2 | cut -d'=' -f2 | sed 's# ##g' | tr -d '\n\r'`
}
#某些rec可能getprop会报错,干脆重写了一个获取ROM信息的函数
getName(){
unset getValue
[ -f $2 ] && getValue=`grep "${1}=" $2 | cut -d'=' -f2 | sed 's# ##g' | tr -d '\n\r'`
}

blockList="system/system system_ext product system vendor"
for blockName in ${blockList};do
buildFile=/$blockName/build.prop
##获取设备代号
blockName=$(echo "$blockName" | sed "s#/system##g")
deviceList="ro.product.${blockName}.device ro.product.device"
for d in ${deviceList};do
if [ -f $buildFile ];then
getpropPro "$d" "$buildFile"
if [ "$propValue" ] && [ "$propValue" != "qssi" ];then
miuidevice=$propValue
break
fi
fi
done
##获取机型号
modelList="ro.product.${blockName}.marketname ro.product.marketname ro.product.${blockName}.model ro.product.model"
for d in ${modelList};do
if [ -f $buildFile ];then
getpropPro "$d" "$buildFile"
if [ "$propValue" ] && [ ! "$(echo "$propValue" | grep -E "qssi|arm64")" ];then
miuimodel=$propValue
[ "$miuidevice" == "star" ] || [ "$miuidevice" == "mars" ] && miuimodel="Mi11Pro&Ultra"
break
fi
fi
done
##获取SDK
SDKList="ro.${blockName}.build.version.sdk ro.build.version.sdk"
for d in ${SDKList};do
if [ -f $buildFile ];then
getpropPro "$d" "$buildFile"
if [ "$propValue" ];then
SDK=$propValue
break
fi
fi
done
##获取miui版本号
versionList="ro.${blockName}.build.version.incremental ro.build.version.incremental"
for d in ${versionList};do
if [ -f $buildFile ];then
getpropPro "$d" "$buildFile"
if [ "$propValue" ];then
miuiversion=$propValue
break
fi
fi
done
##
systemBuildProp=/system/system/build.prop
[ ! -f $systemBuildProp ] && systemBuildProp=/system/build.prop
vendorBuildProp=/vendor/build.prop

##获取MIUI版本号
getName "ro.build.version.incremental" $systemBuildProp
VERSION="$getValue"
if [ ! "$VERSION" ];then
getName "ro.system.build.version.incremental" $systemBuildProp
VERSION="$getValue"
fi
##获取SDK版本
getName "ro.build.version.sdk" $systemBuildProp
SDK="$getValue"
if [ ! "$SDK" ];then
getName "ro.system.build.version.sdk" $systemBuildProp
SDK="$getValue"
fi
##获取安卓版本
getName "ro.build.version.release" $systemBuildProp
ANDROID="$getValue"
if [ ! "$ANDROID" ];then
getName "ro.system.build.version.release" $systemBuildProp
ANDROID="$getValue"
fi
##获取设备代号
getName "ro.product.device" $systemBuildProp
DEVICE="$getValue"
if [ ! "$DEVICE" ];then
getName "ro.product.vendor.device" $vendorBuildProp
DEVICE="$getValue"
fi

##获取老设备型号
getName "ro.product.model" $systemBuildProp
MODEL="$getValue"
##获取build_xxx.prop路径
vendorBuildProps=$(ls /vendor/*.prop 2>/dev/null)
for buildProp in $vendorBuildProps;do
getName "ro.product.vendor.device" $buildProp
if [ "$getValue" ] && [ "$getValue" == "$DEVICE" ] && [ ! "$MODEL" ];then
getName "ro.product.vendor.marketname" $buildProp
MODEL="$getValue"
[[ "$MODEL" ]] && break
fi
done
##获取默认型号
if [ ! "$MODEL" ];then
getName "ro.product.vendor.model" $vendorBuildProp
MODEL="$getValue"
fi

0 comments on commit 95e9019

Please sign in to comment.