mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-01 10:50:32 +02:00
Update 00-smb_mounts.sh
This commit is contained in:
@@ -43,7 +43,7 @@ mount_drive () {
|
|||||||
|
|
||||||
# Define options
|
# Define options
|
||||||
MOUNTED=true
|
MOUNTED=true
|
||||||
MOUNTOPTIONS="$1"
|
MOUNTOPTIONS="rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$SMBVERS$SECVERS$PUID$PGID$CHARSET$DOMAIN"
|
||||||
|
|
||||||
# Try mounting
|
# Try mounting
|
||||||
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false
|
mount -t cifs -o "$MOUNTOPTIONS" "$disk" /mnt/"$diskname" 2>ERRORCODE || MOUNTED=false
|
||||||
@@ -136,7 +136,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
chown root:root /mnt/"$diskname"
|
chown root:root /mnt/"$diskname"
|
||||||
|
|
||||||
# Quickly try to mount with defaults
|
# Quickly try to mount with defaults
|
||||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$SMBVERS$SECVERS$PUID$PGID$CHARSET$DOMAIN"
|
mount_drive
|
||||||
|
|
||||||
# Deeper analysis if failed
|
# Deeper analysis if failed
|
||||||
if [ "$MOUNTED" = false ]; then
|
if [ "$MOUNTED" = false ]; then
|
||||||
@@ -217,7 +217,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
#######################################
|
#######################################
|
||||||
for SECVERS in "$SECVERS" ",sec=ntlmv2" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=krb5i" ",sec=krb5" ",sec=ntlm" ",sec=ntlmv2i"; do
|
for SECVERS in "$SECVERS" ",sec=ntlmv2" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=krb5i" ",sec=krb5" ",sec=ntlm" ",sec=ntlmv2i"; do
|
||||||
if [ "$MOUNTED" = false ]; then
|
if [ "$MOUNTED" = false ]; then
|
||||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$SMBVERS$SECVERS$PUID$PGID$CHARSET$DOMAIN"
|
mount_drive
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -226,8 +226,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
# Messages
|
# Messages
|
||||||
if [ "$MOUNTED" = true ]; then
|
if [ "$MOUNTED" = true ]; then
|
||||||
|
|
||||||
bashio::log.info "...... $disk successfully mounted to /mnt/$diskname with options $MOUNTOPTIONS"
|
bashio::log.info "...... $disk successfully mounted to /mnt/$diskname with options ${MOUNTOPTIONS/$PASSWORD/XXXXXXXXXX}"
|
||||||
|
|
||||||
# Remove errorcode
|
# Remove errorcode
|
||||||
if [ -f ERRORCODE ]; then
|
if [ -f ERRORCODE ]; then
|
||||||
rm ERRORCODE
|
rm ERRORCODE
|
||||||
@@ -249,7 +248,12 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
smbclient -t 2 -L $disk -U "$USERNAME%$PASSWORD" -c "exit"
|
smbclient -t 2 -L $disk -U "$USERNAME%$PASSWORD" -c "exit"
|
||||||
|
|
||||||
# Error code
|
# Error code
|
||||||
mount_drive "rw,file_mode=0775,dir_mode=0775,username=$USERNAME,password=${PASSWORD},nobrl$DOMAIN"
|
SMBVERS=""
|
||||||
|
SECVERS=""
|
||||||
|
PUID=""
|
||||||
|
PGID=""
|
||||||
|
CHARSET=""
|
||||||
|
mount_drive
|
||||||
bashio::log.fatal "Error read : $(<ERRORCODE), addon will stop in 1 min"
|
bashio::log.fatal "Error read : $(<ERRORCODE), addon will stop in 1 min"
|
||||||
|
|
||||||
# clean folder
|
# clean folder
|
||||||
|
|||||||
Reference in New Issue
Block a user