blob: d7b79f902ee1a750b49177aade210221a9af4651 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/sh
set -e
# Create GTK/Gnome places bookmark for easy access.
add_gtk3_place() {
SERVER="$1"
USER="$2"
GROUP="$3"
TITLE="$4"
SMBPATH="$5"
if [ ! grep -q "$SMBPATH $TITLE" "/home/$USER/.config/gtk-3.0/bookmarks" ]; then
echo "$SMBPATH $TITLE" >> /home/$USER/.config/gtk-3.0/bookmarks
chown $USER:$GROUP /home/$USER/.config/gtk-3.0/bookmarks
fi
}
# FIXME Would be nice if the same bookmark file could be used for both
# KDE and Gnome
case "$ORIGHOMEDIR" in
/*/*/*)
homepath="$(ldapsearch -LLL -x '(&(uid=$USER)(sambaHomePath=*))' sambaHomePath | awk '/sambaHomePath: / { print $2 }')"
if [ "$homepath" ] ; then
SMBPATH=$(echo "smb:$homepath" | tr '\' /)
SERVER="$(echo $SMBPATH | cut -d/ -f3)"
else
# Extract FQDN from home directory path
SERVER="$(getent hosts $(echo $ORIGHOMEDIR | cut -d/ -f3) | awk '{print $2}')"
SMBPATH="smb://$SERVER/$USER/"
fi
GROUP="$(id -ng $USER)"
TITLE="$USER on $SERVER via SMB"
add_gtk3_place "$SERVER" "$USER" "$GROUP" "$TITLE" "$SMBPATH"
;;
esac
|