make find_block() more robust

merge-requests/33/head
Christopher Roy Bratusek 4 years ago
parent 5fc753702e
commit 185da1b493

@ -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 () {

@ -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 () {

@ -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 () {

@ -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 () {

Loading…
Cancel
Save