update...
This commit is contained in:
@ -35,33 +35,18 @@ fi
|
||||
|
||||
export LANG="de_DE.utf8"
|
||||
|
||||
{% if item.item.is_samba_user is defined and item.item.is_samba_user|bool %}
|
||||
|
||||
# ---
|
||||
# Mmount samba shares
|
||||
# ---
|
||||
|
||||
# Don't try to mount samba shares if login at samba server
|
||||
#
|
||||
#
|
||||
[[ "$(hostname --long)" = "{{ samba_server }}" ]] && return
|
||||
|
||||
SERVER="{{ samba_server }}"
|
||||
USER="{{ item.item.name }}"
|
||||
PASSWORD='{{ item.item.password }}'
|
||||
|
||||
declare -i _ubuntu_major_version_number="$(lsb_release -r | awk '{print$2}' | cut -d'.' -f1)"
|
||||
[[ -z "$_ubuntu_major_version_number" ]] && _ubuntu_major_version_number=16
|
||||
if [[ $_ubuntu_major_version_number -eq 16 ]] ; then
|
||||
VERSION="3.0"
|
||||
fi
|
||||
|
||||
#if [[ $_ubuntu_major_version_number -gt 19 ]] ; then
|
||||
# VERSION="3.11"
|
||||
#elif [[ $_ubuntu_major_version_number -gt 17 ]] ; then
|
||||
# VERSION="3.02"
|
||||
#else
|
||||
# VERSION="3.0"
|
||||
#fi
|
||||
#VERSION="1.0"
|
||||
|
||||
# Use NTLMv2 password hashing and force packet signing
|
||||
#
|
||||
@ -112,19 +97,28 @@ for dir in $(ls /mnt/$USER) ; do
|
||||
|
||||
[ ! -d $MOUNT_POINT ] && continue
|
||||
|
||||
|
||||
if ! mount | grep $MOUNT_POINT > /dev/null ; then
|
||||
|
||||
echo "Going to mount share '${SHARE}' .." >> $_logfile
|
||||
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
|
||||
sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,cifsacl,uid=$_UID,gid=$_GID \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
if [ -x /usr/bin/smb4k_mount ]; then
|
||||
## - Ubuntu <= 12.04
|
||||
if [[ "$VERSION" = "1.0" ]]; then
|
||||
sudo /usr/bin/smb4k_mount -o user=$USER,password=$PASSWORD,iocharset=utf8,vers=1.0 \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
else
|
||||
#sudo /usr/bin/smb4k_mount -o user=$USER,password=$PASSWORD,iocharset=utf8,uid=$_UID,gid=$_GID,vers=$VERSION \
|
||||
sudo /usr/bin/smb4k_mount -o user=$USER,password=$PASSWORD,iocharset=utf8,uid=$_UID,gid=$_GID \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
fi
|
||||
else
|
||||
|
||||
sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,uid=$USER,sec=${SEC},vers=$VERSION \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
## - Ubuntu Version >= 14.04
|
||||
if [[ "$VERSION" = "1.0" ]]; then
|
||||
sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,cifsacl,vers=1.0 \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
else
|
||||
#sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,cifsacl,uid=$USER,sec=${SEC},vers=$VERSION \
|
||||
sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,uid=$USER,gid=$_GID \
|
||||
-n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "mount point $MOUNT_POINT already exists. nothing left to do.." >> $_logfile
|
||||
@ -132,4 +126,3 @@ for dir in $(ls /mnt/$USER) ; do
|
||||
|
||||
done
|
||||
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user