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:
parent
9dcde11d37
commit
082486d6fa
@ -236,31 +236,38 @@ toupper() {
|
|||||||
find_block () {
|
find_block () {
|
||||||
local block partname devname device
|
local block partname devname device
|
||||||
|
|
||||||
block=${1}${SLOT}
|
for block in "${@}"; do
|
||||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
block=${block}${SLOT}
|
||||||
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||||
|
|
||||||
if [ -n "$device" ]; then
|
if [ -n "$device" ]; then
|
||||||
readlink -f "$device"
|
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}
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
for block in "${@}"; do
|
||||||
if [ -n "$device" ]; then
|
block=${block}${SLOT}
|
||||||
readlink -f "$device"
|
for uevent in /sys/dev/block/*/uevent; do
|
||||||
return 0
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||||
fi
|
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
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partitions () {
|
mount_partitions () {
|
||||||
@ -280,7 +287,7 @@ mount_partitions () {
|
|||||||
|
|
||||||
mount -o bind /dev/urandom /dev/random
|
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}"
|
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||||
|
|
||||||
[ -z "${SYSTEM_BLOCK}" ] && error "failed to detect block device for /system"
|
[ -z "${SYSTEM_BLOCK}" ] && error "failed to detect block device for /system"
|
||||||
@ -306,7 +313,7 @@ mount_partitions () {
|
|||||||
mount -o bind /system_root/system /system
|
mount -o bind /system_root/system /system
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VENDOR_BLOCK=$(find_block vendor)
|
VENDOR_BLOCK=$(find_block vendor vnr)
|
||||||
decho " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
decho " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
||||||
|
|
||||||
[ -z "${VENDOR_BLOCK}" ] && error "failed to detect block device for /vendor"
|
[ -z "${VENDOR_BLOCK}" ] && error "failed to detect block device for /vendor"
|
||||||
|
@ -101,33 +101,40 @@ toupper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
find_block () {
|
find_block () {
|
||||||
local block tmp partname devname device
|
local block partname devname device
|
||||||
|
|
||||||
block=${1}${SLOT}
|
for block in "${@}"; do
|
||||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
block=${block}${SLOT}
|
||||||
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||||
|
|
||||||
if [ ! -z ${device} ]; then
|
if [ -n "$device" ]; then
|
||||||
readlink -f ${device}
|
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}
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
for block in "${@}"; do
|
||||||
if [ ! -z ${device} ]; then
|
block=${block}${SLOT}
|
||||||
readlink -f ${device}
|
for uevent in /sys/dev/block/*/uevent; do
|
||||||
return 0
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||||
fi
|
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
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partitions () {
|
mount_partitions () {
|
||||||
@ -147,7 +154,7 @@ mount_partitions () {
|
|||||||
|
|
||||||
mount -o bind /dev/urandom /dev/random
|
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}"
|
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||||
|
|
||||||
if is_mounted /system_root; then
|
if is_mounted /system_root; then
|
||||||
@ -171,7 +178,7 @@ mount_partitions () {
|
|||||||
mount -o bind /system_root/system /system
|
mount -o bind /system_root/system /system
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VENDOR_BLOCK=$(find_block vendor)
|
VENDOR_BLOCK=$(find_block vendor vnr)
|
||||||
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
||||||
|
|
||||||
! is_mounted /vendor && mount -o ro /vendor
|
! is_mounted /vendor && mount -o ro /vendor
|
||||||
|
@ -91,33 +91,40 @@ toupper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
find_block () {
|
find_block () {
|
||||||
local block tmp partname devname device
|
local block partname devname device
|
||||||
|
|
||||||
block=${1}${SLOT}
|
for block in "${@}"; do
|
||||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
block=${block}${SLOT}
|
||||||
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||||
|
|
||||||
if [ ! -z ${device} ]; then
|
if [ -n "$device" ]; then
|
||||||
readlink -f ${device}
|
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}
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
for block in "${@}"; do
|
||||||
if [ ! -z ${device} ]; then
|
block=${block}${SLOT}
|
||||||
readlink -f ${device}
|
for uevent in /sys/dev/block/*/uevent; do
|
||||||
return 0
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||||
fi
|
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
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partitions () {
|
mount_partitions () {
|
||||||
@ -132,8 +139,8 @@ mount_partitions () {
|
|||||||
fi
|
fi
|
||||||
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TR
|
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TR
|
||||||
|
|
||||||
SYSTEM_BLOCK=$(find_block system)
|
SYSTEM_BLOCK=$(find_block system app)
|
||||||
VENDOR_BLOCK=$(find_block vendor)
|
VENDOR_BLOCK=$(find_block vendor vnr)
|
||||||
|
|
||||||
if ${BOOTMODE}; then
|
if ${BOOTMODE}; then
|
||||||
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
||||||
|
@ -104,31 +104,38 @@ toupper() {
|
|||||||
find_block () {
|
find_block () {
|
||||||
local block partname devname device
|
local block partname devname device
|
||||||
|
|
||||||
block=${1}${SLOT}
|
for block in "${@}"; do
|
||||||
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
block=${block}${SLOT}
|
||||||
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
||||||
|
|
||||||
if [ -n "$device" ]; then
|
if [ -n "$device" ]; then
|
||||||
readlink -f "$device"
|
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}
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
for block in "${@}"; do
|
||||||
if [ -n "$device" ]; then
|
block=${block}${SLOT}
|
||||||
readlink -f "$device"
|
for uevent in /sys/dev/block/*/uevent; do
|
||||||
return 0
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
||||||
fi
|
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
|
return 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_partitions () {
|
mount_partitions () {
|
||||||
@ -148,7 +155,7 @@ mount_partitions () {
|
|||||||
|
|
||||||
mount -o bind /dev/urandom /dev/random
|
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}"
|
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
||||||
|
|
||||||
if is_mounted /system_root; then
|
if is_mounted /system_root; then
|
||||||
@ -172,7 +179,7 @@ mount_partitions () {
|
|||||||
mount -o bind /system_root/system /system
|
mount -o bind /system_root/system /system
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VENDOR_BLOCK=$(find_block vendor)
|
VENDOR_BLOCK=$(find_block vendor vnr)
|
||||||
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
||||||
|
|
||||||
! is_mounted /vendor && mount -o ro /vendor
|
! is_mounted /vendor && mount -o ro /vendor
|
||||||
|
Loading…
Reference in New Issue
Block a user