mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 22:04:06 +02:00
Update 00-smb_mounts.sh
This commit is contained in:
@@ -109,12 +109,12 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
|
|
||||||
# Are credentials correct
|
# Are credentials correct
|
||||||
echo "... testing credentials"
|
echo "... testing credentials"
|
||||||
OUTPUT="$(smbclient -t 2 -L "$disk" -U "$USERNAME"%"$PASSWORD" "$DOMAINCLIENT" -c "exit" 2>&1"
|
OUTPUT="$(smbclient -t 2 -L "$disk" -U "$USERNAME"%"$PASSWORD" "$DOMAINCLIENT" -c "exit" 2>&1)"
|
||||||
if echo "$OUTPUT" | grep -q "LOGON_FAILURE"; then
|
if echo "$OUTPUT" | grep -q "LOGON_FAILURE"; then
|
||||||
bashio::log.fatal "Incorrect Username, Password, or Domain! Script will stop."
|
bashio::log.fatal "Incorrect Username, Password, or Domain! Script will stop."
|
||||||
touch ERRORCODE
|
touch ERRORCODE
|
||||||
continue
|
continue
|
||||||
elif echo "$OUTPUT" | grep -q "tree connect failed"; then
|
elif echo "$OUTPUT" | grep -q "tree connect failed" || echo "$OUTPUT" | grep -q "NT_STATUS_CONNECTION_DISCONNECTED"; then
|
||||||
echo "... testing path"
|
echo "... testing path"
|
||||||
bashio::log.fatal "Invalid or inaccessible SMB path. Script will stop."
|
bashio::log.fatal "Invalid or inaccessible SMB path. Script will stop."
|
||||||
touch ERRORCODE
|
touch ERRORCODE
|
||||||
@@ -123,7 +123,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
|
|
||||||
# Should there be a workgroup
|
# Should there be a workgroup
|
||||||
echo "... testing workgroup"
|
echo "... testing workgroup"
|
||||||
if ! smbclient -t 2 -L $disk -N "$DOMAINCLIENT" &>/dev/null; then
|
if ! smbclient -t 2 -L $disk -N "$DOMAINCLIENT" -c "exit" &>/dev/null; then
|
||||||
bashio::log.fatal "A workgroup must perhaps be specified"
|
bashio::log.fatal "A workgroup must perhaps be specified"
|
||||||
touch ERRORCODE
|
touch ERRORCODE
|
||||||
continue
|
continue
|
||||||
@@ -184,7 +184,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
bashio::log.fatal "Here is some debugging info :"
|
bashio::log.fatal "Here is some debugging info :"
|
||||||
|
|
||||||
# Provide debugging info
|
# Provide debugging info
|
||||||
smbclient -t 2 -L $disk -U "$USERNAME%$PASSWORD"
|
smbclient -t 2 -L $disk -U "$USERNAME%$PASSWORD" -c "exit"
|
||||||
|
|
||||||
# Error code
|
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user