2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-02 03:40:13 +00:00

Uninstaller: Fix A/B partition scheme support

This commit is contained in:
Christopher Roy Bratusek 2018-08-05 13:18:32 +02:00
parent c6ca74b4dc
commit 26b70614ce
2 changed files with 20 additions and 17 deletions

View File

@ -6,6 +6,8 @@
* CommonPatcher
* fix for A/B partition scheme support
* Uninstaller
* fix for A/B partition scheme support
## 17.6.20180805

View File

@ -38,13 +38,18 @@ ui_print() {
}
grep_prop() {
REGEX="s/^$1=//p"
REGEX="${1}"
shift
FILES=$@
if [ -z "$FILES" ]; then
FILES='/system/build.prop'
fi
cat $FILES 2>/dev/null | sed -n "$REGEX" | head -n 1
FILES="${@}"
[ -z "${@}" ] && FILES='/system/build.prop'
sed -n "s/^${REGEX}=//p" ${FILES} | \
head -n 1
}
grep_cmdline() {
local REGEX="s/^${1}=//p"
sed -E 's/ +/\n/g' /proc/cmdline | \
sed -n "${REGEX}" 2>/dev/null
}
is_mounted() {
@ -111,38 +116,34 @@ 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=$(grep_cmdline androidboot.slot_suffix)
if [ -z ${SLOT} ]; then
SLOT=$(grep_cmdline androidboot.slot)
SLOT=_$(grep_cmdline androidboot.slot)
[ "${SLOT}" = "_" ] && SLOT=
fi
is_mounted /data || mount /data 2>/dev/null
is_mounted /data || mount /data
${BOOTMODE} || mount -o bind /dev/urandom /dev/random
[ ! -f /system/build.prop ] && mount -o rw /system 2>/dev/null
! is_mounted /system && mount -o rw /system
if [ ! -f /system/build.prop ]; then
SYSTEMBLOCK=$(find /dev/block -iname system${SLOT} | head -n 1)
mount -t ext4 -o rw $SYSTEMBLOCK /system
mount -t ext4 -o rw ${SYSTEMBLOCK} /system
fi
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
[ -f /system/build.prop ] || is_mounted /system || 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 (unsupported A/B device?)"
}
# check for configuration files