Debian Codegraph @

debian/javascript-common.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 # summary of how this script can be called:
6 # * <postinst> `configure' <most-recently-configured-version>
7 # * <old-postinst> `abort-upgrade' <new version>
8 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
9 # <new-version>
10 # * <postinst> `abort-remove'
11 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
12 # <failed-install-package> <version> `removing'
13 # <conflicting-package> <version>
14 # for details, see http://www.debian.org/doc/debian-policy/ or
15 # the debian-policy package
16
17 dh_apache2_failed() {
18 cat << EOS
19 Updating the apache2 configuration failed. Please check yourself if the
20 javascript-common configuration for apache2 is enabled.
21 EOS
22 }
23
24 lighttpd_setup() {
25 mkdir -p /etc/lighttpd/conf-enabled
26 if [ ! -e /etc/lighttpd/conf-enabled/90-javascript-alias.conf ]
27 then
28 ln -s ../conf-available/90-javascript-alias.conf /etc/lighttpd/conf-enabled/90-javascript-alias.conf
29 if which invoke-rc.d > /dev/null && [ -x /etc/init.d/lighttpd ]
30 then
31 invoke-rc.d lighttpd reload || true
32 fi
33 fi
34 }
35
36
37 case "${1}" in
38 configure)
39 if dpkg --compare-versions "$2" lt 9
40 then
41 # Fresh install or most-recently-configured-version < 9
42 lighttpd_setup
43 else
44 if [ -e /etc/javascript-common/lighttpd_disabled_by_user ]
45 then
46 rm /etc/javascript-common/lighttpd_disabled_by_user
47 rmdir --ignore-fail-on-non-empty /etc/javascript-common
48 # Do not reenable javascript/ in lighttpd
49 echo javascript-alias was disabled in lighttpd. >&2
50 echo Hint: Use \"lighttpd-enable-mod javascript-alias\" to re-enable. >&2
51 else
52 lighttpd_setup
53 fi
54 fi
55 ;;
56
57 abort-upgrade|abort-remove|abort-deconfigure)
58 ;;
59
60 *)
61 echo "postinst called with unknown argument \`${1}'" >&2
62 exit 1
63 ;;
64 esac
65
66 #DEBHELPER#
67
68 # Will make piupart more happy on upgrades
69 if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl "9"
70 then
71 # Remove old /etc/apache2/conf.d if empty and not already removed by user:
72 if [ -d /etc/apache2/conf.d ]
73 then
74 rmdir --ignore-fail-on-non-empty /etc/apache2/conf.d
75 fi
76 # This is a work around bug #584185:
77 if [ -d /etc/javascript-common ]
78 then
79 rmdir --ignore-fail-on-non-empty /etc/javascript-common
80 fi
81 fi
82
83 exit 0