Debian Codegraph @

debian/debsecan.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 . /usr/share/debconf/confmodule
6
7 case "$1" in
8 configure)
9 # If the directory is owned by root, change ownership. This
10 # happens for fresh installations, and re-installations after
11 # removal (and purge, of course).
12 find /var/lib/debsecan -maxdepth 0 -user root | while read dir ; do
13 chown daemon:daemon "$dir"
14 done
15
16 if ! test -e /etc/default/debsecan ; then
17 cat > /etc/default/debsecan <<EOF
18 # Configuration file for debsecan. Contents of this file should
19 # adhere to the KEY=VALUE shell syntax. This file may be edited by
20 # debsecan's scripts, but your modifications are preserved.
21
22 # If true, enable daily reports, sent by email.
23 REPORT=true
24
25 # For better reporting, specify the correct suite here, using the code
26 # name (that is, "sid" instead of "unstable").
27 SUITE=GENERIC
28
29 # Mail address to which reports are sent.
30 MAILTO=root
31
32 # The URL from which vulnerability data is downloaded. Empty for the
33 # built-in default.
34 SOURCE=
35 EOF
36 fi
37
38 for var in REPORT SUITE MAILTO SOURCE ; do
39 v=$(db_get debsecan/$(echo $var | tr A-Z a-z); printf "%s" "$RET")
40 if ! test -z "$v" ; then
41 echo "$var=\"$v\""
42 fi
43 done | debsecan --update-config
44
45 # Create the crontab entry if it does not exist, and reporting
46 # has been enabled. (If reporting is later disabled, debsecan
47 # will detected this internally, so there is no need to remove
48 # the crontab entry in that case.)
49 db_get debsecan/report
50 if test "$RET" = 'true' -a ! -r /etc/cron.d/debsecan ; then
51 debsecan-create-cron
52 fi
53
54 ;;
55 esac
56
57 #DEBHELPER#