Add rudimentary detection for A/B devices

* Bail if A/B device is detected

Change-Id: Id1c205eb96d6e5e9e67183f410467d82ac121540
Signed-off-by: Paul Keith <javelinanddart@bestas.gr>
This commit is contained in:
Paul Keith 2017-05-10 14:33:53 -05:00
parent 844fcf1951
commit a3ae309eaa

View File

@ -29,28 +29,38 @@ ui_print "**********************"
ui_print "MindTheGapps installer" ui_print "MindTheGapps installer"
ui_print "**********************" ui_print "**********************"
ui_print "Mounting /system" ABDEVICE=`getprop ro.build.system_root_image`
if mount /system; then ui_print "Mounting system partition"
ui_print "/system mounted"
else if [ "$ABDEVICE" == "true" ]; then
ui_print "Could not mount /system! Aborting" SYSTEM="/system/system"
# TODO: Actually handle A/B ota devices
ui_print "A/B OTA device detected! This is unsupported. Aborting"
exit 1 exit 1
else
SYSTEM="/system"
if mount $SYSTEM; then
ui_print "$SYSTEM mounted"
else
ui_print "Could not mount $SYSTEM! Aborting"
exit 1
fi
fi fi
if [ -f /system/bin/toybox ]; then if [ -f $SYSTEM/bin/toybox ]; then
UTILS=/system/bin/toybox UTILS=$SYSTEM/bin/toybox
LD_PATH=/system/lib LD_PATH=$SYSTEM/lib
else else
ui_print "Could not find /system/bin/toybox! Aborting" ui_print "Could not find $SYSTEM/bin/toybox! Aborting"
exit 1 exit 1
fi fi
DIRS="addon.d app priv-app framework etc lib" DIRS="addon.d app priv-app framework etc lib"
if [ -d /system/lib64 ]; then if [ -d $SYSTEM/lib64 ]; then
DIRS="$DIRS lib64" DIRS="$DIRS lib64"
LD_PATH=/system/lib64 LD_PATH=$SYSTEM/lib64
fi fi
LOWMEM=1572864 LOWMEM=1572864
@ -91,13 +101,13 @@ for dirs in $DIRS; do
done done
done done
ui_print "Copying files" ui_print "Copying files"
exec_util "cp --preserve=a -r ./* /system/" exec_util "cp --preserve=a -r ./* $SYSTEM/"
ui_print "Cleaning up files" ui_print "Cleaning up files"
cd ../ cd ../
exec_util "rm -rf system/" exec_util "rm -rf system/"
ui_print "Unmounting /system" ui_print "Unmounting system partition"
umount /system umount $SYSTEM
ui_print "Done!" ui_print "Done!"
exit 0 exit 0