From db08e3ad594475d403c5bb64060bdb37198f207d Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 18 Feb 2021 15:37:30 +0100 Subject: [PATCH] allowed multiple smb shares --- filebrowser/run | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/filebrowser/run b/filebrowser/run index 897bd681a..38f283318 100644 --- a/filebrowser/run +++ b/filebrowser/run @@ -12,20 +12,22 @@ PGID=0 #################### # Mount CIFS Share if configured and if Protection Mode is active if bashio::config.has_value 'networkdisks'; then - bashio::log.info 'Mounting smb share...' +# Define variables 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 + +# Mounting disks + bashio::log.info 'Mounting smb share(s)...' + for disk in ${MOREDISKS//,/ } # Separate comma separated values do - bashio::log.info "Mount ${disk}" - echo "Creating /storage/storagecifs" - mkdir -p /storage/storagecifs - mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /storage/storagecifs && \ - bashio::log.info "Success!" - done || \ - bashio::log.warning "Protection mode is ON. Unable to mount external drives!" + disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name + diskname=${disk##*/} # Get only last part of the name + mkdir -p /mnt/$diskname # Create dir + chown -R root:root /mnt/$diskname # Permissions + mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /mnt/$diskname # Mount share + bashio::log.info "... $disk successfully mounted to /mnt/$diskname" + done || bashio::log.error "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD" fi ################