lemonldap-ng/debian/liblemonldap-ng-conf-perl.p...

39 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Maintainer: #DEBHELPER#
set -e
. /usr/share/debconf/confmodule
FIRSTCONFFILE=/var/lib/lemonldap-ng/conf/lmConf-1
CONFDIR=/etc/lemonldap-ng
SESSIONSDIR=/var/lib/lemonldap-ng/sessions
if [ "$1" == "configure" ]
then
chmod 770 $SESSIONSDIR
chmod 770 $SESSIONSDIR/lock
chown -R www-data:www-data $SESSIONSDIR
chown -R www-data:www-data /var/lib/lemonldap-ng/conf
chmod 750 /var/lib/lemonldap-ng/conf
chmod 640 /var/lib/lemonldap-ng/conf/*
chgrp www-data /etc/lemonldap-ng/lemonldap-ng.ini
chmod 640 /etc/lemonldap-ng/lemonldap-ng.ini
for i in domain ldapServer ldapPort ldapBase managerDn managerPassword portal; do
db_get liblemonldap-ng-conf-perl/$i || true
perl -000 -i -pe "s#^$i(\\n\\s+)('?)[^\\n]*?('?)\$#$i\${1}\${2}$RET\${3}#m" $FIRSTCONFFILE
done
testversion=`echo $2|sed -e 's/^0\.9.*$/X/'`
if [ "$testversion" = "X" ]; then
if [ -e $CONFDIR/storage.conf -o -e $CONFDIR/apply.conf -o -e $CONFDIR/apps-list.xml ] ; then
db_get liblemonldap-ng-conf-perl/migrate
if [ "$RET" ]; then
# Run migration script
/usr/share/lemonldap-ng/bin/lmMigrateConfFiles2ini 2>&1 > /dev/null || :
fi
fi
fi
fi
exit 0