From d1d21987346533307c495ece389deb22a2dd3be6 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:28:49 +0200 Subject: [PATCH] Update 00-smb_mounts.sh --- .templates/00-smb_mounts.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.templates/00-smb_mounts.sh b/.templates/00-smb_mounts.sh index 97a311524..747ea0371 100755 --- a/.templates/00-smb_mounts.sh +++ b/.templates/00-smb_mounts.sh @@ -109,13 +109,14 @@ if bashio::config.has_value 'networkdisks'; then # Are credentials correct echo "... testing credentials" - if ! smbclient -t 2 -L "$disk" -U "$USERNAME"%"$PASSWORD" "$DOMAINCLIENT" 2>/output >/dev/null; then - if [[ "$(cat /output)" == *"LOGON_FAILURE"* ]]; then - bashio::log.fatal "Incorrect Username, Password, or Domain! Script will stop." - else - bashio::log.fatal "Incorrect path? Error : $(cat /output). Script will stop." - fi - rm /output + OUTPUT="$(smbclient -t 2 -L "$disk" -U "$USERNAME"%"$PASSWORD" "$DOMAINCLIENT" -c "exit" 2>&1" + if echo "$OUTPUT" | grep -q "LOGON_FAILURE"; then + bashio::log.fatal "Incorrect Username, Password, or Domain! Script will stop." + touch ERRORCODE + continue + elif echo "$OUTPUT" | grep -q "tree connect failed"; then + echo "... testing path" + bashio::log.fatal "Invalid or inaccessible SMB path. Script will stop." touch ERRORCODE continue fi @@ -186,7 +187,7 @@ if bashio::config.has_value 'networkdisks'; then smbclient -t 2 -L $disk -U "$USERNAME%$PASSWORD" # Error code - mount -t cifs -o "rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$DOMAIN" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false + mount -t cifs -o "rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$DOMAIN" "$disk" /mnt/"$diskname" 2> ERRORCODE || MOUNTED=false bashio::log.fatal "Error read : $(