mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-09 17:15:57 +02:00
allow smbv1
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Shutdown addon
|
|
||||||
|
|
||||||
s6-svscanctl -t /var/run/s6/services
|
|
||||||
@@ -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?"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Shutdown addon
|
|
||||||
|
|
||||||
s6-svscanctl -t /var/run/s6/services
|
|
||||||
Reference in New Issue
Block a user