mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
clean code
This commit is contained in:
@@ -3,24 +3,25 @@
|
||||
######################
|
||||
# MOUNT LOCAL SHARES #
|
||||
######################
|
||||
MOUNTPOINTS="share"
|
||||
|
||||
bashio::log.info 'Mounting external hdd...'
|
||||
|
||||
# Mount local Share if configured and if Protection Mode is active
|
||||
if bashio::config.has_value 'localdisks'; then
|
||||
|
||||
MOREDISKS=$(bashio::config 'localdisks')
|
||||
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" &&
|
||||
# Separate comma separated values
|
||||
for disk in ${MOREDISKS//,/ }; do
|
||||
bashio::log.info "Mount ${disk}"
|
||||
mkdir -p /share/$disk &&
|
||||
if [ ! -d /share/$disk ]; then
|
||||
echo "Creating /share/$disk"
|
||||
mkdir -p /share/$disk
|
||||
chown -R abc:abc /share/$disk
|
||||
fi
|
||||
mount /dev/$disk /share/$disk &&
|
||||
bashio::log.info "Success!"
|
||||
done ||
|
||||
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
||||
bashio::log.info "Local Disks mounting..."
|
||||
|
||||
# Separate comma separated values
|
||||
for disk in ${MOREDISKS//,/ }; do
|
||||
# Mount each disk
|
||||
mkdir -p /$MOUNTPOINTS/$disk
|
||||
chown -R $(id -u):$(id -g) /$MOUNTPOINTS/$disk
|
||||
mount /dev/$disk /$MOUNTPOINTS/$disk
|
||||
bashio::log.info "Success! $disk mounted to /$MOUNTPOINTS/$disk" ||
|
||||
# Error message and clean remaining folder
|
||||
(bashio::log.warning "Unable to mount local drives!" &&
|
||||
rmdir /$MOUNTPOINTS/$disk)
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user