Skip to content
Snippets Groups Projects
Verified Commit 8dbf27e2 authored by David Beniamine's avatar David Beniamine
Browse files

WIP : files for mass import

parent 29618d45
Branches
No related tags found
No related merge requests found
#!/bin/bash
DIR=`dirname $0`
usage(){
echo "Usage $0 names.txt"
echo "Reads a list of name corresponding to some ldap users"
echo "and run $DIR/create_primtux_user.sh on each of them"
}
if [ -z "$1" ]
then
usage
exit 1
fi
if [ ! -f "$1" ]
then
echo "$1 is not a file"
usage
exit 1
fi
while read first last level
do
echo $first
echo $last
echo $level
uid=`ldapsearch -x cn="$first $last" | grep "^uid:" | cut -f ' ' -d 2`
echo $uid
echo $DIR/create_primtux_user.sh $uid $level
done < $1
#!/bin/bash #!/bin/bash
LEVELS="cycle_1 cycle_2 cycle_3 professeur direction" LEVELS="cycle1 cycle2 cycle3 prof direction"
declare -A SKELS declare -A SKELS
SKELS[cycle_1]="01-mini" SKELS[cycle1]="01-mini"
SKELS[cycle_2]="02-super" SKELS[cycle2]="02-super"
SKELS[cycle_3]="03-maxi" SKELS[cycle3]="03-maxi"
SKELS[professeur]="prof" SKELS[prof]="prof"
SKELS[direction]="direction" SKELS[direction]="direction"
declare -A GRPS declare -A GRPS
GRPS[cycle_1]="Cycle1" GRPS[cycle1]="Cycle1"
GRPS[cycle_2]="Cycle2" GRPS[cycle2]="Cycle2"
GRPS[cycle_3]="Cycle3" GRPS[cycle3]="Cycle3"
GRPS[professeur]="Profs" GRPS[prof]="Profs"
GRPS[direction]="Administratifs" GRPS[direction]="Administratifs"
user="$1" user="$1"
...@@ -86,6 +86,7 @@ do ...@@ -86,6 +86,7 @@ do
ln -sf "$home/`basename \"$f\" | sed 's/.* \(.*\)/\u\1/'`" "$f" ln -sf "$home/`basename \"$f\" | sed 's/.* \(.*\)/\u\1/'`" "$f"
done done
sed -i s@${SKELS[$level]}@$user@g $home/.config/xfce4/panel/launcher-4/14504679941.desktop sed -i s@${SKELS[$level]}@$user@g $home/.config/xfce4/panel/launcher-4/14504679941.desktop
sed -i s@/home/${SKELS[$level]}/Documents@/home/$user/Documents @g $home/.handymenu.conf
sed -i s@${SKELS[$level]}@$user@g $home/.handymenu.conf sed -i s@${SKELS[$level]}@$user@g $home/.handymenu.conf
# fix samba passwd # fix samba passwd
# echo "You will be 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"
......
#!/bin/bash
usage(){
echo "Usage $0 numberOfEntriesPerLevel"
echo "Create two txt files for importing users to the SLIS"
}
if [ -z "$1" ]
then
usage
exit 1
fi
save_uid (){
echo $2 $1 $3 >> names.txt
}
STUDENT_LEVELS="cycle1 cycle2 cycle3"
TEACH_LEVELS="prof"
rm classes.txt eleves.txt profs.txt names.txt
for i in `seq 1 $1`
do
for l in $STUDENT_LEVELS
do
gender=`[ $(( $RANDOM % 2 )) == 1 ] && echo "M" || echo "F"`
echo "|$l|-$i|19700101|$gender|Primtux" >> eleves.txt
save_uid $l -$i $l
done
for l in $TEACH_LEVELS
do
gender=$(( 1 + $RANDOM % 2 ))
echo "|$l|$i|19700101|$gender" >> profs.txt
save_uid $l $i $l
done
done
echo "|direction|1|19700101|$gender" >> profs.txt
save_uid direction 1 direction
echo "|administratif|1|19700101|$gender" >> profs.txt
save_uid administratif 1 direction
for level in $STUDENT_LEVELS $TEACH_LEVELS direction
do
echo "$level|classe des $level|" >> classes.txt
done
echo "All done, please import eleves.txt, profs.txt and classes.txt"
echo "Then run `dirname $0`/create_mass_primtux_users.sh names.txt"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment