mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-25 19:21:57 +02:00
check if install device is root
This commit is contained in:
@@ -501,12 +501,24 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount
|
|||||||
possibleInstallDevices=$(lsblk -o NAME,TRAN -d | grep -E 'mmc|usb|sr' | cut -d' ' -f1)
|
possibleInstallDevices=$(lsblk -o NAME,TRAN -d | grep -E 'mmc|usb|sr' | cut -d' ' -f1)
|
||||||
for device in ${possibleInstallDevices}; do
|
for device in ${possibleInstallDevices}; do
|
||||||
echo "# check device ${device}"
|
echo "# check device ${device}"
|
||||||
if parted "/dev/${device}" print 2>/dev/null | grep "^ *[0-9]" | grep -q "boot\|esp\|lba"; then
|
if parted --script "/dev/${device}" print 2>/dev/null | grep "^ *[0-9]" | grep -q "boot\|esp\|lba"; then
|
||||||
installDevice="${device}"
|
installDevice="${device}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# check if any partition of device is mounted as root
|
||||||
|
installDeviceActive=0
|
||||||
|
if [ ${#installDevice} -gt 0 ]; then
|
||||||
|
# get all partitions and check if mounted as root
|
||||||
|
for partition in $(lsblk -no NAME "/dev/${installDevice}" | grep "^${installDevice}"); do
|
||||||
|
if findmnt -n -o TARGET "/dev/${partition}" | grep -q "^/$"; then
|
||||||
|
installDeviceActive=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Define Scenario
|
# Define Scenario
|
||||||
|
|
||||||
@@ -579,6 +591,7 @@ if [ "$action" = "status" ] || [ "$action" = "mount" ] || [ "$action" = "unmount
|
|||||||
echo "dataConfigFound='${dataConfigFound}'"
|
echo "dataConfigFound='${dataConfigFound}'"
|
||||||
echo "dataInspectSuccess='${dataInspectSuccess}'"
|
echo "dataInspectSuccess='${dataInspectSuccess}'"
|
||||||
echo "installDevice='${installDevice}'"
|
echo "installDevice='${installDevice}'"
|
||||||
|
echo "installDeviceActive='${installDeviceActive}'"
|
||||||
echo "combinedDataStorage='${combinedDataStorage}'"
|
echo "combinedDataStorage='${combinedDataStorage}'"
|
||||||
echo "bootFromStorage='${bootFromStorage}'"
|
echo "bootFromStorage='${bootFromStorage}'"
|
||||||
echo "bootFromSD='${bootFromSD}'"
|
echo "bootFromSD='${bootFromSD}'"
|
||||||
|
Reference in New Issue
Block a user