mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
Update 50-mounts
This commit is contained in:
@@ -20,20 +20,34 @@ if bashio::config.has_value 'localdisks'; then
|
|||||||
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount CIFS Share if configured and if Protection Mode is active
|
#########################
|
||||||
|
# MOUNT SMB SHARES v1.0 #
|
||||||
|
#########################
|
||||||
if bashio::config.has_value 'networkdisks'; then
|
if bashio::config.has_value 'networkdisks'; then
|
||||||
|
# Mount CIFS Share if configured and if Protection Mode is active
|
||||||
|
bashio::log.info 'Mounting smb share(s)...'
|
||||||
|
|
||||||
|
# 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
|
# Allow SMB1
|
||||||
|
if bashio::config.true 'smbv1'; then
|
||||||
|
SMBVERS=",vers=1.0"
|
||||||
|
else
|
||||||
|
SMBVERS=",vers=2.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mounting disks
|
||||||
|
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
|
||||||
chown -R abc:abc /storage/storagecifs
|
chown -R root:root /mnt/$diskname # Permissions
|
||||||
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /storage/storagecifs && \
|
mount -t cifs -o username=$CIFS_USERNAME,password=${CIFS_PASSWORD}${SMBVERS} $disk /mnt/$diskname \
|
||||||
bashio::log.info "Success!"
|
&& 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"
|
||||||
bashio::log.warning "Protection mode is ON. Unable to mount external drives!"
|
done || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user