File: postinst

package info (click to toggle)
geoip-database-contrib 1.19
  • links: PTS, VCS
  • area: contrib
  • in suites: stretch
  • size: 152 kB
  • sloc: sh: 155; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 1,305 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
#!/bin/sh
# postinst script for geoip-database-contrib

set -e

case "$1" in
    configure)

        . /usr/share/debconf/confmodule

        update-geoip-database || echo "Failed to download some files. Run update-geoip-database manually to fix it."

        db_get geoip-database-contrib/install-cronjob
        INSTALL_CRONJOB="$RET"

        tfile=$(mktemp -t geoip-database-contrib_config.XXXXXXXX) || exit 1
        if [ "$INSTALL_CRONJOB" = "true" ]
        then
            cat > $tfile <<EOF
#
# Regular cron job for the geoip-database-contrib package,
# used to update the GeoLite database.
#
0 4 10 * *      root    [ -x /usr/sbin/update-geoip-database ] && /usr/sbin/update-geoip-database > /dev/null
EOF
        else
            cat > $tfile <<EOF
#
# Regular cron job for the geoip-database-contrib package,
# used to update the GeoLite database.
#
#0 4 10 * *      root    [ -x /usr/sbin/update-geoip-database ] && /usr/sbin/update-geoip-database > /dev/null
EOF
        fi

        mkdir -p /etc/cron.d
        ucf --debconf-ok $tfile /etc/cron.d/geoip-database-contrib
        rm $tfile
		chmod 0644 /etc/cron.d/geoip-database-contrib

        update-alternatives --install /usr/share/GeoIP/GeoIPCity.dat GeoIPCity.dat /usr/share/GeoIP/GeoLiteCity.dat 50
    ;;
esac

#DEBHELPER#

exit 0