File: postinst

package info (click to toggle)
libapache-mod-random 1.4-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 152 kB
  • ctags: 59
  • sloc: ansic: 318; sh: 170; makefile: 90
file content (78 lines) | stat: -rw-r--r-- 2,119 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
#!/bin/bash -e

# Standard postinst script for apache modules
# Written April 2006 by Pawel Wiecek <coven@debian.org>

MODULE=mod_random

# Source debconf library.
. /usr/share/debconf/confmodule

case "$1" in
  configure)
    db_get shared/apache-modules/counters/upgrade_list
    if echo "$RET" | sed -e 's/^,//' -e 's/,/\n/g' | grep -q "^$MODULE$"
    then
      # upgraded
      db_get shared/apache-modules/counters/upgrade
      COUNT="$RET"
      let COUNT-- || true
      db_set shared/apache-modules/counters/upgrade "$COUNT"
      if [ "$COUNT" -eq 0 ]
      then
	# this is a last upgraded module, time to act
	for ap in '' -ssl -perl
	do
	  if [ -x /usr/sbin/apache$ap ]
	  then
	    db_get shared/apache-modules/reload$ap
	    [ "$RET" = "true" ] && /usr/sbin/apache${ap}ctl graceful
	  fi
	done
	db_set shared/apache-modules/counters/upgrade_list ''
      fi
    else
      # newly installed
      db_get shared/apache-modules/counters/install
      COUNT="$RET"
      let COUNT-- || true
      db_set shared/apache-modules/counters/install "$COUNT"
      if [ "$COUNT" -eq 0 ]
      then
	# this is a last installed module, time to act
	db_get shared/apache-modules/counters/install_list
	LIST=`echo "$RET" | sed -e 's/^,//' -e 's/,/,\n/g'`
	for ap in '' -ssl -perl
	do
	  if [ -x /usr/sbin/apache$ap ]
	  then
	    # ask which of newly installed modules should be enabled
	    db_fset shared/apache-modules/modules seen false
	    db_subst shared/apache-modules/modules flavour apache$ap
	    db_subst shared/apache-modules/modules choices $LIST
	    db_set shared/apache-modules/modules $LIST
	    db_input medium shared/apache-modules/modules || true
	    db_go || true
	    db_get shared/apache-modules/modules
	    NEWLIST=`echo "$RET" | tr -d '[:space:]'`
	    apache-modconf apache$ap enable "$NEWLIST"
	  fi
	done
	db_set shared/apache-modules/counters/install_list ''
      fi
    fi
    ;;
    
  abort-upgrade | abort-remove | abort-deconfigure)
    # nothing to do here
    ;;
    
  *)
    echo "$0: didn't understand being called with \`$1'" >&2
    exit 1
    ;;
esac

#DEBHELPER#

exit 0