Files
hassio-addons/emby/root/etc/cont-init.d/50-mounts
2020-12-01 12:31:58 +01:00

46 lines
1.7 KiB
Plaintext

#!/usr/bin/with-contenv bashio
#!/usr/bin/with-contenv bashio
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}" && \
for disk in $MOREDISKS
do
bashio::log.info "Mount ${disk}"
mkdir -p /mnt/$disk && \
if [ ! -d /mnt/$disk ]; then
echo "Creating /mnt/$disk"
mkdir -p /mnt/$disk
chown -R abc:abc /mnt/$disk
fi
mount -t auto /dev_/disk/by-label/$disk /mnt/$disk -o nosuid,relatime,noexec && \
bashio::log.info "Success!"
done || \
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
fi
# Mount CIFS Share if configured and if Protection Mode is active
if bashio::config.has_value 'networkdisks'; then
MOREDISKS=$(bashio::config 'networkdisks')
CIFS_USERNAME=$(bashio::config 'cifsusername')
CIFS_PASSWORD=$(bashio::config 'cifspassword')
bashio::log.info "Network Disks mounting.. ${MOREDISKS}" && \
for disk in $MOREDISKS
do
bashio::log.info "Mount ${disk}"
mkdir -p /share/storagecifs && \
if [ ! -d /mnt/storagecifs ]; then
echo "Creating /mnt/storagecifs"
mkdir -p /mnt/storagecifs
chown -R abc:abc /mnt/storagecifs
fi
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /mnt/storagecifs && \
bashio::log.info "Success!"
done || \
bashio::log.warning "Protection mode is ON. Unable to mount external drives!"
fi