File: postinst

package info (click to toggle)
libapache-mod-trigger 1.1-4.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 92 kB
  • ctags: 70
  • sloc: ansic: 326; makefile: 108; sh: 92
file content (87 lines) | stat: -rw-r--r-- 2,547 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# postinst for libapache-mod-trigger, based on:
# postinst for libapache-mod-mp3, based on:
# postinst for libapache-mod-gzip, based on:
# postinst for libapache-mod-auth-pam, based on:
# postinst for libapache-mod-auth-sys, based on:
# postinst for libapache-mod-perl, based on:
# postinst.skeleton
# Skeleton maintainer script showing all the possible cases.
# Written by Charles Briscoe-Smith, March-April 1998.  Public Domain.

# Abort if any command returns an error value
set -e

# This script is called as the last step of the installation of the
# package.  All the package's files are in place, dpkg has already done
# its automatic conffile handling, and all the packages we depend of
# are already fully installed and configured.

# DJ
# This function may enable our module.
enable () {
	[ -x /usr/sbin/apache$1 ] || return 0
	[ -f /etc/apache$1/modules.conf ] || return 0
	if grep -q '^LoadModule.*mod_trigger\.so' /etc/apache$1/modules.conf 2>&1
	then
		return 0
	fi
	echo -n "A new Apache module has been installed.  Reconfigure apache$1 [Y/n]? "
	read CONFIG
	if [ ".$CONFIG" == ".n" -o ".$CONFIG" == ".N" ]
	then
		return 0
	fi
	[ -x /usr/sbin/apache$1config ] && /usr/sbin/apache$1config --force-modules
}

# Restart apache if user wants.
ask_restart () {
	[ -x /usr/sbin/apache$1 ] || return 0
	echo -n "An Apache module has been modified.  Restart apache$1 [Y/n]? "
	read CONFIG
	if [ ".$CONFIG" != ".n" -a ".$CONFIG" != ".N" ]
	then
		/usr/sbin/apache$1ctl graceful
	fi
}

case "$1" in
  configure)
    # Configure this package.  If the package must prompt the user for
    # information, do it here.  There are three sub-cases.
    :
    if test "${2+set}" != set; then
      # We're being installed by an ancient dpkg which doesn't remember
      # which version was most recently configured, or even whether
      # there is a most recently configured version.
		enable ""
		enable "-ssl"
		enable "-perl"
      :
    elif test -z "$2" -o "$2" = "<unknown>"; then
      # The package has not ever been configured on this system, or was
      # purged since it was last configured.
      # DJ: So let's enable the module!
		enable ""
		enable "-ssl"
		enable "-perl"
      :
    else
      # Version $2 is the most recently configured version of this
      # package.
		ask_restart ""
		ask_restart "-ssl"
		ask_restart "-perl"
      :
    fi ;;
  abort-upgrade | abort-remove | abort-deconfigure)
  	:
    ;;
  *) echo "$0: didn't understand being called with \`$1'" 1>&2
     exit 1;;
esac

#DEBHELPER#

exit 0