mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-22 08:41:50 +02:00
Update 92-smb_mounts.sh
This commit is contained in:
@@ -63,7 +63,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
|
|
||||||
# Tries to mount with default options
|
# Tries to mount with default options
|
||||||
# shellcheck disable=SC2140
|
# 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 Fail test different smb and sec versions
|
||||||
if [ "$MOUNTED" = false ]; then
|
if [ "$MOUNTED" = false ]; then
|
||||||
@@ -77,12 +77,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
|
|
||||||
# if Fail test without PUID and PGID
|
# if Fail test without PUID and PGID
|
||||||
if [ "$MOUNTED" = false ]; then
|
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,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}" "$disk" /mnt/"$diskname" && MOUNTED=true || MOUNTED=false
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Messages
|
# Messages
|
||||||
@@ -112,9 +107,8 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
smbclient -L $disk -U "$CIFS_USERNAME%$CIFS_PASSWORD" || true
|
smbclient -L $disk -U "$CIFS_USERNAME%$CIFS_PASSWORD" || true
|
||||||
|
|
||||||
# Error code
|
# Error code
|
||||||
bashio::log.fatal "Error read : $(<ERRORCODE1)"
|
bashio::log.fatal "Error read : $(<ERRORCODE)"
|
||||||
bashio::log.fatal "Additional read : $(<ERRORCODE)"
|
rm ERRORCODE*
|
||||||
rm ERRORCODE
|
|
||||||
|
|
||||||
# clean folder
|
# clean folder
|
||||||
umount "/mnt/$diskname" 2>/dev/null || true
|
umount "/mnt/$diskname" 2>/dev/null || true
|
||||||
@@ -123,6 +117,6 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f ERRORCODE ]; then rm ERRORCODE; fi
|
if [ -f ERRORCODE ]; then rm ERRORCODE*; fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user