mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-11-07 15:20:36 +00:00
force-debloat.sh: A/B partition scheme support
This commit is contained in:
parent
d8a7a397c0
commit
66149bc5b7
@ -79,12 +79,40 @@ is_mounted() {
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
debloat_system () {
|
# taken from Magisk, with minor modifications for NanoDroid
|
||||||
if (is_mounted /system); then
|
mount_partitions () {
|
||||||
mount -orw,remount /system || error "!! failed to remount system read-write"
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
||||||
else mount -orw /system || error "!! failed to mount system read-write"
|
if [ -z ${SLOT} ]; then
|
||||||
|
SLOT=_$(grep_cmdline androidboot.slot)
|
||||||
|
[ "${SLOT}" = "_" ] && SLOT=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
is_mounted /data || mount /data
|
||||||
|
|
||||||
|
${BOOTMODE} || mount -o bind /dev/urandom /dev/random
|
||||||
|
|
||||||
|
! 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
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -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?)"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
debloat_system () {
|
||||||
|
mount_partitions
|
||||||
|
|
||||||
for app in ${APPS}; do
|
for app in ${APPS}; do
|
||||||
if [[ -d /system/app/${app} ]]; then
|
if [[ -d /system/app/${app} ]]; then
|
||||||
rm -rf /system/app/${app}
|
rm -rf /system/app/${app}
|
||||||
|
Loading…
Reference in New Issue
Block a user