Correct smb debugging

This commit is contained in:
Alexandre
2021-04-24 10:19:39 +02:00
committed by GitHub
parent 83f6e607fc
commit 7b536b9249

View File

@@ -28,10 +28,10 @@ if bashio::config.has_value 'networkdisks'; then
mkdir -p /mnt/$diskname # Create dir
chown -R root:root /mnt/$diskname # Permissions
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD$SMBVERS $disk /mnt/$diskname && \
bashio::log.info "... $disk successfully mounted to /mnt/$diskname" || bashio::log.error "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD . Please check your remote share path, the username and password, and try to check the smbv1 box in option if your share is using smb v1" # Mount share
# Test smbv1
if [ $? == 0 ]; then
bashio::log.info "... $disk successfully mounted to /mnt/$diskname"
# if Fail test smbv1
if [ $? != 0 ]; then
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD,vers=1.0 $disk /mnt/$diskname && \
bashio::log.info "... $disk successfully mounted to /mnt/$diskname" && \
bashio::log.error "Your smb share uses smbv1. Please check the relevant option in the addons options." # Mount share
@@ -39,7 +39,7 @@ if bashio::config.has_value 'networkdisks'; then
fi
# Test smbv2.1
if [ $? == 0 ]; then
if [ $? != 0 ]; then
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD,vers=2.1 $disk /mnt/$diskname && \
bashio::log.info "... $disk successfully mounted to /mnt/$diskname" && \
bashio::log.error "Your smb share uses smbv2.1, please remove smbv1 option."
@@ -47,7 +47,7 @@ if bashio::config.has_value 'networkdisks'; then
fi
# Test smbv3
if [ $? == 0 ]; then
if [ $? != 0 ]; then
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD,vers=3.0 $disk /mnt/$diskname && \
bashio::log.info "... $disk successfully mounted to /mnt/$diskname" && \
bashio::log.error "Your smb share uses smbv3."
@@ -55,12 +55,17 @@ if bashio::config.has_value 'networkdisks'; then
fi
# Test ntlmv2
if [ $? == 0 ]; then
if [ $? != 0 ]; then
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD,sec=ntlmv2 $disk /mnt/$diskname && \
bashio::log.info "... $disk successfully mounted to /mnt/$diskname" && \
bashio::log.error "Your smb share requires ntlmv2."
true
fi
# if still fail
if [ $? != 0 ]; then
bashio::log.error "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD . Please check your remote share path, the username and password, and try to check the smbv1 box in option if your share is using smb v1" # Mount share
fi
done
fi