mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-15 20:09:13 +02:00
Update 92-smb_mounts.sh
This commit is contained in:
@@ -29,7 +29,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
for disk in ${MOREDISKS//,/ }; do # Separate comma separated values
|
for disk in ${MOREDISKS//,/ }; do # Separate comma separated values
|
||||||
|
|
||||||
# Clean name of network share
|
# Clean name of network share
|
||||||
# shellcheck disable=SC2116
|
# shellcheck disable=SC2116,SC2001
|
||||||
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
||||||
diskname="${disk//\\//}" #replace \ with /
|
diskname="${disk//\\//}" #replace \ with /
|
||||||
diskname="${diskname##*/}" # Get only last part of the name
|
diskname="${diskname##*/}" # Get only last part of the name
|
||||||
@@ -44,7 +44,8 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
mkdir -p /mnt/"$diskname"
|
mkdir -p /mnt/"$diskname"
|
||||||
chown -R root:root /mnt/"$diskname"
|
chown -R root:root /mnt/"$diskname"
|
||||||
|
|
||||||
#Tries to mount with default options
|
# Tries to mount with default options
|
||||||
|
# shellcheck disable=SC2140
|
||||||
mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}$DOMAIN" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}$DOMAIN" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
||||||
|
|
||||||
# if Fail test different smb and sec versions
|
# if Fail test different smb and sec versions
|
||||||
@@ -58,8 +59,9 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Messages
|
# Messages
|
||||||
if [ "$MOUNTED" = true ] && [ "mountpoint -q /mnt/$diskname" ]; then
|
if [ "$MOUNTED" = true ] && [ mountpoint -q /mnt/"$diskname" ]; then
|
||||||
#Test write permissions
|
#Test write permissions
|
||||||
|
# shellcheck disable=SC2015
|
||||||
touch "/mnt/$diskname/testaze" && rm "/mnt/$diskname/testaze" &&
|
touch "/mnt/$diskname/testaze" && rm "/mnt/$diskname/testaze" &&
|
||||||
bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" ||
|
bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" ||
|
||||||
bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||||
|
|||||||
Reference in New Issue
Block a user