mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-18 20:10:31 +02:00
Better test for mounts
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user