Skip to content

Commit

Permalink
nanodroid-overlay: further fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanolx committed Oct 18, 2020
1 parent 1aaf79f commit f2403b0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Full/system/bin/nanodroid-overlay
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=""
Expand Down Expand Up @@ -90,15 +98,15 @@ 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
[ -d ${path}/${app} ] && overrides_add_intern ${path} ${app}
done
done

[ "${MODE}" = "SYSTEM" ] && mount -oro,remount /system
[ "${MODE}" = "SYSTEM" ] && mount -oro,remount ${remount_point}
}

overrides_remove_intern () {
Expand Down

0 comments on commit f2403b0

Please # to comment.