allowed multiple smb shares

This commit is contained in:
Alexandre
2021-02-18 15:37:30 +01:00
committed by GitHub
parent 01dd7922c1
commit db08e3ad59

View File

@@ -12,20 +12,22 @@ PGID=0
#################### ####################
# Mount CIFS Share if configured and if Protection Mode is active # Mount CIFS Share if configured and if Protection Mode is active
if bashio::config.has_value 'networkdisks'; then if bashio::config.has_value 'networkdisks'; then
bashio::log.info 'Mounting smb share...' # Define variables
MOREDISKS=$(bashio::config 'networkdisks') MOREDISKS=$(bashio::config 'networkdisks')
CIFS_USERNAME=$(bashio::config 'cifsusername') CIFS_USERNAME=$(bashio::config 'cifsusername')
CIFS_PASSWORD=$(bashio::config 'cifspassword') CIFS_PASSWORD=$(bashio::config 'cifspassword')
bashio::log.info "Network Disks mounting.. ${MOREDISKS}" && \
for disk in $MOREDISKS # Mounting disks
bashio::log.info 'Mounting smb share(s)...'
for disk in ${MOREDISKS//,/ } # Separate comma separated values
do do
bashio::log.info "Mount ${disk}" disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
echo "Creating /storage/storagecifs" diskname=${disk##*/} # Get only last part of the name
mkdir -p /storage/storagecifs mkdir -p /mnt/$diskname # Create dir
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /storage/storagecifs && \ chown -R root:root /mnt/$diskname # Permissions
bashio::log.info "Success!" mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /mnt/$diskname # Mount share
done || \ bashio::log.info "... $disk successfully mounted to /mnt/$diskname"
bashio::log.warning "Protection mode is ON. Unable to mount external drives!" done || bashio::log.error "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD"
fi fi
################ ################