mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-01 05:14:04 +02:00
Update 92-smb_mounts_v1.4.sh
This commit is contained in:
@@ -48,25 +48,27 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test smbclient if not mounted yet
|
|
||||||
if [ $MOUNTED = false ]; then
|
|
||||||
bashio::log.fatal "Error, could not mount disk. Here is some debugging info :"
|
|
||||||
smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client
|
|
||||||
smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" || true
|
|
||||||
smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Messages
|
# Messages
|
||||||
if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; then
|
if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; then
|
||||||
#Test write permissions
|
#Test write permissions
|
||||||
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze \
|
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze \
|
||||||
&& bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" \
|
&& bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" \
|
||||||
|| bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
|| bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||||
|
|
||||||
else
|
else
|
||||||
# message if still fail
|
# Mounting failed messages
|
||||||
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
|
bashio::log.fatal "Error, unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID"
|
||||||
|
bashio::log.fatal "Here is some debugging info :"
|
||||||
|
|
||||||
|
# Provide debugging info
|
||||||
|
smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client
|
||||||
|
smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" || true
|
||||||
|
smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" || true
|
||||||
|
|
||||||
|
# Error code
|
||||||
bashio::log.fatal "Error read : $(<ERRORCODE)"
|
bashio::log.fatal "Error read : $(<ERRORCODE)"
|
||||||
rm ERRORCODE
|
rm ERRORCODE
|
||||||
|
|
||||||
# clean folder
|
# clean folder
|
||||||
umount /mnt/$diskname 2>/dev/null || true
|
umount /mnt/$diskname 2>/dev/null || true
|
||||||
rmdir /mnt/$diskname || true
|
rmdir /mnt/$diskname || true
|
||||||
|
|||||||
Reference in New Issue
Block a user