From 3523344bedf169336074110a1c9ae38737bcb525 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:25:53 +0200 Subject: [PATCH] Update 00-local_mounts.sh --- .templates/00-local_mounts.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.templates/00-local_mounts.sh b/.templates/00-local_mounts.sh index bdd6de447..f3e7ffc75 100755 --- a/.templates/00-local_mounts.sh +++ b/.templates/00-local_mounts.sh @@ -33,20 +33,21 @@ if bashio::config.has_value 'localdisks'; then # shellcheck disable=SC2086 for disk in ${MOREDISKS//,/ }; do - # Mount as uuid if length of name is 36 characters - if [ -e /dev/"${disk}" ] ; then - echo "... mount as uuid" - devpath=/dev/disk/by-uuid - # Mount as label if not found in /dev - elif [ -n "$(lsblk -o LABEL | grep -w "NAS" | awk '{print $1}')" ]; then - echo "... mount as label" - devpath=/dev/disk/by-label - elif [ -e /dev/"${disk}" ]; then - echo "... mount as physical device" + # Remove text until last slash + disk="${disk##*/}" + + # Function to check what is the type of device + if lsblk | grep -q "^$1"; then + echo "... $disk is a physical device." devpath=/dev - else - bashio::log.fatal "... $disk was found neither in uuid, labels or physical drives, it will be skipped" - continue + elif lsblk -o UUID | grep -q "$1"; then + echo "... $disk is a device by UUID." + devpath=/dev/disk/by-uuid + elif lsblk -o LABEL | grep -q "$1"; then + echo "... $disk is a device by label." + devpath=/dev/disk/by-label + else + echo "$disk does not match any known physical device, UUID, or label." fi # Creates dir