2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-31 09:20:23 +00:00

when searching system/vendor partitions look for app/vnr aswell

This commit is contained in:
Christopher Roy Bratusek 2021-05-05 14:27:58 +02:00
parent 9dcde11d37
commit 082486d6fa
4 changed files with 110 additions and 82 deletions

View File

@ -236,31 +236,38 @@ toupper() {
find_block () {
local block partname devname device
block=${1}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
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}
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
for block in "${@}"; do
block=${block}${SLOT}
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
done
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
return 1
}
mount_partitions () {
@ -280,7 +287,7 @@ mount_partitions () {
mount -o bind /dev/urandom /dev/random
SYSTEM_BLOCK=$(find_block system)
SYSTEM_BLOCK=$(find_block system app)
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
[ -z "${SYSTEM_BLOCK}" ] && error "failed to detect block device for /system"
@ -306,7 +313,7 @@ mount_partitions () {
mount -o bind /system_root/system /system
fi
VENDOR_BLOCK=$(find_block vendor)
VENDOR_BLOCK=$(find_block vendor vnr)
decho " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
[ -z "${VENDOR_BLOCK}" ] && error "failed to detect block device for /vendor"

View File

@ -101,33 +101,40 @@ toupper() {
}
find_block () {
local block tmp partname devname device
local block partname devname device
block=${1}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
for block in "${@}"; do
block=${block}${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
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}
if [ -n "$device" ]; then
readlink -f "$device"
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
for block in "${@}"; do
block=${block}${SLOT}
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
done
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
return 1
}
mount_partitions () {
@ -147,7 +154,7 @@ mount_partitions () {
mount -o bind /dev/urandom /dev/random
SYSTEM_BLOCK=$(find_block system)
SYSTEM_BLOCK=$(find_block system app)
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
if is_mounted /system_root; then
@ -171,7 +178,7 @@ mount_partitions () {
mount -o bind /system_root/system /system
fi
VENDOR_BLOCK=$(find_block vendor)
VENDOR_BLOCK=$(find_block vendor vnr)
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
! is_mounted /vendor && mount -o ro /vendor

View File

@ -91,33 +91,40 @@ toupper() {
}
find_block () {
local block tmp partname devname device
local block partname devname device
block=${1}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
for block in "${@}"; do
block=${block}${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
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}
if [ -n "$device" ]; then
readlink -f "$device"
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
for block in "${@}"; do
block=${block}${SLOT}
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
done
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
return 1
}
mount_partitions () {
@ -132,8 +139,8 @@ mount_partitions () {
fi
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TR
SYSTEM_BLOCK=$(find_block system)
VENDOR_BLOCK=$(find_block vendor)
SYSTEM_BLOCK=$(find_block system app)
VENDOR_BLOCK=$(find_block vendor vnr)
if ${BOOTMODE}; then
build_props=$(find /system /system_root /vendor -type f -name build.prop)

View File

@ -104,31 +104,38 @@ toupper() {
find_block () {
local block partname devname device
block=${1}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
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}
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
for block in "${@}"; do
block=${block}${SLOT}
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
done
for block in "${@}"; do
block=${block}${SLOT}
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
if [ -n "$device" ]; then
readlink -f "$device"
return 0
fi
done
return 1
}
mount_partitions () {
@ -148,7 +155,7 @@ mount_partitions () {
mount -o bind /dev/urandom /dev/random
SYSTEM_BLOCK=$(find_block system)
SYSTEM_BLOCK=$(find_block system app)
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
if is_mounted /system_root; then
@ -172,7 +179,7 @@ mount_partitions () {
mount -o bind /system_root/system /system
fi
VENDOR_BLOCK=$(find_block vendor)
VENDOR_BLOCK=$(find_block vendor vnr)
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
! is_mounted /vendor && mount -o ro /vendor