mirror of
https://github.com/kdrag0n/safetynet-fix.git
synced 2024-10-04 13:49:51 +00:00
post-fs-data: Dynamically select SDK version at runtime
This allows the module to keep working after major system upgrades.
This commit is contained in:
parent
e94eb5b275
commit
7a732dc9e2
14
customize.sh
14
customize.sh
@ -16,15 +16,15 @@ if getprop ro.build.id | grep -q SPB2; then
|
||||
version="12 Beta 2"
|
||||
fi
|
||||
|
||||
if mv "$MODPATH/system_sdk$sdk" $MODPATH/system; then
|
||||
ui_print "Installing for Android $version"
|
||||
else
|
||||
# Initial version check; version can be changed later.
|
||||
if [[ ! -d "$MODPATH/system_sdk$sdk" ]]; then
|
||||
ui_print "Android $version (SDK $sdk) is not supported!"
|
||||
rm -fr "$MODPATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove unused SDKs
|
||||
rm -fr $MODPATH/system_sdk*
|
||||
|
||||
# Set executable permissions
|
||||
set_perm_recursive $MODPATH/system/bin 0 0 0755 0755
|
||||
for sdk in $MODPATH/system_sdk*
|
||||
do
|
||||
set_perm_recursive $sdk/bin 0 0 0755 0755
|
||||
done
|
||||
|
22
post-fs-data.sh
Executable file
22
post-fs-data.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
MODPATH="/data/adb/modules/safetynet-fix"
|
||||
|
||||
# Get runtime version
|
||||
sdk="$(getprop ro.build.version.sdk)"
|
||||
version="$(getprop ro.vendor.build.version.release)"
|
||||
if getprop ro.build.id | grep -q SPB2; then
|
||||
sdk=31-b2
|
||||
version="12 Beta 2"
|
||||
fi
|
||||
|
||||
# Prepare to update version
|
||||
rm -fr "$MODPATH/system"
|
||||
|
||||
# Make sure version is supported
|
||||
if [[ ! -d "$MODPATH/system_sdk$sdk" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Symlink results in the wrong SELinux context
|
||||
cp -r "$MODPATH/system_sdk$sdk" "$MODPATH/system"
|
Loading…
Reference in New Issue
Block a user