liblemonldap-ng-common-perl.postinst 1.06 KB
Newer Older
1 2
#!/bin/bash

3 4
set -e

5 6
. /usr/share/debconf/confmodule

7
CONFDIR=/etc/lemonldap-ng
Xavier Guimard's avatar
Xavier Guimard committed
8
SESSIONSDIR=/var/lib/lemonldap-ng/sessions
Xavier Guimard's avatar
Xavier Guimard committed
9
CONFSTORAGEDIR=/var/lib/lemonldap-ng/conf
10
FIRSTCONFFILE=$CONFSTORAGEDIR/lmConf-1.json
Xavier Guimard's avatar
Xavier Guimard committed
11 12
LMINIFILE=/etc/lemonldap-ng/lemonldap-ng.ini
MIGRATION=/usr/share/lemonldap-ng/bin/lmMigrateConfFiles2ini
13 14 15

if [ "$1" == "configure" ]
then
Xavier Guimard's avatar
Xavier Guimard committed
16
    for i in domain ldapServer ldapPort ldapBase managerDn managerPassword portal; do
17
        db_get liblemonldap-ng-common-perl/$i || true
Xavier Guimard's avatar
Xavier Guimard committed
18 19 20
        perl -000 -i -pe "s#^$i(\\n\\s+)('?)[^\\n]*?('?)\$#$i\${1}\${2}$RET\${3}#m" $FIRSTCONFFILE
    done

Xavier Guimard's avatar
Xavier Guimard committed
21
    # Run migration script to convert menu format if old version is 0.9.*
22
    if [ "$2" != "" ]; then
23
        if dpkg --compare-versions "$2" lt 1.0; then
24
            if [ -e $CONFDIR/storage.conf -o -e $CONFDIR/apply.conf -o -e $CONFDIR/apps-list.xml ] ; then
25
                db_get liblemonldap-ng-common-perl/migrate
26 27 28
                #if [ "$RET" ]; then
                #    $MIGRATION 2>&1 > /dev/null || :
                #fi
Xavier Guimard's avatar
Xavier Guimard committed
29 30 31
            fi
        fi
    fi
32
fi
Xavier Guimard's avatar
Xavier Guimard committed
33

34
#DEBHELPER#
35
exit 0