File: debsecan.postinst

package info (click to toggle)
debsecan 0.4.20.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 832 kB
  • sloc: python: 1,184; sh: 255; makefile: 19
file content (57 lines) | stat: -rw-r--r-- 1,550 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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

case "$1" in
    configure)
	# If the directory is owned by root, change ownership.  This
	# happens for fresh installations, and re-installations after
	# removal (and purge, of course).
	find /var/lib/debsecan -maxdepth 0 -user root | while read dir ; do
	    chown daemon:daemon "$dir"
	done

	if ! test -e /etc/default/debsecan ; then
cat > /etc/default/debsecan <<EOF
# Configuration file for debsecan.  Contents of this file should
# adhere to the KEY=VALUE shell syntax.  This file may be edited by
# debsecan's scripts, but your modifications are preserved.

# If true, enable daily reports, sent by email.
REPORT=true

# For better reporting, specify the correct suite here, using the code
# name (that is, "sid" instead of "unstable").
SUITE=GENERIC

# Mail address to which reports are sent.
MAILTO=root

# The URL from which vulnerability data is downloaded.  Empty for the
# built-in default.
SOURCE=
EOF
	fi

	for var in REPORT SUITE MAILTO SOURCE ; do
	    v=$(db_get debsecan/$(echo $var | tr A-Z a-z); printf "%s" "$RET")
	    if ! test -z "$v" ; then
		echo "$var=\"$v\""
	    fi
	done | debsecan --update-config

	# Create the crontab entry if it does not exist, and reporting
	# has been enabled.  (If reporting is later disabled, debsecan
	# will detected this internally, so there is no need to remove
	# the crontab entry in that case.)
	db_get debsecan/report
	if test "$RET" = 'true' -a ! -r /etc/cron.d/debsecan ; then
	    debsecan-create-cron
	fi

	;;
esac

#DEBHELPER#