liblemonldap-ng-conf-perl.postinst 993 Bytes
Newer Older
1
2
3
#!/bin/bash
# Maintainer: #DEBHELPER#

4
5
set -e

6
7
8
. /usr/share/debconf/confmodule

FIRSTCONFFILE=/var/lib/lemonldap-ng/conf/lmConf-1
Yadd's avatar
Yadd committed
9
CONFDIR=/etc/lemonldap-ng
10
11
12

if [ "$1" == "configure" ]
then
Yadd's avatar
Yadd committed
13
14
15
16
17
	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
18

Yadd's avatar
Yadd committed
19
20
21
22
	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
23
	if [ `echo $2|sed -e 's/^0\.9.*$/X/'` = "X" ]; then
Yadd's avatar
Yadd committed
24
		if [ -e $CONFDIR/storage.conf -o -e $CONFDIR/apply.conf -o -e $CONFDIR/apps-list.xml ] ; then
25
26
27
28
29
			db_get liblemonldap-ng-conf-perl/migrate
			if [ "$RET" ]; then
				# Run migration script
				/usr/share/lemonldap-ng/bin/lmMigrateConfFiles2ini 2>&1 > /dev/null || :
			fi
Yadd's avatar
Yadd committed
30
31
		fi
	fi
32
33
fi
exit 0