diff --git a/create_primtux_user.sh b/create_primtux_user.sh index 7ef30df5422e41eb408d139fe94917ff6b413ee8..761242d774ab9c6127bf18c0376ca8b3c1d54027 100644 --- a/create_primtux_user.sh +++ b/create_primtux_user.sh @@ -7,6 +7,13 @@ SKELS[cycle_3]="03-maxi" SKELS[professeur]="prof" SKELS[direction]="direction" +declare -A GRPS +GRPS[cycle_1]="Cycle1" +GRPS[cycle_2]="Cycle2" +GRPS[cycle_3]="Cycle3" +GRPS[professeur]="Profs" +GRPS[direction]="Administratifs" + user="$1" level="$2" TEMPF="$$_temp" @@ -14,7 +21,7 @@ DIR=`dirname $0` DIST="$DIR/dist" abort(){ rm $TEMPF* - exit 1 + exit 1 } usage(){ echo "Usage $0 username level" @@ -64,6 +71,8 @@ fi # Add Primtux to user group echo -e "dn: cn=Primtux,ou=Groups,$LDAP_BASE_DN\nchangetype: modify\nadd: memberUid\nmemberUid: $user" > $TEMPF.1.ldiff ldapmodify -x -D "cn=$LDAP_ADMIN_RDN,$LDAP_BASE_DN" -w $LDAP_ADMIN_PW -f $TEMPF.1.ldiff +echo -e "dn: cn=${GRPS[$level]},ou=Groups,$LDAP_BASE_DN\nchangetype: modify\nadd: memberUid\nmemberUid: $user" > $TEMPF.1.ldiff +ldapmodify -x -D "cn=$LDAP_ADMIN_RDN,$LDAP_BASE_DN" -w $LDAP_ADMIN_PW -f $TEMPF.1.ldiff # Retrieve files from skels skel="$DIR/skels/${SKELS[$level]}" home=`grep home $TEMPF.ldiff | cut -d ' ' -f 2` @@ -72,13 +81,13 @@ cp -r $skel $home cp -r $home.bak/* $home/ rm -rf $home.bak # fix links -if [ -e "$home/.wine/drive_c/users/01-mini/Bureau" ] -then - ln -sf $home/Bureau $home/.wine/drive_c/users/01-mini/Bureau -fi +find $home/.wine/drive_c/ -type l ! -exec test -e {} \; -print | while read f +do + ln -sf "$home/`basename \"$f\" | sed 's/.* \(.*\)/\u\1/'`" "$f" +done +sed -i s@${SKELS[$level]}@$user@g $home/.config/xfce4/panel/launcher-4/14504679941.desktop # fix samba passwd -# TODO: test me -echo "You willbe prompted twice for samba password, please enter the same as for LDAP" +echo "You will be prompted twice for samba password, please enter the same as for LDAP" smbpasswd -U $user # fix Rights chown -R $uid:lcs-users $home diff --git a/deploy.sh b/deploy.sh index 9e798576f9c2a72263642ab7a2c77ff8920de2e3..83bf8b2f968b330bfc9e6e93868bc2fa1b4d15dd 100644 --- a/deploy.sh +++ b/deploy.sh @@ -4,7 +4,4 @@ then echo "This script should be run on the LCS" exit 1 fi -# Create basic users 1 per cycle + prof + direction -## Homedirs -## LDIF -## ldapadd +DIR=`dirname $0` diff --git a/dist/primtux.ldiff b/dist/primtux.ldiff index 37f5fcbf504fc65eb97987f15360c69b6da0de6d..35df3d94c3f1684a0952db2de38aececa269bd31 100644 --- a/dist/primtux.ldiff +++ b/dist/primtux.ldiff @@ -1,4 +1,25 @@ -dn: cn=Primtux,ou=Groups,ou=DSIT,BASE +dn: cn=Cycle1,ou=Groups,BASE +gidNumber: 5007 +description: Utilisateurs du Cycle 1 +objectClass: posixGroup +objectClass: top +cn: Cycle1 + +dn: cn=Cycle2,ou=Groups,BASE +gidNumber: 5008 +description: Utilisateurs du Cycle 2 +objectClass: posixGroup +objectClass: top +cn: Cycle2 + +dn: cn=Cycle3,ou=Groups,BASE +gidNumber: 5009 +description: Utilisateurs du Cycle 3 +objectClass: posixGroup +objectClass: top +cn: Cycle3 + +dn: cn=Primtux,ou=Groups,BASE gidNumber: 5006 description: Utilisateurs visibles sur Primtux objectClass: posixGroup diff --git a/skels/01-mini/.handymenu.conf b/skels/01-mini/.handymenu.conf deleted file mode 100755 index f1fa041f57a9dc0a27a6fa353bb38c50acee07c3..0000000000000000000000000000000000000000 Binary files a/skels/01-mini/.handymenu.conf and /dev/null differ diff --git a/skels/02-super/.handymenu.conf b/skels/02-super/.handymenu.conf deleted file mode 100644 index 02de0e5c9140df8292e3ac0ef1d1abf4351e9f56..0000000000000000000000000000000000000000 Binary files a/skels/02-super/.handymenu.conf and /dev/null differ diff --git a/skels/03-maxi/.handymenu.conf b/skels/03-maxi/.handymenu.conf deleted file mode 100644 index fe4088f669f26fbc2d2b2d314b5a9cc9ae718245..0000000000000000000000000000000000000000 Binary files a/skels/03-maxi/.handymenu.conf and /dev/null differ diff --git a/skels/direction/.handymenu.conf b/skels/direction/.handymenu.conf deleted file mode 100644 index f77f8ad11492bd39b92467e9d18e1a15fdfa8eb9..0000000000000000000000000000000000000000 Binary files a/skels/direction/.handymenu.conf and /dev/null differ diff --git a/skels/prof/.handymenu.conf b/skels/prof/.handymenu.conf deleted file mode 100644 index f77f8ad11492bd39b92467e9d18e1a15fdfa8eb9..0000000000000000000000000000000000000000 Binary files a/skels/prof/.handymenu.conf and /dev/null differ