This commit is contained in:
Bruvv
2021-12-27 14:08:34 +01:00
parent 92305f7110
commit 92fabd1942
5 changed files with 18 additions and 31 deletions

View File

@@ -17,15 +17,15 @@ if bashio::config.has_value 'localdisks'; then
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