From 7b536b92497835080eba163a5de325c31724b44d Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 24 Apr 2021 10:19:39 +0200 Subject: [PATCH] Correct smb debugging --- .../etc/cont-init.d/92-smb_mounts_v1.1.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/qbittorrent/rootfs/etc/cont-init.d/92-smb_mounts_v1.1.sh b/qbittorrent/rootfs/etc/cont-init.d/92-smb_mounts_v1.1.sh index 877457bd2..ab666c504 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/92-smb_mounts_v1.1.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/92-smb_mounts_v1.1.sh @@ -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