allow smbv1

This commit is contained in:
Alexandre
2021-02-19 20:02:45 +01:00
parent 1b1dd403f7
commit 947aef5294
4 changed files with 30 additions and 24 deletions

View File

@@ -1,4 +0,0 @@
#!/bin/sh
# Shutdown addon
s6-svscanctl -t /var/run/s6/services

View File

@@ -38,7 +38,11 @@
"options": { "options": {
"PUID": 0, "PUID": 0,
"PGID": 0, "PGID": 0,
"maxmem": 120 "maxmem": 120,
"networkdisks": "//IP/SHARE",
"cifsusername": "username",
"cifspassword": "folder",
"smbv1": "false"
}, },
"schema": { "schema": {
"PUID": "int", "PUID": "int",
@@ -47,6 +51,7 @@
"networkdisks": "str?", "networkdisks": "str?",
"cifsusername": "str?", "cifsusername": "str?",
"cifspassword": "str?", "cifspassword": "str?",
"smbv1": "bool",
"TZ": "str?" "TZ": "str?"
} }
} }

View File

@@ -1,23 +1,32 @@
#!/usr/bin/with-contenv bashio #!/usr/bin/with-contenv bashio
#################### #########################
# MOUNT SMB SHARES # # MOUNT SMB SHARES v1.0 #
#################### #########################
# 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...' # 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" || bashio::log.error "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD" # Mount share
done || \ done || true
bashio::log.warning "Protection mode is ON. Unable to mount external drives!"
fi fi

View File

@@ -1,4 +0,0 @@
#!/bin/sh
# Shutdown addon
s6-svscanctl -t /var/run/s6/services