mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-12 10:31:26 +02:00
Update 00-local_mounts.sh
This commit is contained in:
@@ -5,23 +5,20 @@
|
|||||||
# LIST LOCAL DISKS #
|
# LIST LOCAL DISKS #
|
||||||
####################
|
####################
|
||||||
|
|
||||||
function list_drives () {
|
## List available Disk with Labels and Id
|
||||||
bashio::log.info "List of available labels (@dianlight)"
|
bashio::log.blue "---------------------------------------------------"
|
||||||
bashio::log.blue "---------------------------------------------------"
|
bashio::log.blue "By https://github.com/dianlight/hassio-addons "
|
||||||
#autodisks=($(lsblk -E label -n -o label | sed -r '/^\s*$/d' | grep -v hassos | grep pp))
|
#autodisks=($(lsblk -E label -n -o label | sed -r '/^\s*$/d' | grep -v hassos | grep pp))
|
||||||
readarray -t autodisks < <(lsblk -E label -n -o label -i | sed -r '/^\s*$/d' | grep -v hassos)
|
readarray -t autodisks < <(lsblk -E label -n -o label -i | sed -r '/^\s*$/d' | grep -v hassos)
|
||||||
if [ ${#autodisks[@]} -eq 0 ]; then
|
if [ ${#autodisks[@]} -eq 0 ]; then
|
||||||
bashio::log.info "No Disk with labels."
|
bashio::log.info "No Disk with labels."
|
||||||
else
|
else
|
||||||
bashio::log.info "Available Disk Labels:"
|
bashio::log.info "Available Disk Labels:"
|
||||||
# shellcheck disable=SC2068
|
for disk in "${autodisks[@]}"; do
|
||||||
for disk in ${autodisks[@]}; do
|
bashio::log.info "\t${disk}[$(lsblk $(blkid -L "$disk") -no fstype)]"
|
||||||
# shellcheck disable=SC2046
|
done
|
||||||
bashio::log.info "\t${disk}[$(lsblk $(blkid -L "$disk") -no fstype)]"
|
fi
|
||||||
done
|
bashio::log.blue "---------------------------------------------------"
|
||||||
fi
|
|
||||||
bashio::log.blue "---------------------------------------------------"
|
|
||||||
}
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# MOUNT LOCAL SHARES #
|
# MOUNT LOCAL SHARES #
|
||||||
@@ -87,8 +84,7 @@ if bashio::config.has_value 'localdisks'; then
|
|||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" || \
|
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" || \
|
||||||
(bashio::log.fatal "Unable to mount local drives! Please check the name."
|
(bashio::log.fatal "Unable to mount local drives! Please check the name."
|
||||||
rmdir /mnt/$disk
|
rmdir /mnt/"$disk"
|
||||||
list_drives
|
|
||||||
bashio::addon.stop)
|
bashio::addon.stop)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user