Better test for mounts

This commit is contained in:
Alexandre
2023-10-04 15:50:08 +02:00
committed by GitHub
parent ec1bf08852
commit f5b35ac521

View File

@@ -28,15 +28,20 @@ if bashio::config.has_value 'localdisks'; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
for disk in ${MOREDISKS//,/ }; do for disk in ${MOREDISKS//,/ }; do
# Mount by device as default # Mount as uuid if length of name is 36 characters
devpath=/dev if [ -e /dev/"${disk}" ] ; then
echo "... mount as uuid"
# Mount as uuid
if [ ${#disk} == 36 ] ; then
devpath=/dev/disk/by-uuid devpath=/dev/disk/by-uuid
# Mount as label # Mount as label if not found in /dev
elif [ "${disk:0:2}" != "sd" ] && [ "${disk:0:4}" != "nvme" ] ; then elif [ -n "$(lsblk -o LABEL | grep -w "NAS" | awk '{print $1}')" ]; then
echo "... mount as label"
devpath=/dev/disk/by-label devpath=/dev/disk/by-label
elif [ -e /dev/"${disk}" ]
echo "... mount as physical device"
devpath=/dev
else
bashio::log.fatal "... $disk was found neither in uuid, labels or physical drives, it will be skipped"
continue
fi fi
# Creates dir # Creates dir