update mount code for patcher, too

merge-requests/23/head
Christopher Roy Bratusek 6 years ago
parent 16334e3aa0
commit 40c51a4188

@ -16,7 +16,7 @@
* more information below * more information below
* by default install Déjà Vu and Mozilla nlp Backends * by default install Déjà Vu and Mozilla nlp Backends
* improve GApps uninstallation routine * improve GApps uninstallation routine
* CommonInstaller * CommonInstaller, CommonPatcher
* improved A/B device support code taken from Magisk 16.6 * improved A/B device support code taken from Magisk 16.6
### Updates ### Updates

@ -58,11 +58,17 @@ mount_image() {
fi fi
} }
grep_cmdline() {
local REGEX="s/^${1}=//p"
sed -E 's/ +/\n/g' /proc/cmdline | \
sed -n "${REGEX}" 2>/dev/null
}
# taken from Magisk, with minor modifications for NanoDroid # taken from Magisk, with minor modifications for NanoDroid
mount_partitions () { mount_partitions () {
SLOT=$(getprop ro.boot.slot_suffix) SLOT=$(grep_cmdline androidboot.slot_suffix)
if [ -z ${SLOT} ]; then if [ -z ${SLOT} ]; then
SLOT=$(getprop ro.boot.slot) SLOT=$(grep_cmdline androidboot.slot)
[ "${SLOT}" = "_" ] && SLOT= [ "${SLOT}" = "_" ] && SLOT=
fi fi
@ -77,13 +83,13 @@ mount_partitions () {
mount -t ext4 -o rw $SYSTEMBLOCK /system mount -t ext4 -o rw $SYSTEMBLOCK /system
fi fi
if [ -f /system/init.rc ]; then [ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
if [ -f /system/init ]; then
mkdir /system_root 2>/dev/null mkdir /system_root 2>/dev/null
mount --move /system /system_root mount --move /system /system_root
mount -o bind /system_root/system /system mount -o bind /system_root/system /system
fi fi
[ ! -f /system/build.prop ] && error "failed to mount /system"
} }
error () { error () {

Loading…
Cancel
Save