Last active
December 18, 2018 18:40
-
-
Save cjybyjk/b38a77ff00a168c1a1df5b3dfa3104fa to your computer and use it in GitHub Desktop.
a function to check MIUI version when installing magisk module.
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
# check MIUI version | |
# for Magisk only | |
# author: cjybyjk @ coolapk | |
# usage: append to config.sh | |
# $1:requireVersion | |
checkMIUIver() { | |
local requiredVersion="$1" | |
local arrRequiredVersion=(${requiredVersion//./ }) | |
local nowVersion="`grep_prop ro.build.version.incremental`" | |
local arrNowVersion=(${nowVersion//./ }) | |
local isLowerVer=false | |
for i in $(seq 0 2) | |
do | |
if [ ${arrRequiredVersion[$i]} -gt ${arrNowVersion[$i]} ]; then | |
isLowerVer=true | |
break | |
elif [ ${arrRequiredVersion[$i]} -lt ${arrNowVersion[$i]} ]; then | |
break | |
fi | |
done | |
if $isLowerVer ; then | |
ui_print "! Your MIUI version is less than required MIUI version." | |
ui_print " Your MIUI version: $nowVersion" | |
ui_print " Required MIUI version: $requiredVersion" | |
return 1 | |
fi | |
return 0 | |
} | |
checkMIUIver "8.0.0" # replace 8.0.0 to your own version | |
[ $? -ne 0 ] && exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment