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

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

fixing n4d reload

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