Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LCS-primtux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Primtux-SLIS
LCS-primtux
Commits
8dbf27e2
Verified
Commit
8dbf27e2
authored
7 years ago
by
David Beniamine
Browse files
Options
Downloads
Patches
Plain Diff
WIP : files for mass import
parent
29618d45
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
create_mass_primtux_users.sh
+31
-0
31 additions, 0 deletions
create_mass_primtux_users.sh
create_primtux_user.sh
+10
-9
10 additions, 9 deletions
create_primtux_user.sh
generate_users.sh
+41
-0
41 additions, 0 deletions
generate_users.sh
with
82 additions
and
9 deletions
create_mass_primtux_users.sh
0 → 100755
+
31
−
0
View file @
8dbf27e2
#!/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
This diff is collapsed.
Click to expand it.
create_primtux_user.sh
+
10
−
9
View file @
8dbf27e2
#!/bin/bash
#!/bin/bash
LEVELS
=
"cycle
_
1 cycle
_
2 cycle
_
3 prof
esseur
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[prof
esseur
]
=
"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[prof
esseur
]
=
"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"
...
...
This diff is collapsed.
Click to expand it.
generate_users.sh
0 → 100755
+
41
−
0
View file @
8dbf27e2
#!/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"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment