source: n4d-samba/trunk/fuentes/debian/postinst @ 804

Last change on this file since 804 was 804, checked in by hectorgh, 4 years ago

wip

  • Property svn:executable set to *
File size: 1.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
20
21PACKAGE_NAME="n4d-samba"
22ORIGINAL_FILE="/etc/init.d/smbd"
23DIVERT_FILE="/usr/share/n4d-ldap/diversions/etc.initd.smbd.divert"
24LLIUREX_FILE="/usr/sbin/smbd-daemon-starter"
25
26
27case "$1" in
28    configure)
29
30        if dpkg --compare-versions "$2" lt 0.25.2; then
31                if [ -e '/var/lib/n4d/variables-dir/SRV_IP' ]; then
32                        cp /usr/share/n4d-samba/one-shots/add-roadmin-user.py /etc/n4d/one-shot/
33                fi
34        fi
35       
36        if dpkg --compare-versions "$2" lt 0.25.5; then
37                service smbd restart || true
38        fi
39
40
41        n4d-modules enable-plugin /etc/n4d/conf.d/SambaManager || true
42        n4d-modules enable-plugin /etc/n4d/conf.d/SambaSIDFixer || true
43       
44
45        if [ -e "$ORIGINAL_FILE" ]; then
46
47                update-rc.d smbd disable 2 3 4 5 || true
48                dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert  ${DIVERT_FILE}  ${ORIGINAL_FILE}
49                ln -s ${DIVERT_FILE} ${LLIUREX_FILE}
50                systemctl daemon-reload || true
51                systemctl enable smbd || true
52
53        fi
54
55
56
57
58
59        ;;
60
61
62
63
64
65    abort-upgrade|abort-remove|abort-deconfigure)
66    ;;
67
68    *)
69        echo "postinst called with unknown argument \`$1'" >&2
70        exit 1
71    ;;
72esac
73
74# dh_installdeb will replace this with shell code automatically
75# generated by other debhelper scripts.
76
77#DEBHELPER#
78
79exit 0
Note: See TracBrowser for help on using the repository browser.