From f2403b03ae4a9b9f13239efb0b0ac0279cdcc680 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 18 Oct 2020 09:42:02 +0200 Subject: [PATCH] nanodroid-overlay: further fixes --- Full/system/bin/nanodroid-overlay | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Full/system/bin/nanodroid-overlay b/Full/system/bin/nanodroid-overlay index 9f9be197..73fa522b 100755 --- a/Full/system/bin/nanodroid-overlay +++ b/Full/system/bin/nanodroid-overlay @@ -9,6 +9,12 @@ OVERLAY_PATH="" [ -f /tmp/backuptool.functions ] && MODE=INSTALL [ -f /postinstall/tmp/backuptool.functions ] && MODE=INSTALL +# detect whether we need to remount /system or / in system mode +if grep -q " $(readlink -f /system) " /proc/mounts 2>/dev/null; then + remount_point=/system +else remount_point=/ +fi + error () { echo "!! ${@}" exit 1 @@ -59,7 +65,9 @@ Options System Mode: exit 0 } -test "$(whoami)" != "root" && error "not running as root" +if [ "${MODE}" != "INSTALL" ]; then + test "$(whoami)" != "root" && error "not running as root" +fi get_config () { config="" @@ -90,7 +98,7 @@ overrides_add_intern () { } overrides_add () { - [ "${MODE}" = "SYSTEM" ] && mount -orw,remount /system + [ "${MODE}" = "SYSTEM" ] && mount -orw,remount ${remount_point} for app in ${@}; do for path in ${app_locations}; do @@ -98,7 +106,7 @@ overrides_add () { done done - [ "${MODE}" = "SYSTEM" ] && mount -oro,remount /system + [ "${MODE}" = "SYSTEM" ] && mount -oro,remount ${remount_point} } overrides_remove_intern () {