From 40c51a418823653b0ce94c5b227756eb42c1bc97 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 8 Jul 2018 19:10:37 +0200 Subject: [PATCH] update mount code for patcher, too --- ChangeLog.md | 2 +- patcher/CommonPatcher | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index faaad15..3250735 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -16,7 +16,7 @@ * more information below * by default install Déjà Vu and Mozilla nlp Backends * improve GApps uninstallation routine -* CommonInstaller +* CommonInstaller, CommonPatcher * improved A/B device support code taken from Magisk 16.6 ### Updates diff --git a/patcher/CommonPatcher b/patcher/CommonPatcher index 1be9049..a13167d 100644 --- a/patcher/CommonPatcher +++ b/patcher/CommonPatcher @@ -58,11 +58,17 @@ mount_image() { 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 mount_partitions () { - SLOT=$(getprop ro.boot.slot_suffix) + SLOT=$(grep_cmdline androidboot.slot_suffix) if [ -z ${SLOT} ]; then - SLOT=$(getprop ro.boot.slot) + SLOT=$(grep_cmdline androidboot.slot) [ "${SLOT}" = "_" ] && SLOT= fi @@ -77,13 +83,13 @@ mount_partitions () { mount -t ext4 -o rw $SYSTEMBLOCK /system 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 mount --move /system /system_root mount -o bind /system_root/system /system fi - - [ ! -f /system/build.prop ] && error "failed to mount /system" } error () {