2024-10-21 20:23:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
envfile=/etc/apache2/conf.d/env.conf
|
|
|
|
haveenv=/etc/apache2/haveenv.txt
|
|
|
|
|
2025-01-04 10:59:24 +01:00
|
|
|
# Vérification de la permission d'écriture
|
|
|
|
if touch "$envfile" &>/dev/null; then
|
|
|
|
echo "GENERATION DES VARIABLES D'ENVIRONNEMENT"
|
|
|
|
rm -rf $envfile
|
|
|
|
rm -rf $haveenv
|
|
|
|
|
|
|
|
printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile
|
|
|
|
compgen -e | while read name ; do
|
|
|
|
if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]]
|
|
|
|
then
|
|
|
|
touch $haveenv
|
|
|
|
printf " $name" >> $envfile
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
printf "\n" >> $envfile
|
2024-10-21 20:23:21 +02:00
|
|
|
|
2025-01-04 10:59:24 +01:00
|
|
|
if [[ ! -f $haveenv ]]
|
2024-10-21 20:23:21 +02:00
|
|
|
then
|
2025-01-04 10:59:24 +01:00
|
|
|
rm -rf $envfile
|
2024-10-21 20:23:21 +02:00
|
|
|
fi
|
2025-01-04 10:59:24 +01:00
|
|
|
rm -rf $haveenv
|
2024-10-21 20:23:21 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "START HTTPD"
|
|
|
|
httpd -DFOREGROUND
|
2025-01-04 10:59:24 +01:00
|
|
|
|