2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-31 09:20:23 +00:00

patcher: initial A/B partition scheme support

This commit is contained in:
Christopher Roy Bratusek 2018-03-09 20:10:38 +01:00
parent 1a73733155
commit 429710af8f
3 changed files with 63 additions and 20 deletions

View File

@ -2,6 +2,10 @@
## 16.3 in-dev ## 16.3 in-dev
* Full, microG, F-Droid packages
* improved A/B partition scheme support
* Patcher
* initial A/B parition scheme support
* Updates (automatic) * Updates (automatic)
* AnySoftKeyboard (1.9.1117) * AnySoftKeyboard (1.9.1117)
* Déjà Vu nlpBackend (1.1.3) * Déjà Vu nlpBackend (1.1.3)

View File

@ -81,6 +81,34 @@ mount_image() {
fi fi
} }
# taken from Magisk, with minor modifications for NanoDroid
mount_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
[ ! -f /system/build.prop ] && mount -o ro /system 2>/dev/null
if [ ! -f /system/build.prop ]; then
SYSTEMBLOCK=$(find /dev/block -iname system${SLOT} | head -n 1)
mount -t ext4 -o ro $SYSTEMBLOCK /system
fi
if [ -f /system/init.rc ]; then
mkdir /system_root 2>/dev/null
mount --move /system /system_root
mount -o bind /system_root/system /system
fi
[ ! -f /system/build.prop ] && error "failed to mount /system"
}
error () { error () {
ui_print "${@}" ui_print "${@}"
magisk_cleanup magisk_cleanup
@ -454,11 +482,7 @@ nanodroid_sigspoofui=0
get_config .nanodroid-setup get_config .nanodroid-setup
[ "$config_exists" -eq 1 ] && source ${config} [ "$config_exists" -eq 1 ] && source ${config}
if ! (is_mounted /data); then mount_partition
mount -orw /data || error " !! failed to mount /data"
else mount -orw,remount /data || \
error " !! failed to remount /data read-write"
fi
if [ -f /data/adb/.nanodroid-patcher ]; then if [ -f /data/adb/.nanodroid-patcher ]; then
ui_print " !! /data/adb/.nanodroid-patcher exists" ui_print " !! /data/adb/.nanodroid-patcher exists"
@ -466,12 +490,6 @@ if [ -f /data/adb/.nanodroid-patcher ]; then
error " !! remove this file and try again" error " !! remove this file and try again"
fi fi
if ! (is_mounted /system); then
mount -orw /system || error " !! failed to mount /system"
else mount -orw,remount /system || \
error " !! failed to remount /system read-write"
fi
setup_patcher setup_patcher
detect_sdk detect_sdk

View File

@ -68,6 +68,34 @@ mount_image() {
fi fi
} }
# taken from Magisk, with minor modifications for NanoDroid
mount_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
[ ! -f /system/build.prop ] && mount -o ro /system 2>/dev/null
if [ ! -f /system/build.prop ]; then
SYSTEMBLOCK=$(find /dev/block -iname system${SLOT} | head -n 1)
mount -t ext4 -o ro $SYSTEMBLOCK /system
fi
if [ -f /system/init.rc ]; then
mkdir /system_root 2>/dev/null
mount --move /system /system_root
mount -o bind /system_root/system /system
fi
[ ! -f /system/build.prop ] && error "failed to mount /system"
}
error () { error () {
ui_print "${@}" ui_print "${@}"
magisk_cleanup magisk_cleanup
@ -389,18 +417,11 @@ main () {
ui_print "*******************************" ui_print "*******************************"
ui_print " " ui_print " "
mount_partitions
[ -f /data/adb/.nanodroid-patcher ] && \ [ -f /data/adb/.nanodroid-patcher ] && \
rm -f /data/adb/.nanodroid-patcher rm -f /data/adb/.nanodroid-patcher
if ! (is_mounted /data); then
mount -orw /data || error " !! failed to mount /data"
else mount -orw,remount /data || error " !! failed to remount /data read-write"
fi
if ! (is_mounted /system); then
mount -oro /system || error " !! failed to mount /system"
fi
get_config .nanodroid-setup get_config .nanodroid-setup
[ "$config_exists" -eq 1 ] && source ${config} [ "$config_exists" -eq 1 ] && source ${config}