-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
54 lines (52 loc) · 1.74 KB
/
install.sh
File metadata and controls
54 lines (52 loc) · 1.74 KB
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
54
#!/bin/bash
echo "Deploiment du module LDAP"
echo "La position determinera l'ordre d'execution des backends (comme dans init.d)"
read -p "Numero de demarrage du module (2 positions):" NUM
echo "installation dans backends/${NUM}openldap"
INSTALL=../../backends/${NUM}openldap
BACKEND=openldap
if [ -d ../../backends/${NUM}${BACKEND} ];then
read -p "Repertoire déjà existant voulez vous l'écraser ? (O/N)" -i "N" REPONSE
if [ "$REPONSE" = "O" ];then
rm -rf ../../backends/${NUM}${BACKEND}
else
exit 1
fi
fi
mkdir ../../backends/${NUM}${BACKEND}
echo "Copie des fichiers dans ${INSTALL}"
mkdir $INSTALL/etc
cp ./etc/* $INSTALL/etc
mkdir $INSTALL/bin
mkdir $INSTALL/lib
PWD=`pwd`
for I in $PWD/lib/*;do
ln -s $I $INSTALL/lib
done
for I in $PWD/bin/*;do
ln -s $I $INSTALL/bin
done
chmod 700 $INSTALL/bin/*
cp config.yml $INSTALL
echo "Le backend a été installé dans $INSTALL"
echo "Configuration"
read -p "Url du serveur ldap (ldap[s]://FDQN:PORT : " HOST
read -p "Dn d'authentification (doit avoir les droits d'ecriture) : " DN
read -s -p "Mot de passe : " PASSWORD
echo ""
read -p "Base ldap : " BASE
read -p "Branche pour les utilisateurs ex: ou=peoples : " USERBASE
read -p "Attribut pour le Rdn : " RDN
echo "Génération du fichier de configuration"
CONFFILE=${INSTALL}/etc/config.conf
echo "host=${HOST}" > ${CONFFILE}
echo "dn=${DN}" >> ${CONFFILE}
echo "password=${PASSWORD}" >> ${CONFFILE}
echo "base=${BASE}" >> ${CONFFILE}
echo "userbase=${USERBASE},${BASE}" >> ${CONFFILE}
echo "rdnattribute=${RDN}" >> ${CONFFILE}
echo "backendFor=etd,adm,esn" >> ${CONFFILE}
chmod 600 ${CONFFILE}
systemctl restart sesame-daemon
echo "Vous pouvez completer le fichier de configuration avec les parametres optionnels (voir README.md)"
echo "Merci "