mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-13 19:31:01 +01:00
List drives
This commit is contained in:
@@ -5,19 +5,21 @@
|
||||
# LIST LOCAL DISKS #
|
||||
####################
|
||||
|
||||
bashio::log.info "List of available labels (@dianlight)
|
||||
bashio::log.blue "---------------------------------------------------"
|
||||
#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)
|
||||
if [ ${#autodisks[@]} -eq 0 ]; then
|
||||
bashio::log.info "No Disk with labels."
|
||||
else
|
||||
bashio::log.info "Available Disk Labels:"
|
||||
for disk in ${autodisks[@]}; do
|
||||
bashio::log.info "\t${disk}[$(lsblk $(blkid -L "$disk") -no fstype)]"
|
||||
done
|
||||
fi
|
||||
bashio::log.blue "---------------------------------------------------"
|
||||
function list_drives (
|
||||
bashio::log.info "List of available labels (@dianlight)"
|
||||
bashio::log.blue "---------------------------------------------------"
|
||||
#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)
|
||||
if [ ${#autodisks[@]} -eq 0 ]; then
|
||||
bashio::log.info "No Disk with labels."
|
||||
else
|
||||
bashio::log.info "Available Disk Labels:"
|
||||
for disk in ${autodisks[@]}; do
|
||||
bashio::log.info "\t${disk}[$(lsblk $(blkid -L "$disk") -no fstype)]"
|
||||
done
|
||||
fi
|
||||
bashio::log.blue "---------------------------------------------------"
|
||||
)
|
||||
|
||||
######################
|
||||
# MOUNT LOCAL SHARES #
|
||||
@@ -88,7 +90,10 @@ if bashio::config.has_value 'localdisks'; then
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
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." && rmdir /mnt/$disk && bashio::addon.stop)
|
||||
(bashio::log.fatal "Unable to mount local drives! Please check the name."
|
||||
rmdir /mnt/$disk
|
||||
list_drives
|
||||
bashio::addon.stop)
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user