LDAPAccountManager/lam-packaging/debian/postinst

113 lines
4.0 KiB
Plaintext
Raw Normal View History

2006-01-20 15:33:13 +00:00
#!/bin/bash
set -e
2017-04-17 17:12:11 +00:00
if [ "$1" != "configure" ]; then
exit 0
fi
2006-01-20 15:33:13 +00:00
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
2018-06-28 12:40:12 +00:00
# 3rd party libs
2019-03-24 08:37:16 +00:00
phpThirdPartyLibs='phpseclib Monolog Psr'
2018-06-28 12:40:12 +00:00
for phpThirdPartyLib in $phpThirdPartyLibs; do
2018-09-25 17:00:08 +00:00
if [ ! -L /usr/share/ldap-account-manager/lib/3rdParty/${phpThirdPartyLib} ] ; then
ln -s /usr/share/php/${phpThirdPartyLib} /usr/share/ldap-account-manager/lib/3rdParty/${phpThirdPartyLib}
fi
2018-06-28 12:40:12 +00:00
done
2008-02-16 10:25:06 +00:00
cd /usr/share/ldap-account-manager/config-samples/profiles
2008-02-16 10:04:50 +00:00
files=`ls -a default.*`
for file in $files; do
2012-10-28 16:41:40 +00:00
if [ ! -f /var/lib/ldap-account-manager/config/templates/profiles/$file ]; then
cp $file /var/lib/ldap-account-manager/config/templates/profiles/$file
2008-02-16 10:04:50 +00:00
fi
done
2008-02-16 10:25:06 +00:00
cd /usr/share/ldap-account-manager/config-samples/pdf
2008-02-16 10:04:50 +00:00
files=`ls -a default.*`
for file in $files; do
2012-10-28 16:41:40 +00:00
if [ ! -f /var/lib/ldap-account-manager/config/templates/pdf/$file ]; then
cp $file /var/lib/ldap-account-manager/config/templates/pdf/$file
2008-02-16 10:04:50 +00:00
fi
done
2012-10-28 17:10:50 +00:00
cd /usr/share/ldap-account-manager/config-samples/pdf/logos
2008-02-16 10:33:37 +00:00
files=`ls -a *.jpg`
2008-02-16 10:25:06 +00:00
for file in $files; do
2012-10-28 16:41:40 +00:00
cp $file /var/lib/ldap-account-manager/config/templates/pdf/logos/$file
2008-02-16 10:25:06 +00:00
done
2019-12-15 16:30:00 +00:00
if [ ! -h /usr/share/ldap-account-manager/config ]; then
ln -s /var/lib/ldap-account-manager/config /usr/share/ldap-account-manager/config
fi
if [ ! -h /usr/share/ldap-account-manager/sess ]; then
ln -s /var/lib/ldap-account-manager/sess /usr/share/ldap-account-manager/sess
fi
if [ ! -h /usr/share/ldap-account-manager/tmp ]; then
ln -s /var/lib/ldap-account-manager/tmp /usr/share/ldap-account-manager/tmp
fi
2006-01-20 15:33:13 +00:00
chown www-data /etc/ldap-account-manager/config.cfg
chmod 600 /etc/ldap-account-manager/config.cfg
chown www-data /var/lib/ldap-account-manager/sess
2012-01-26 20:44:59 +00:00
chmod 700 /var/lib/ldap-account-manager/sess
2006-01-20 15:33:13 +00:00
chown www-data /var/lib/ldap-account-manager/tmp
2012-01-26 20:44:59 +00:00
chown www-data /var/lib/ldap-account-manager/tmp/internal
chmod 700 /var/lib/ldap-account-manager/tmp
2006-01-20 15:33:13 +00:00
chown -R www-data /var/lib/ldap-account-manager/config
2012-01-26 20:44:59 +00:00
chmod 700 /var/lib/ldap-account-manager/config
2019-12-15 16:18:50 +00:00
set +e
ls -l /var/lib/ldap-account-manager/config/*.conf &> /dev/null
cfgFilesExist=$?
2019-12-15 16:40:44 +00:00
set -e
2019-12-15 16:30:00 +00:00
if [ $cfgFilesExist -ne 0 ]; then
cp /var/lib/ldap-account-manager/config/unix.conf.sample /var/lib/ldap-account-manager/config/lam.conf
chown www-data /var/lib/ldap-account-manager/config/lam.conf
fi
2006-01-20 15:33:13 +00:00
chmod 600 /var/lib/ldap-account-manager/config/*.conf
if [ "$1" = "configure" ]; then
db_get "ldap-account-manager/alias"
alias="$RET"
perl -pi -e "s/Alias \/.* \/usr\/share\/ldap-account-manager/Alias \/$alias \/usr\/share\/ldap-account-manager/g"\
/etc/ldap-account-manager/apache.conf
db_get "ldap-account-manager/config-webserver"
webservers="$RET"
restart=""
for server in $webservers; do
server=${server%,}
test -x /usr/sbin/$server || continue
case "$server" in
apache2)
2017-04-17 09:16:38 +00:00
if [ -h /etc/$server/conf.d/ldap-account-manager ]; then
rm -f /etc/$server/conf.d/ldap-account-manager
fi
2017-04-17 09:59:40 +00:00
if [ -d /etc/$server/conf-available ]; then
2016-04-02 12:45:33 +00:00
if [ ! -e /etc/$server/conf-available/ldap-account-manager.conf ]; then
if [ -h /etc/$server/conf-available/ldap-account-manager.conf ]; then
rm /etc/$server/conf-available/ldap-account-manager.conf
fi
2013-07-19 21:06:13 +00:00
ln -s /etc/ldap-account-manager/apache.conf /etc/$server/conf-available/ldap-account-manager.conf
2013-07-19 20:45:57 +00:00
fi
2017-04-17 17:53:07 +00:00
a2query -q -c ldap-account-manager || a2enconf -q ldap-account-manager
2013-07-19 20:45:57 +00:00
restart="$restart $server"
fi
2006-01-20 15:33:13 +00:00
;;
esac
done
db_get "ldap-account-manager/restart-webserver"
if [ "$RET" = "true" ]; then
for server in $restart; do
server=${server%,}
2017-09-28 15:57:46 +00:00
if [ `which invoke-rc.d` ]; then
2015-06-29 18:58:53 +00:00
invoke-rc.d $server reload
elif [ `which service` ]; then
service $server reload
2006-01-20 15:33:13 +00:00
fi
done
fi
fi
#DEBHELPER#
db_stop
exit 0