File: config

package info (click to toggle)
awffull 3.10.2-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,300 kB
  • sloc: ansic: 10,355; sh: 4,587; xml: 2,198; perl: 271; makefile: 40; sed: 16
file content (62 lines) | stat: -rw-r--r-- 1,753 bytes parent folder | download | duplicates (10)
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
#! /bin/sh
# config script for awffull
#
# see: dh_installdeb(1)

set -e

# bogus - though necessary - rule
. /usr/share/debconf/confmodule
db_version 2.0

case "$1" in
    configure|reconfigure)
      conffile="/etc/awffull/awffull.conf"
      OUTPUTDIR=""
      LOGFILE=""

      if [ -f $conffile ]; then
        # parse existing configuration.  This code happily
	# concatenates multiple occurences of a configuration item,
	# but that should never occur <frank@debian.org>.
        OUTPUTDIR=`sed -ne '/^OutputDir/ {s@OutputDir[[:space:]]\([^[:space:]]*\)@\1@;p}' $conffile`
        LOGFILE=`sed -ne '/^LogFile/ {s@LogFile[[:space:]]\([^[:space:]]*\)@\1@;p}' $conffile`
      fi
      # assign default values
      [ -n "$OUTPUTDIR" ] || OUTPUTDIR="/var/www/awffull"

      if [ -z "$LOGFILE" ]; then
        # apache2 found?
	if [ -f /var/log/apache2/access.log.1 ] || [ -f /var/log/apache2/access.log ]; then
	  LOGFILE="/var/log/apache2/access.log.1";
	else
          LOGFILE="/var/log/apache/access.log.1";
        fi
      fi

      # now preseed the debconf questions with what we found
      db_set awffull/directory "$OUTPUTDIR" || true
      db_set awffull/logfile "$LOGFILE" || true

      # Ask for the directory the output should be put in
      db_input medium awffull/directory || true
      db_go

      # Ask for the rotated logfile
      # by default  is access log file of apache, but if I found apache2 log file,
      # I changed default to this one.
      db_input medium awffull/logfile || true
      db_go
    ;;

    *)
        echo "config called with unknown argument \`$1'" >&2;
        exit 1;
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

exit 0