#!/bin/sh # postinst script for lliurex-guard-standalone # # see: dh_installdeb(1) set -e PACKAGE_NAME="lliurex-guard-standalone" # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package #TEMPLATE_PATH="/etc/lliurex-guard-standalone/templates" #SQUID_PATH="/etc/squid3/lliurex" case "$1" in configure) n4d-modules enable-plugin /etc/n4d/conf.d/N4dGuard || true # Creating Defualt configuration # "$(ls -A ${SQUID_PATH})" ] && : || cp $TEMPLATE_PATH/allow_all/* $SQUID_PATH # Diverting squid.conf #RIGINAL_FILE="/etc/squid3/squid.conf" #EW_FILE="/etc/squid3/squid.conf.diverted" #LIUREX_FILE="/etc/squid3/squid.conf.lliurex" #pkg-divert --package $PACKAGE_NAME --rename --quiet --add --divert $NEW_FILE $ORIGINAL_FILE #p -a "$LLIUREX_FILE" "$ORIGINAL_FILE" [ -e /etc/squid3/lliurex/llx-guard-dst-domains.conf ] || touch /etc/squid3/lliurex/llx-guard-dst-domains.conf cat /etc/lliurex-guard-standalone/templates/squid.conf | sed -e "s/#{LliureXGuardDefaultPolicy}/http_access allow all/" > /etc/squid3/squid.conf # Start iptables if [ `cat /etc/rc.local | grep iptables | wc -l` -eq 0 ]; then sed 's/exit 0/\/etc\/lliurex-guard-standalone\/iptables.conf\n&/' /etc/rc.local > /tmp/rc.local; cp /tmp/rc.local /etc/rc.local; fi chmod +x /etc/lliurex-guard-standalone/iptables.conf /etc/lliurex-guard-standalone/iptables.conf # Setting default template: allow-all: echo '{"running_template":"'allow-all'"}' > /etc/lliurex-guard-standalone/config/running_template # Restart squid invoke-rc.d squid3 restart || true ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0