From cee63a19c44ad1c3dd868371b3aa49a77fb4cf74 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 17 Feb 2022 19:50:33 +0100 Subject: [PATCH] Update 92-local_mounts.sh --- .templates/92-local_mounts.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.templates/92-local_mounts.sh b/.templates/92-local_mounts.sh index e3f0182a0..b72eadb45 100644 --- a/.templates/92-local_mounts.sh +++ b/.templates/92-local_mounts.sh @@ -12,21 +12,22 @@ if bashio::config.has_value 'localdisks'; then echo "Local Disks mounting..." # Separate comma separated values + # shellcheck disable=SC2086 for disk in ${MOREDISKS//,/ }; do # Mount by device as default devpath=/dev # Mount as label - [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + [ "${disk:0:2}" != "sd" ] && devpath=/dev/disk/by-label # Creates dir - mkdir -p /mnt/$disk - chown -R $(id -u):$(id -g) /mnt/$disk + mkdir -p /mnt/"$disk" + chown -R "$(id -u)":"$(id -g)" /mnt/"$disk" # Legacy mounting : mount to share if still exists (avoid breaking changes) - [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + [ -d /share/"$disk" ] && mount "$devpath"/"$disk" /share/"$disk" || true # Mount - mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + mount "$devpath"/"$disk" /mnt/"$disk" && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) done