From e2a7847cd88baba85603f131b6df11ed9bba876e Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Fri, 6 Oct 2023 23:10:40 +0200 Subject: [PATCH] Update 00-smb_mounts.sh --- .templates/00-smb_mounts.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.templates/00-smb_mounts.sh b/.templates/00-smb_mounts.sh index ec321b05f..a7de8120c 100755 --- a/.templates/00-smb_mounts.sh +++ b/.templates/00-smb_mounts.sh @@ -107,6 +107,13 @@ if bashio::config.has_value 'networkdisks'; then fi fi + # Should there be a workgroup + echo "... testing workgroup" + if ! smbclient -t 2 -L $disk -N $DOMAINCLIENT -c "exit" &>/dev/null; then + bashio::log.fatal "A workgroup must perhaps be specified" + touch ERRORCODE + fi + # Are credentials correct echo "... testing credentials" OUTPUT="$(smbclient -t 2 -L "$disk" -U "$USERNAME"%"$PASSWORD" -c "exit" $DOMAINCLIENT 2>&1)" @@ -119,14 +126,9 @@ if bashio::config.has_value 'networkdisks'; then bashio::log.fatal "Invalid or inaccessible SMB path. Script will stop." touch ERRORCODE continue - fi - - # Should there be a workgroup - echo "... testing workgroup" - if ! smbclient -t 2 -L $disk -N $DOMAINCLIENT -c "exit" &>/dev/null; then - bashio::log.fatal "A workgroup must perhaps be specified" - touch ERRORCODE - continue + elif echo "$OUTPUT" | ! grep -q "Disk"; then + echo "... testing path" + bashio::log.fatal "No shares found. Invalid or inaccessible SMB path? Script will stop." fi # What is the SMB version