File: preinst

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 (69 lines) | stat: -rw-r--r-- 1,688 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
#!/bin/sh -e

# Standard preinst 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
  install)
    db_get shared/apache-modules/counters/install
    COUNT="$RET"
    db_get shared/apache-modules/counters/install_list
    LIST="$RET"
    if echo $LIST | sed -e 's/,/,\n/g' | egrep -q "^$MODULE,?$"
    then
      # already added, nothing to do
      :
    else
      # add this module to list & counter
      let COUNT++ || true
      LIST="$LIST,$MODULE"
      db_set shared/apache-modules/counters/install "$COUNT"
      db_set shared/apache-modules/counters/install_list "$LIST"
    fi
    ;;
    
  upgrade | abort-upgrade)
    db_get shared/apache-modules/counters/upgrade
    COUNT="$RET"
    db_get shared/apache-modules/counters/upgrade_list
    LIST="$RET"
    if [ "$COUNT" -eq 0 ]
    then
      # no modules were upgraded so far, so we need to ask for reload
      for ap in '' -ssl -perl
      do
	if [ -x /usr/sbin/apache$ap ]
	then
	  db_fset shared/apache-modules/reload$ap seen false
	  db_input medium shared/apache-modules/reload$ap || true
	  db_go
	fi
      done
    fi
    if echo $LIST | sed -e 's/,/,\n/g' | egrep -q "^$MODULE,?$"
    then
      # already added, nothing to do
      :
    else
      # add this module to list & counter
      let COUNT++ || true
      LIST="$LIST,$MODULE"
      db_set shared/apache-modules/counters/upgrade "$COUNT"
      db_set shared/apache-modules/counters/upgrade_list "$LIST"
    fi
    ;;
  
  *)
    echo "$0: didn't understand being called with \`$1'" >&2
    exit 1
    ;;
esac

#DEBHELPER#

exit 0