clean code

This commit is contained in:
Alexandre
2021-10-23 20:21:21 +02:00
parent 7b8c693dee
commit 98faea5ed0
25 changed files with 498 additions and 288 deletions

View File

@@ -9,19 +9,19 @@ 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 /$MOUNTPOINTS/$disk &&
if [ ! -d /$MOUNTPOINTS/$disk ]; then
echo "Creating /$MOUNTPOINTS/$disk"
mkdir -p /$MOUNTPOINTS/$disk
chown -R abc:abc /$MOUNTPOINTS/$disk
fi
mount /dev/$disk /$MOUNTPOINTS/$disk &&
bashio::log.info "Success! Mounted to /$MOUNTPOINTS/$disk"
done ||
bashio::log.warning "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