mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
improved A/B device support code taken from Magisk 16.6
This commit is contained in:
parent
6071eac6bf
commit
f69f933093
@ -16,6 +16,8 @@
|
||||
* more information below
|
||||
* by default install Déjà Vu and Mozilla nlp Backends
|
||||
* improve GApps uninstallation routine
|
||||
* CommonInstaller
|
||||
* improved A/B device support code taken from Magisk 16.6
|
||||
|
||||
### Updates
|
||||
|
||||
|
@ -81,6 +81,12 @@ grep_prop() {
|
||||
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() {
|
||||
if [ ! -z "${2}" ]; then
|
||||
cat /proc/mounts | grep ${1} | grep ${2}, >/dev/null
|
||||
@ -180,9 +186,9 @@ error () {
|
||||
|
||||
# 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
|
||||
|
||||
@ -197,13 +203,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"
|
||||
}
|
||||
|
||||
detect_mode () {
|
||||
|
Loading…
Reference in New Issue
Block a user