mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-11-17 21:26:22 +00:00
Patcher: update mount code
This commit is contained in:
parent
cfaaa2b630
commit
4f250df8f9
@ -53,23 +53,30 @@ is_mounted () {
|
|||||||
|
|
||||||
# taken from Magisk, with minor modifications for NanoDroid
|
# taken from Magisk, with minor modifications for NanoDroid
|
||||||
mount_partitions () {
|
mount_partitions () {
|
||||||
|
DEVICE_AB=FALSE
|
||||||
|
VENDOR_COMPAT=FALSE
|
||||||
|
|
||||||
|
SYSTEM_AS_ROOT=$(getprop ro.build.system_root_image)
|
||||||
|
SYSTEM_BLOCK=/dev/block/bootdevice/by-name/system
|
||||||
|
|
||||||
|
RUNTIME_APEX=""
|
||||||
|
APEX_LOOP=""
|
||||||
|
|
||||||
|
if [ "${SYSTEM_AS_ROOT}" == "true" ]; then
|
||||||
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
||||||
if [ -z ${SLOT} ]; then
|
if [ -n "${SLOT}" ]; then
|
||||||
SLOT=_$(grep_cmdline androidboot.slot)
|
DEVICE_AB=TRUE
|
||||||
[ "${SLOT}" = "_" ] && SLOT=
|
SYSTEM_BLOCK=/dev/block/bootdevice/by-name/system${SLOT}
|
||||||
|
fi
|
||||||
|
SYSTEM_MOUNT=/system_root
|
||||||
|
else
|
||||||
|
SYSTEM_MOUNT=/system
|
||||||
fi
|
fi
|
||||||
|
|
||||||
is_mounted /data || mount /data || error "failed to mount /data!"
|
is_mounted /data || mount /data || error "failed to mount /data!"
|
||||||
|
|
||||||
${BOOTMODE} || mount -o bind /dev/urandom /dev/random
|
mount -o bind /dev/urandom /dev/random
|
||||||
|
! is_mounted ${SYSTEM_MOUNT} && mount -o rw ${SYSTEM_BLOCK} ${SYSTEM_MOUNT} || mount -o rw,remount ${SYSTEM_MOUNT}
|
||||||
! is_mounted /system && mount -o rw /system || mount -o rw,remount /system
|
|
||||||
|
|
||||||
if ! is_mounted /system; then
|
|
||||||
sys_tmp=$(find /dev/block -type l -iname system${SLOT} | head -n 1)
|
|
||||||
SYSTEMBLOCK=$(readlink -f ${sys_tmp})
|
|
||||||
mount -o rw ${SYSTEMBLOCK} /system
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /system/init.rc ]; then
|
if [ -f /system/init.rc ]; then
|
||||||
[ -L /system_root ] && rm -f /system_root
|
[ -L /system_root ] && rm -f /system_root
|
||||||
@ -80,8 +87,26 @@ mount_partitions () {
|
|||||||
|
|
||||||
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
|
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
|
||||||
|
|
||||||
if [ -L /system/vendor ]; then
|
if [ -f /system/apex/com.android.runtime.apex ]; then
|
||||||
|
RUNTIME_APEX="/system/apex/com.android.runtime.apex"
|
||||||
|
elif [ -f /system/apex/com.android.runtime.release.apex ]; then
|
||||||
|
RUNTIME_APEX="/system/apex/com.android.runtime.release.apex"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${RUNTIME_APEX}" ]; then
|
||||||
|
mkdir -p /dev/tmp/apex
|
||||||
|
unzip "${RUNTIME_APEX}" -d /dev/tmp/apex
|
||||||
|
|
||||||
|
mkdir -p /apex/com.android.runtime
|
||||||
|
|
||||||
|
mount -oloop,ro /dev/tmp/apex/apex_payload.img /apex/com.android.runtime
|
||||||
|
|
||||||
|
APEX_LOOP=$(mount | awk '/com.android.runtime/{print $1}')
|
||||||
|
fi
|
||||||
|
|
||||||
! is_mounted /vendor && mount /vendor
|
! is_mounted /vendor && mount /vendor
|
||||||
|
|
||||||
|
if [ -L /system/vendor ]; then
|
||||||
if ! is_mounted /vendor; then
|
if ! is_mounted /vendor; then
|
||||||
vendor_tmp=$(find /dev/block -type l -iname vendor${SLOT} | head -n 1)
|
vendor_tmp=$(find /dev/block -type l -iname vendor${SLOT} | head -n 1)
|
||||||
VENDORBLOCK=$(readlink -f ${vendor_tmp})
|
VENDORBLOCK=$(readlink -f ${vendor_tmp})
|
||||||
@ -89,11 +114,12 @@ mount_partitions () {
|
|||||||
fi
|
fi
|
||||||
elif [ -d /system/vendor ]; then
|
elif [ -d /system/vendor ]; then
|
||||||
### XXX work-around required for some ROMs
|
### XXX work-around required for some ROMs
|
||||||
|
VENDOR_COMPAT=TRUE
|
||||||
echo " xxx compat /vendor link created!"
|
echo " xxx compat /vendor link created!"
|
||||||
ln -sf /system/vendor /vendor >/dev/null
|
ln -sf /system/vendor /vendor >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mount | awk '{print $1 " on " $3}'
|
mount | awk '{print $1 " on " $3 " params: " $6}'
|
||||||
}
|
}
|
||||||
|
|
||||||
error () {
|
error () {
|
||||||
|
Loading…
Reference in New Issue
Block a user