Files
hassio-addons/code-server/root/etc/cont-init.d/92-local_mounts.sh
2021-10-23 21:46:11 +02:00

25 lines
722 B
Bash

#!/usr/bin/with-contenv bashio
######################
# MOUNT LOCAL SHARES #
######################
bashio::log.info 'Mounting external hdd...'
# Mount local Share if configured
if bashio::config.has_value 'localdisks'; then
MOREDISKS=$(bashio::config 'localdisks')
bashio::log.info "Local Disks mounting..."
# Separate comma separated values
for disk in ${MOREDISKS//,/ }; do
# Mount each disk
mkdir -p /mnt/$disk
chown -R $(id -u):$(id -g) /mnt/$disk
[ -d /share/$disk ] && mount /dev/$disk /share/$disk || true
mount /dev/$disk /mnt/$disk || (bashio::log.warning "Unable to mount local drives!" && rmdir /mnt/$disk)
bashio::log.info "Success! $disk mounted to /mnt/$disk"
done
fi