source: n4d-ldap/trunk/fuentes/debian/postinst @ 823

Last change on this file since 823 was 823, checked in by hectorgh, 3 years ago

moving slapd as a predependency to allow systemd to load configurations properly ?

File size: 2.9 KB
Line 
1
2#!/bin/sh
3# postinst script for n4d-ldap
4#
5# see: dh_installdeb(1)
6
7set -e
8
9# summary of how this script can be called:
10#        * <postinst> `configure' <most-recently-configured-version>
11#        * <old-postinst> `abort-upgrade' <new version>
12#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13#          <new-version>
14#        * <postinst> `abort-remove'
15#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
16#          <failed-install-package> <version> `removing'
17#          <conflicting-package> <version>
18# for details, see http://www.debian.org/doc/debian-policy/ or
19# the debian-policy package
20
21PACKAGE_NAME="n4d-ldap"
22ORIGINAL_FILE="/etc/init.d/slapd"
23DIVERT_FILE="/usr/share/n4d-ldap/diversions/etc.initd.slapd.divert"
24LLIUREX_FILE="/usr/sbin/slapd-daemon-starter"
25
26
27case "$1" in
28    configure)
29        if dpkg --compare-versions "$2" lt 0.20; then
30                cp /usr/share/n4d-ldap/one-shots/ldap-fix-epoptes /etc/n4d/one-shot/
31                invoke-rc.d n4d restart || true
32                fi
33               
34        if dpkg --compare-versions "$2" lt 0.21; then
35                echo "Fixing netadmin..."
36                cp /usr/share/n4d-ldap/one-shots/ldap-fix-netadmin /etc/n4d/one-shot/
37                invoke-rc.d n4d restart || true
38                fi
39        if dpkg --compare-versions "$2" lt 0.27; then
40               
41                cp /usr/share/n4d-ldap/one-shots/ldap_update.py /etc/n4d/one-shot/
42                invoke-rc.d n4d restart || true
43        fi
44        if dpkg --compare-versions "$2" lt 0.31; then
45                if [ -e '/var/lib/lliurex-folders/local/students' ]; then
46                        cp /usr/share/n4d/templates/folder/students /var/lib/lliurex-folders/local/
47                fi
48        fi
49
50        if dpkg --compare-versions "$2" lt 0.43; then
51                if [ -e '/var/lib/n4d/variables-dir/SRV_IP' ]; then
52                        echo "Adding roadmin ACLs..."
53                        cp /usr/share/n4d-ldap/one-shots/roadmin_acl.py /etc/n4d/one-shot/
54                        invoke-rc.d n4d restart || true
55                fi
56        fi
57       
58        if dpkg --compare-versions "$2" lt 0.44; then
59                if [ -e '/var/lib/n4d/variables-dir/SRV_IP' ]; then
60                        if [ ! -e "/var/lib/lliurex-folders/local/admins" ]; then
61                                echo "Enabling admins share..."
62                                cp /usr/share/n4d/templates/folder/admins /var/lib/lliurex-folders/local/
63                                cp /usr/share/n4d/templates/folder/netadmin /var/lib/lliurex-folders/local/
64                                invoke-rc.d n4d restart || true
65                        fi
66                fi
67        fi
68       
69
70        if [ -e "$ORIGINAL_FILE" ]; then
71
72                update-rc.d slapd disable 2 3 4 5 || true
73                dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert  ${DIVERT_FILE}  ${ORIGINAL_FILE}
74                ln -s ${DIVERT_FILE} ${LLIUREX_FILE} 
75                systemctl daemon-reload || true
76                systemctl enable slapd || true
77                systemctl restart slapd || true
78
79        fi
80
81
82
83
84
85        n4d-modules enable-plugin /etc/n4d/conf.d/SlapdManager || true
86
87
88        ;;
89
90
91
92    abort-upgrade|abort-remove|abort-deconfigure)
93    ;;
94
95    *)
96        echo "postinst called with unknown argument \`$1'" >&2
97        exit 1
98    ;;
99esac
100
101# dh_installdeb will replace this with shell code automatically
102# generated by other debhelper scripts.
103
104#DEBHELPER#
105
106exit 0
Note: See TracBrowser for help on using the repository browser.