mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
likewise for all other modules
This commit is contained in:
parent
ce58ced55f
commit
2503c2ff3a
@ -96,46 +96,64 @@ mount_apex () {
|
||||
}
|
||||
|
||||
# taken from Magisk, with minor modifications for NanoDroid
|
||||
toupper() {
|
||||
echo "$@" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
find_block () {
|
||||
unset tmp
|
||||
tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${1}${SLOT} | head -n 1)
|
||||
[ -z "${tmp}" ] && tmp=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${1}${SLOT} | head -n 1)
|
||||
if [ -z "${tmp}" ]; then
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
if [ "${1}${SLOT}" = "${partname}" ]; then
|
||||
tmp="/dev/block/$(awk -F= '/DEVNAME/{print $2}' ${uevent})"
|
||||
break
|
||||
fi
|
||||
done
|
||||
local block tmp partname devname device
|
||||
|
||||
block=${1}${SLOT}
|
||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
readlink -f "${tmp}"
|
||||
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
devname=$(awk -F= '/DEVNAME/{print $2}' ${uevent})
|
||||
if [ "$(toupper ${block})" = "$(toupper ${partname})" ]; then
|
||||
echo /dev/block/${devname}
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
mount_partitions () {
|
||||
if ! ${BOOTMODE}; then
|
||||
DEVICE_AB=FALSE
|
||||
VENDOR_COMPAT=FALSE
|
||||
SYSTEM_AS_ROOT=FALSE
|
||||
|
||||
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
||||
echo " INFO: #1 [SLOT] ${SLOT}"
|
||||
if [ -z ${SLOT} ]; then
|
||||
SLOT=$(grep_cmdline androidboot.slot)
|
||||
echo " INFO: #2 [SLOT] ${SLOT}"
|
||||
if [ ! -z ${SLOT} ]; then
|
||||
SLOT=_${SLOT}
|
||||
echo " INFO: #3 [SLOT] ${SLOT}"
|
||||
DEVICE_AB=TRUE
|
||||
fi
|
||||
[ -z ${SLOT} ] || SLOT=_${SLOT}
|
||||
fi
|
||||
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TRUE
|
||||
decho " INFO: #1 [SLOT] ${SLOT}"
|
||||
|
||||
is_mounted /data || mount /data || echo "failed to mount /data!"
|
||||
is_mounted /data || mount /data || decho "failed to mount /data!"
|
||||
|
||||
mount -o bind /dev/urandom /dev/random
|
||||
|
||||
SYSTEM_BLOCK=$(find_block system)
|
||||
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||
|
||||
if is_mounted /system_root; then
|
||||
umount /system 2&>/dev/null
|
||||
umount /system_root 2&>/dev/null
|
||||
fi
|
||||
|
||||
mkdir -p /system /system_root
|
||||
mount -o rw ${SYSTEM_BLOCK} /system
|
||||
@ -148,7 +166,7 @@ mount_partitions () {
|
||||
if ! mount --move /system /system_root; then
|
||||
umount /system
|
||||
umount -l /system
|
||||
moun -o rw ${SYSTEM_BLOCK} /system_root
|
||||
mount -o rw ${SYSTEM_BLOCK} /system_root
|
||||
fi
|
||||
mount -o bind /system_root/system /system
|
||||
fi
|
||||
|
@ -87,20 +87,38 @@ mount_apex () {
|
||||
|
||||
# taken from Magisk, with modifications for NanoDroid
|
||||
|
||||
toupper() {
|
||||
echo "$@" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
find_block () {
|
||||
unset tmp
|
||||
tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${1}${SLOT} | head -n 1)
|
||||
[ -z "${tmp}" ] && tmp=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${1}${SLOT} | head -n 1)
|
||||
if [ -z "${tmp}" ]; then
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
if [ "${1}${SLOT}" = "${partname}" ]; then
|
||||
tmp="/dev/block/$(awk -F= '/DEVNAME/{print $2}' ${uevent})"
|
||||
break
|
||||
fi
|
||||
done
|
||||
local block tmp partname devname device
|
||||
|
||||
block=${1}${SLOT}
|
||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
readlink -f "${tmp}"
|
||||
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
devname=$(awk -F= '/DEVNAME/{print $2}' ${uevent})
|
||||
if [ "$(toupper ${block})" = "$(toupper ${partname})" ]; then
|
||||
echo /dev/block/${devname}
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
mount_partitions () {
|
||||
@ -111,11 +129,9 @@ mount_partitions () {
|
||||
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
||||
if [ -z ${SLOT} ]; then
|
||||
SLOT=$(grep_cmdline androidboot.slot)
|
||||
if [ ! -z ${SLOT} ]; then
|
||||
SLOT=_${SLOT}
|
||||
DEVICE_AB=TRUE
|
||||
fi
|
||||
[ -z ${SLOT} ] || SLOT=_${SLOT}
|
||||
fi
|
||||
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TR
|
||||
|
||||
SYSTEM_BLOCK=$(find_block system)
|
||||
VENDOR_BLOCK=$(find_block vendor)
|
||||
@ -144,7 +160,7 @@ mount_partitions () {
|
||||
if ! mount --move /system /system_root; then
|
||||
umount /system
|
||||
umount -l /system
|
||||
moun -o rw ${SYSTEM_BLOCK} /system_root
|
||||
mount -o rw ${SYSTEM_BLOCK} /system_root
|
||||
fi
|
||||
mount -o bind /system_root/system /system
|
||||
fi
|
||||
|
@ -96,46 +96,64 @@ error () {
|
||||
# mount partitions
|
||||
##########################################################################################
|
||||
|
||||
toupper() {
|
||||
echo "$@" | tr '[:lower:]' '[:upper:]'
|
||||
}
|
||||
|
||||
find_block () {
|
||||
unset tmp
|
||||
tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${1}${SLOT} | head -n 1)
|
||||
[ -z "${tmp}" ] && tmp=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${1}${SLOT} | head -n 1)
|
||||
if [ -z "${tmp}" ]; then
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
if [ "${1}${SLOT}" = "${partname}" ]; then
|
||||
tmp="/dev/block/$(awk -F= '/DEVNAME/{print $2}' ${uevent})"
|
||||
break
|
||||
fi
|
||||
done
|
||||
local block tmp partname devname device
|
||||
|
||||
block=${1}${SLOT}
|
||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
readlink -f "${tmp}"
|
||||
|
||||
for uevent in /sys/dev/block/*/uevent; do
|
||||
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||
devname=$(awk -F= '/DEVNAME/{print $2}' ${uevent})
|
||||
if [ "$(toupper ${block})" = "$(toupper ${partname})" ]; then
|
||||
echo /dev/block/${devname}
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
||||
if [ ! -z ${device} ]; then
|
||||
readlink -f ${device}
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
mount_partitions () {
|
||||
if ! ${BOOTMODE}; then
|
||||
DEVICE_AB=FALSE
|
||||
VENDOR_COMPAT=FALSE
|
||||
SYSTEM_AS_ROOT=FALSE
|
||||
|
||||
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
||||
echo " INFO: #1 [SLOT] ${SLOT}"
|
||||
if [ -z ${SLOT} ]; then
|
||||
SLOT=$(grep_cmdline androidboot.slot)
|
||||
echo " INFO: #2 [SLOT] ${SLOT}"
|
||||
if [ ! -z ${SLOT} ]; then
|
||||
SLOT=_${SLOT}
|
||||
echo " INFO: #3 [SLOT] ${SLOT}"
|
||||
DEVICE_AB=TRUE
|
||||
fi
|
||||
[ -z ${SLOT} ] || SLOT=_${SLOT}
|
||||
fi
|
||||
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TRUE
|
||||
decho " INFO: #1 [SLOT] ${SLOT}"
|
||||
|
||||
is_mounted /data || mount /data || echo "failed to mount /data!"
|
||||
is_mounted /data || mount /data || decho "failed to mount /data!"
|
||||
|
||||
mount -o bind /dev/urandom /dev/random
|
||||
|
||||
SYSTEM_BLOCK=$(find_block system)
|
||||
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||
|
||||
if is_mounted /system_root; then
|
||||
umount /system 2&>/dev/null
|
||||
umount /system_root 2&>/dev/null
|
||||
fi
|
||||
|
||||
mkdir -p /system /system_root
|
||||
mount -o rw ${SYSTEM_BLOCK} /system
|
||||
@ -148,7 +166,7 @@ mount_partitions () {
|
||||
if ! mount --move /system /system_root; then
|
||||
umount /system
|
||||
umount -l /system
|
||||
moun -o rw ${SYSTEM_BLOCK} /system_root
|
||||
mount -o rw ${SYSTEM_BLOCK} /system_root
|
||||
fi
|
||||
mount -o bind /system_root/system /system
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user