Update 92-smb_mounts.sh

This commit is contained in:
Alexandre
2022-10-11 06:53:08 +02:00
committed by GitHub
parent 8d578a3040
commit 71e16950e4

View File

@@ -63,7 +63,7 @@ if bashio::config.has_value 'networkdisks'; then
# Tries to mount with default options
# shellcheck disable=SC2140
mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}$DOMAIN$PUID$PGID" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false
mount -t cifs -o rw,username="$CIFS_USERNAME",password="$CIFS_PASSWORD$DOMAIN$PUID$PGID" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false
# if Fail test different smb and sec versions
if [ "$MOUNTED" = false ]; then
@@ -77,12 +77,7 @@ if bashio::config.has_value 'networkdisks'; then
# if Fail test without PUID and PGID
if [ "$MOUNTED" = false ]; then
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN:-WORKGROUP}" ",noserverino"; do
mount -t cifs -o "rw,file_mode=0775,dir_mode=0775,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS" "$disk" /mnt/"$diskname" 2>/dev/null && MOUNTED=true && break || MOUNTED=false
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5" ",iocharset=utf8" ",noserverino"; do
mount -t cifs -o "rw,file_mode=0775,dir_mode=0775,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS" "$disk" /mnt/"$diskname" 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
done
done
mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}" "$disk" /mnt/"$diskname" && MOUNTED=true || MOUNTED=false
fi
# Messages
@@ -112,9 +107,8 @@ if bashio::config.has_value 'networkdisks'; then
smbclient -L $disk -U "$CIFS_USERNAME%$CIFS_PASSWORD" || true
# Error code
bashio::log.fatal "Error read : $(<ERRORCODE1)"
bashio::log.fatal "Additional read : $(<ERRORCODE)"
rm ERRORCODE
bashio::log.fatal "Error read : $(<ERRORCODE)"
rm ERRORCODE*
# clean folder
umount "/mnt/$diskname" 2>/dev/null || true
@@ -123,6 +117,6 @@ if bashio::config.has_value 'networkdisks'; then
done
if [ -f ERRORCODE ]; then rm ERRORCODE; fi
if [ -f ERRORCODE ]; then rm ERRORCODE*; fi
fi