1 | #!/bin/sh |
---|
2 | # postinst script for debathena-verify |
---|
3 | # |
---|
4 | # see: dh_installdeb(1) |
---|
5 | |
---|
6 | set -e |
---|
7 | |
---|
8 | # summary of how this script can be called: |
---|
9 | # * <postinst> `configure' <most-recently-configured-version> |
---|
10 | # * <old-postinst> `abort-upgrade' <new version> |
---|
11 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
---|
12 | # <new-version> |
---|
13 | # * <postinst> `abort-remove' |
---|
14 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
---|
15 | # <failed-install-package> <version> `removing' |
---|
16 | # <conflicting-package> <version> |
---|
17 | # for details, see http://www.debian.org/doc/debian-policy/ or |
---|
18 | # the debian-policy package |
---|
19 | |
---|
20 | desync2cron() { |
---|
21 | hour=$1 |
---|
22 | interval=$2 |
---|
23 | shift 2 |
---|
24 | desync=`desync -n $interval` |
---|
25 | mins=`echo $desync % 60 | bc` |
---|
26 | hours=`echo "$hour + ($desync / 60)" | bc` |
---|
27 | if [ $hours -ge 24 ]; then |
---|
28 | hours=`echo $hours - 24 | bc` |
---|
29 | fi |
---|
30 | echo "$mins $hours * * * $*" |
---|
31 | } |
---|
32 | |
---|
33 | CRONFILE=/etc/cron.d/verify_ws |
---|
34 | |
---|
35 | case "$1" in |
---|
36 | configure) |
---|
37 | if [ ! -f /var/lib/verify_ws-status ]; then |
---|
38 | echo "$(date +"%s")|ok|Package configured" > /var/lib/verify_ws-status |
---|
39 | fi |
---|
40 | |
---|
41 | rm -f $CRONFILE |
---|
42 | |
---|
43 | echo "# Automatically generated by debathena-verify postinst" > $CRONFILE |
---|
44 | echo "SHELL=/bin/sh" >> $CRONFILE |
---|
45 | echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> $CRONFILE |
---|
46 | desync2cron 3 120 root /usr/sbin/verify_ws >> $CRONFILE |
---|
47 | ;; |
---|
48 | |
---|
49 | abort-upgrade|abort-remove|abort-deconfigure) |
---|
50 | ;; |
---|
51 | |
---|
52 | *) |
---|
53 | echo "postinst called with unknown argument \`$1'" >&2 |
---|
54 | exit 1 |
---|
55 | ;; |
---|
56 | esac |
---|
57 | |
---|
58 | # dh_installdeb will replace this with shell code automatically |
---|
59 | # generated by other debhelper scripts. |
---|
60 | |
---|
61 | #DEBHELPER# |
---|
62 | |
---|
63 | exit 0 |
---|