-
Notifications
You must be signed in to change notification settings - Fork 0
/
ldap.sh
executable file
·53 lines (43 loc) · 1.01 KB
/
ldap.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
function help {
printf "Valid arguments are:\n"
printf "\t--type=full|eionet|bdr\n"
printf "\t--rootuid=<uid_of_the_root_user>\n"
printf "\t--rootpw=<password_for_the_root_user>\n"
exit 1
}
if [ $# -eq 0 ]; then
help
fi
while [ $# -gt 0 ]; do
case "$1" in
--type=*)
type="${1#*=}"
;;
--rootuid=*)
rootuid="${1#*=}"
;;
--rootpw=*)
rootpw="${1#*=}"
;;
*)
printf "***************************\n"
printf "* Error: Invalid argument.*\n"
printf "***************************\n"
exit 1
esac
shift
done
if [[ -n $type && -n $rootuid && -n $rootpw ]]; then
runDeps="gcc virtualenv python-pip python-dev libmysqlclient-dev python-genshi"
apt-get update -y \
&& apt-get install -y --no-install-recommends $runDeps
virtualenv -p python2.7 venv
. venv/bin/activate
pip install MySQL-python Genshi
python generate_ldif.py $type $rootuid $rootpw
deactivate
rm -r venv
else
help
fi