File debian.postinst of Package tinyproxy

#!/bin/sh
# postinst script for netpolicetiny
#
# see: dh_installdeb(1)

set -e

# Move a conffile without triggering a dpkg question
mv_conffile() {
    local OLDCONFFILE="$1"
    local NEWCONFFILE="$2"

    [ -e "$OLDCONFFILE" ] || return 0

    echo "Preserving user changes to $NEWCONFFILE ..."
    mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
    mv -f "$OLDCONFFILE" "$NEWCONFFILE"
    rmdir --ignore-fail-on-non-empty /etc/netpolicetiny
}

case "$1" in
configure)
    if dpkg --compare-versions "$2" le "1.6.3-3.3"; then
        mv_conffile "/etc/netpolicetiny/netpolicetiny.conf" "/etc/netpolicetiny.conf"
    fi
esac

###
# Insert iptables into init script
##

IPT=`whereis iptables| awk '{ print $2 }'`
#sed -i "s@IPT=@IPT=${IPT}@" "/etc/init.d/netpolicetiny"
sed -i "s@IPT=[A-Za-z\/.]*@IPT=${IPT}@" "/etc/init.d/netpolicetiny"

##
# Insert allow network address in conffile
##

ADD=`ifconfig |grep "inet addr:"|awk '{ print $2 }'| cut -d ':' -f 2`

for x in $ADD
do
    echo "Allow $x" >> "/etc/netpolicetiny.conf"
done

#DEBHELPER#
openSUSE Build Service is sponsored by