This file is indexed.

postinst is in squidguard 1.5-2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
#!/bin/sh
# postinst script for squidguard
#
# see: dh_installdeb(1)

set -e

DEFCONF="/etc/default/squidguard"
CONFDIR="/etc/squidguard"
CONFOLD="/etc/squid"
CONFFILE=squidGuard.conf
LOGDIR="/var/log/squidguard"
LOGOLD="/var/log/squid"
LOGFILE=squidGuard.log

. /usr/share/debconf/confmodule

db_get squidguard/dbreload
echo "DBRELOAD=\"$RET\"" > ${DEFCONF}
db_stop

if [ -f "$DEFCONF" ]; then
    . "$DEFCONF"
fi

case "$1" in
    configure)
        # create or move to new config directory (default)
        test ! -d ${CONFDIR} && install -d -m755 ${CONFDIR}

        if [ ! -f ${CONFDIR}/${CONFFILE} ]; then
            if [ -f ${CONFOLD}/${CONFFILE} ]; then
                echo "Move directory ${CONFOLD} to new directory ${CONFDIR}." >&2
                mv ${CONFOLD}/squidGuard* ${CONFDIR}
                rmdir --ignore-fail-on-non-empty ${CONFOLD} 2>/dev/null || true
            else
                echo "Starting with new config file ${CONFDIR}/${CONFFILE}."  >&2
                cp ${CONFDIR}/${CONFFILE}.default ${CONFDIR}/${CONFFILE}
            fi
            chown proxy:proxy ${CONFDIR}/${CONFFILE} ${CONFDIR}/${CONFFILE}.default
            chmod 0640 ${CONFDIR}/${CONFFILE} ${CONFDIR}/${CONFFILE}.default
        fi
        if [ $(grep -c "$LOGDIR" ${CONFDIR}/${CONFFILE}) -eq 0 ]; then
            echo "Move log file directory to new directory ${LOGDIR}."  >&2
            cp -p ${CONFDIR}/${CONFFILE} ${CONFDIR}/${CONFFILE}_old
            sed -i "s?${LOGOLD}?${LOGDIR}?" ${CONFDIR}/${CONFFILE}
        fi

        # create or move to new log directory (default)
        test ! -d ${LOGDIR} && install -d -oproxy -gproxy -m750 ${LOGDIR}

        if [ ! -f ${LOGDIR}/${LOGFILE} ]; then
            if [ -f ${LOGOLD}/${LOGFILE} ]; then
                mv ${LOGOLD}/squidGuard* ${LOGDIR}
                rmdir --ignore-fail-on-non-empty ${LOGOLD} 2>/dev/null || true
            else
                touch ${LOGDIR}/${LOGFILE}
            fi
            chown proxy:proxy ${LOGDIR}/${LOGFILE}
            chmod 0640 ${LOGDIR}/${LOGFILE}
        fi

        SQUIDCONF=/etc/squid/squid.conf
        if [ -f ${SQUIDCONF} ]; then
          if [ $(grep -c "squid/squidGuard" ${SQUIDCONF}) -gt 0 ]; then
            echo "Update redirector configuration in ${SQUIDCONF}."  >&2
            sed -i_old 's?squid/squidGuard?squidguard/squidGuard?g' ${SQUIDCONF}
            if [ $(diff ${SQUIDCONF}_old ${SQUIDCONF} | wc -l) -lt 8 ]
            then rm -f ${SQUIDCONF}_old; fi
          fi
        fi
        SQUIDCONF=/etc/squid3/squid.conf
        if [ -f ${SQUIDCONF} ]; then
          if [ $(grep -c "squid/squidGuard" ${SQUIDCONF}) -gt 0 ]; then
            echo "Update redirector configuration in ${SQUIDCONF}."  >&2
            sed -i_old 's?squid/squidGuard?squidguard/squidGuard?g' ${SQUIDCONF}
            if [ $(diff ${SQUIDCONF}_old ${SQUIDCONF} | wc -l) -lt 8 ]
            then rm -f ${SQUIDCONF}_old; fi
          fi
        fi

        if [ "$DBRELOAD" = "true" ]; then
            # rebuild database only if BDB version has changed
            update-squidguard --checkdb
        else
            echo "/usr/sbin/update-squidguard does not run automatically."  >&2
            echo "Check default settings for squidguard to change this behaviour."  >&2
        fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 0
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0