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

make find_block() more robust

This commit is contained in:
Christopher Roy Bratusek 2020-10-21 20:15:03 +02:00
parent 5fc753702e
commit 185da1b493
4 changed files with 12 additions and 12 deletions

View File

@ -223,8 +223,8 @@ is_mounted () {
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
[ -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
@ -233,7 +233,7 @@ find_block () {
fi
done
fi
readlink -f ${tmp}
readlink -f "${tmp}"
}
mount_partitions () {

View File

@ -99,8 +99,8 @@ mount_apex () {
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
[ -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
@ -109,7 +109,7 @@ find_block () {
fi
done
fi
readlink -f ${tmp}
readlink -f "${tmp}"
}
mount_partitions () {

View File

@ -90,8 +90,8 @@ mount_apex () {
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
[ -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
@ -100,7 +100,7 @@ find_block () {
fi
done
fi
readlink -f ${tmp}
readlink -f "${tmp}"
}
mount_partitions () {

View File

@ -115,8 +115,8 @@ error () {
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
[ -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
@ -125,7 +125,7 @@ find_block () {
fi
done
fi
readlink -f ${tmp}
readlink -f "${tmp}"
}
mount_partitions () {