diff --git a/files/sprachenatelier.netz/homedirs/DEFAULT/_profile.j2 b/files/sprachenatelier.netz/homedirs/DEFAULT/_profile.j2 index 2db5f2a..ad9dc34 100644 --- a/files/sprachenatelier.netz/homedirs/DEFAULT/_profile.j2 +++ b/files/sprachenatelier.netz/homedirs/DEFAULT/_profile.j2 @@ -48,7 +48,20 @@ export LANG="de_DE.utf8" SERVER="{{ samba_server }}" USER="{{ item.item.name }}" PASSWORD='{{ item.item.password }}' -VERSION="1.0" + +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 # Use NTLMv2 password hashing and force packet signing # @@ -99,36 +112,24 @@ 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 [ -x /usr/bin/smb4k_mount ]; then - ## - Ubuntu <= 12.04 - if [[ -z "$VERSION" ]] ; then - 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 - elif [[ "$VERSION" = "1.0" ]]; then - sudo /usr/bin/smb4k_mount -o user=$USER,password=$PASSWORD,iocharset=utf8,vers=$VERSION \ - -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 \ - -n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1 - fi + + 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 else - ## - Ubuntu Version >= 14.04 - if [[ -z "$VERSION" ]] ; then - sudo /bin/mount -o user=$USER,password=$PASSWORD,iocharset=utf8,uid=$USER,gid=$_GID \ - -n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1 - elif [[ "$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 \ - -n -t cifs //$SERVER/$SHARE $MOUNT_POINT >> $_logfile 2>&1 - fi + + 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 fi else echo "mount point $MOUNT_POINT already exists. nothing left to do.." >> $_logfile fi done + {% endif %}