pgsql_command2="CREATE USER $sql_login with password '$sql_password';"
pgsql_command3="ALTER DATABASE $sql_name owner to $sql_login;"
if[$sql_is_local== 1 ]
if[$sql_is_local== 1 ]
then
then
apt-get -yinstall postgresql
apt-get -yinstall postgresql
sudo-u postgres psql --command="$pgsql_command1"
sudo-u postgres psql --command="$pgsql_command1"
sudo-u postgres psql --command="$pgsql_command2"
sudo-u postgres psql --command="$pgsql_command2"
sudo-u postgres psql --command="$pgsql_command3"
sudo-u postgres psql --command="$pgsql_command3"
else
else
echo"Veuillez saisir la commande suivante sur le serveur sql distant, puis validez"
echo"Please execute the following commands on the remote SQL server and then continue"
echo sudo-u postgres psql $pgsql_command1
echo"sudo -u postgres psql $pgsql_command1"
echo sudo-u postgres psql $pgsql_command2
echo"sudo -u postgres psql $pgsql_command2"
echo sudo-u postgres psql $pgsql_command3
echo"sudo -u postgres psql $pgsql_command3"
while true;do
while true
read-p"Continue (y/n)?" choice
do
case"$choice"in
read-p"Continue (y/n)?" choice
y|Y )break;;
case"$choice"in
n|N )exit;;
y|Y )break;;
*)echo"invalid";;
n|N )exit;;
esac
*)echo"Invalid";;
done
esac
done
fi
fi
fi
fi
echo"LDAP setup"
if[$ldap_is_local== 1 ]
if[$ldap_is_local== 1 ]
then
then
setup_ldap $ldap_password$ldap_dn
else
TITLE="LDAP server setup"
MSGBOX="Please manually setup the remote LDAP server by launching the following commands: ./install_re2o.sh ldap $ldap_password$ldap_dn"
ldap_setup=$(dialog --clear\
--title"$TITLE"\
--msgbox"$MSGBOX"\
$HEIGHT$WIDTH\
2>&1 >/dev/tty)
fi
setup_ldap $ldap_password$ldap_dn
else
HEIGHT=15
WIDTH=40
ldap_setup=$(dialog --clear\
--title"Setup ldap"\
--msgbox"Vous devrez manuellement effectuer les opérations de setup de la base ldap sur le serveurs distant. Lancez la commande : ./install_re2o.sh ldap $ldap_password$ldap_dn"\
$HEIGHT$WIDTH\
2>&1 >/dev/tty)
fi
echo"Ecriture de settings_local"
echo"Writing of the settings_local.py file"
django_secret_key=$(python -c"import random; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%=+') for i in range(50)]))")
django_secret_key=$(python -c"import random; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%=+') for i in range(50)]))")
aes_key=$(python -c"import random; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%=+') for i in range(32)]))")
aes_key=$(python -c"import random; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789%=+') for i in range(32)]))")