add A/B partion scheme support (from Magisk)

merge-requests/23/head
Christopher Roy Bratusek 6 years ago
parent 0a5b020167
commit f7369af0f9

@ -3,6 +3,8 @@
## 16.2 in-dev
* General Changes:
* Full, microG, F-Droid packages
* use Magisk's mount code to support of devices with A/B partion scheme
* nanodroid-overlay Script
* add `-U`, `--update-apks` switch to nanodroid-overlay script, downloads and installs latest versions of custom NanoDroid apks, requires Busybox to be installed (for wget applet)
* Fake Store
@ -11,6 +13,7 @@
* OpenLauncher
* Updates (manual)
* Play Store (8.9.24)
* Kernel Adiutor (0.9.74.3)
## 16.1.20180209
* Bug Fixes:

@ -21,7 +21,7 @@ detect_outfd
show_banner
check_system
mount_all_partitions
unpack_zip
detect_arch

@ -21,9 +21,8 @@ detect_outfd
show_banner
check_system
mount_all_partitions
unpack_zip
detect_arch
get_cfg_setup

@ -111,14 +111,6 @@ show_banner () {
ui_print " "
}
check_system () {
is_mounted /system || mount -o ro /system 2>/dev/null
is_mounted /data || mount /data 2>/dev/null
[ ! -f '/system/build.prop' ] && \
error " !! /system/build.prop does not exist"
}
error () {
ui_print " !!"
ui_print "${@}"
@ -134,6 +126,45 @@ error () {
exit 1
}
# taken from Magisk, with minor modifications for NanoDroid
mount_all_partitions () {
SLOT=$(getprop ro.boot.slot_suffix)
if [ -z ${SLOT} ]; then
SLOT=$(getprop ro.boot.slot)
[ ${SLOT} = "_" ] && SLOT=
fi
is_mounted /data || mount /data 2>/dev/null
${BOOTMODE} || mount -o bind /dev/urandom /dev/random
is_mounted /system || [ -f /system/build.prop ] || mount -o ro /system 2>/dev/null
if ! is_mounted /system && ! [ -f /system/build.prop ]; then
SYSTEMBLOCK=$(find /dev/block -iname system${SLOT} | head -n 1)
mount -t ext4 -o ro $SYSTEMBLOCK /system
fi
is_mounted /system || [ -f /system/build.prop ] || error "failed to mount /system"
cat /proc/mounts | grep -E '/dev/root|/system_root' >/dev/null && SKIP_INITRAMFS=true || SKIP_INITRAMFS=false
if [ -f /system/init.rc ]; then
SKIP_INITRAMFS=true
mkdir /system_root 2>/dev/null
mount --move /system /system_root
mount -o bind /system_root/system /system
fi
if [ -L /system/vendor ]; then
is_mounted /vendor || mount -o ro /vendor 2>/dev/null
if ! is_mounted /vendor; then
VENDORBLOCK=$(find /dev/block -iname vendor${SLOT} | head -n 1)
mount -t ext4 -o ro ${VENDORLOCK} /vendor
fi
is_mounted /vendor || error "failed to mount /vendor"
fi
}
detect_mode () {
case "${nanodroid_forcesystem}" in
1 )
@ -169,8 +200,13 @@ detect_mode () {
;;
esac
else
mount -orw,remount /system 2>/dev/null || \
error " !! failed to re-mount /system read-write"
if is_mounted /system_root; then
mount -orw,remount /system_root 2>/dev/null || \
error " !! failed to re-mount /system read-write"
else
mount -orw,remount /system 2>/dev/null || \
error " !! failed to re-mount /system read-write"
fi
unset MODPATH
fi
}
@ -230,7 +266,13 @@ nanodroid_finalize () {
nanodroid_storelogs
[ "${MODE}" = "MAGISK" ] && magisk_install_finish
rm -rf ${INSTALLER}
${BOOTMODE} || umount /system 2>/dev/null
if ! ${BOOTMODE} ; then
umount -l /system_root 2>/dev/null
umount -l /system 2>/dev/null
umount -l /vendor 2>/dev/null
umount -l /dev/random 2>/dev/null
fi
ui_print " "
ui_print " Thanks for using NanoDroid "

@ -21,7 +21,7 @@ detect_outfd
show_banner
check_system
mount_all_partitions
unpack_zip
detect_arch

Loading…
Cancel
Save