File: postinst

package info (click to toggle)
isoqlog 2.2.1-9.1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 1,340 kB
  • sloc: ansic: 3,488; sh: 3,174; makefile: 120; perl: 55
file content (96 lines) | stat: -rw-r--r-- 2,666 bytes parent folder | download | duplicates (2)
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
88
89
90
91
92
93
94
95
96
#! /bin/bash
# postinst script for isoqlog
# Murat Demirten <murat@debian.org>

set -e
# Use debconf.
. /usr/share/debconf/confmodule

case "$1" in
    configure)

	db_get isoqlog/main_logtype && logtype="$RET"
	db_get isoqlog/main_outputdir && outputdir="$RET"
	db_get isoqlog/main_hostname && hostname="$RET"
	db_get isoqlog/main_langfile && langfile=$(echo "$RET" | LC_ALL=C tr 'A-Z' 'a-z')
	db_get isoqlog/main_domains && domains="$RET"

	if [ "$logtype" = "sendmail" ]; then
	    logstore="/var/log/mail/mail.log"
	elif [ "$logtype" = "exim" ]; then
	    logstore="/var/log/exim4/mainlog"
	else
	    logstore="/var/log/mail.log"
	fi
	# Now build isoqlog.conf

	TMPFILE=`mktemp /tmp/isoqlog.conf-XXXXXX` || exit 1
	echo "#isoqlog 2.0 Configuration file" >> $TMPFILE 2>&1
	echo "" >> $TMPFILE 2>&1
	echo "logtype     = \"$logtype\"" >> $TMPFILE 2>&1
	echo "logstore    = \"$logstore\"" >> $TMPFILE 2>&1
	echo "domainsfile = \"/etc/isoqlog/isoqlog.domains\"" >> $TMPFILE 2>&1
	echo "outputdir   = \"$outputdir\"" >> $TMPFILE 2>&1
	echo "htmldir     = \"/usr/share/isoqlog/htmltemp\"" >> $TMPFILE 2>&1
	echo "langfile    = \"/usr/share/isoqlog/lang/$langfile\"" >> $TMPFILE 2>&1
	echo "hostname    = \"$hostname\"" >> $TMPFILE 2>&1
	echo "" >> $TMPFILE 2>&1
	echo "maxsender   = 100" >> $TMPFILE 2>&1
	echo "maxreceiver = 100" >> $TMPFILE 2>&1
	echo "maxtotal    = 100" >> $TMPFILE 2>&1
	echo "" >> $TMPFILE 2>&1
	echo "maxbyte     = 100" >> $TMPFILE 2>&1

	mv -f $TMPFILE /etc/isoqlog/isoqlog.conf > /dev/null 2>&1

	TMPFILE=`mktemp /tmp/isoqlog.domains-XXXXXX` || exit 1
	for i in $domains; do
	    echo "$i" >> $TMPFILE 2>&1
	done
	
	mv -f $TMPFILE /etc/isoqlog/isoqlog.domains > /dev/null 2>&1

	## Set cron job
	FILE="/etc/cron.daily/isoqlog"
	echo "#!/bin/sh" > $FILE 2>&1
	echo "# /etc/cron.daily/isoqlog: isoqlog report script" >> $FILE 2>&1 
	echo "" >> $FILE 2>&1
	echo "/usr/bin/isoqlog > /dev/null 2>&1" >> $FILE 2>&1
	## Fix the permissions
	chmod 755 $FILE

	## Copy images and library dirs into output dir
	if ! [ -d $outputdir ]; then
	    mkdir -p $outputdir
	fi
	if ! [ -d $outputdir/images ]; then
	    cp -rf /usr/share/isoqlog/htmltemp/images $outputdir/
	fi
	if ! [ -d $outputdir/library ]; then
	    cp -rf /usr/share/isoqlog/htmltemp/library $outputdir/
	fi
	chmod 755 $outputdir
	chmod 755 $outputdir/images
	chmod 755 $outputdir/library
	
	exit 0
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

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

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

#DEBHELPER#

exit 0