source: trunk/debathena/debathena/verify/debian/debathena-verify.postinst @ 25637

Revision 25637, 1.6 KB checked in by jdreed, 12 years ago (diff)
In verify: * Initial release.
Line 
1#!/bin/sh
2# postinst script for debathena-verify
3#
4# see: dh_installdeb(1)
5
6set -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
20desync2cron() {
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
33CRONFILE=/etc/cron.d/verify_ws
34
35case "$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    ;;
56esac
57
58# dh_installdeb will replace this with shell code automatically
59# generated by other debhelper scripts.
60
61#DEBHELPER#
62
63exit 0
Note: See TracBrowser for help on using the repository browser.