LDAPAccountManager/lam-packaging/debian/postinst

122 lines
5.4 KiB
Plaintext
Raw Normal View History

2006-01-20 15:33:13 +00:00
#!/bin/bash
set -e
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
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
cd /usr/share/ldap-account-manager/config-samples/selfService
2008-02-16 10:04:50 +00:00
files=`ls -a default.*`
for file in $files; do
if [ ! -f /var/lib/ldap-account-manager/config/selfService/$file ]; then
cp $file /var/lib/ldap-account-manager/config/selfService/$file
fi
done
2006-01-20 15:33:13 +00:00
if [ ! -h /usr/share/ldap-account-manager/lib/fpdf.php ]; then\
ln -s /usr/share/fpdf/fpdf.php /usr/share/ldap-account-manager/lib/fpdf.php; fi
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
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
2006-01-20 15:33:13 +00:00
if [ ! -f /var/lib/ldap-account-manager/config/lam.conf ]; \
2014-07-12 14:24:05 +00:00
then cp /var/lib/ldap-account-manager/config/lam.conf.sample /var/lib/ldap-account-manager/config/lam.conf; \
2006-01-20 15:33:13 +00:00
chown www-data /var/lib/ldap-account-manager/config/lam.conf; fi
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)
if [ -d /etc/$server/mods-enabled ] && [ -d /etc/$server/mods-available ]; then
2006-01-20 15:33:13 +00:00
if [ ! -f /etc/$server/mods-enabled/actions.load -a ! -h /etc/$server/mods-enabled/actions.load ]; then
ln -s /etc/$server/mods-available/actions.load /etc/$server/mods-enabled/actions.load
fi
2014-01-20 16:45:12 +00:00
if [ -f /etc/$server/mods-available/php5.load ]; then
if [ ! -f /etc/$server/mods-enabled/php5.load -a ! -h /etc/$server/mods-enabled/php5.load ]; then
ln -s /etc/$server/mods-available/php5.load /etc/$server/mods-enabled/php5.load
2006-01-20 15:33:13 +00:00
fi
fi
2014-01-20 16:45:12 +00:00
if [ -f /etc/$server/mods-available/php5.conf ]; then
if [ ! -f /etc/$server/mods-enabled/php5.conf -a ! -h /etc/$server/mods-enabled/php5.conf ]; then
ln -s /etc/$server/mods-available/php5.conf /etc/$server/mods-enabled/php5.conf
2006-01-20 15:33:13 +00:00
fi
fi
2014-01-20 16:45:12 +00:00
if [ -f /etc/$server/mods-available/version.load ]; then
if [ ! -f /etc/$server/mods-enabled/version.load -a ! -h /etc/$server/mods-enabled/version.load ]; then
ln -s /etc/$server/mods-available/version.load /etc/$server/mods-enabled/version.load
fi
fi
2006-01-20 15:33:13 +00:00
fi
2013-07-19 20:45:57 +00:00
if [ -d /etc/$server/conf.d -a ! -e /etc/$server/conf.d/ldap-account-manager ]; then
ln -s /etc/ldap-account-manager/apache.conf /etc/$server/conf.d/ldap-account-manager
restart="$restart $server"
fi
if [ -d /etc/$server/conf-available ] && [ -d /etc/$server/conf-enabled ]; then
2013-07-19 20:45:57 +00:00
if [ ! -e /etc/$server/conf-available/ldap-account-manager ]; then
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
2013-07-19 21:06:13 +00:00
if [ ! -e /etc/$server/conf-enabled/ldap-account-manager.conf ]; then
ln -s ../conf-available/ldap-account-manager.conf /etc/$server/conf-enabled/ldap-account-manager.conf
2013-07-19 20:45:57 +00:00
fi
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%,}
if [ -x /usr/sbin/invoke-rc.d ]; then
2012-10-07 10:19:17 +00:00
invoke-rc.d $server reload
2006-01-20 15:33:13 +00:00
else
2012-10-07 10:19:17 +00:00
/etc/init.d/$server reload
2006-01-20 15:33:13 +00:00
fi
done
fi
fi
#DEBHELPER#
db_stop
exit 0