postinstall script and debconf configuration
On somehow i can't get this to work. And i don't know why it won't work:
#! /bin/sh
set -e
. /usr/share/debconf/confmodule
PDNSCONF=/etc/powerdns/pdns.conf
config () {
# pdns/masterslave = string
db_get pdns/masterslave
MASTER=$RET
# pdns/lazy_recursion = boolean
db_get pdns/lazy_recursion || RET="true"
LAZY=$RET
# pdns/localaddress = string
db_get pdns/localaddress
ADDR=$RET
# pdns/autostart = boolean
db_get pdns/autostart || RET="false"
START=$RET
# pdns/chroot = boolean
db_get pdns/chroot || RET="false"
CHROOT=$RET
# pdns/axfr = boolean
db_get pdns/axfr || RET="false"
AXFR=$RET
# pdns/localport = string
db_get pdns/localport
PORT=$RET
}
case "$1" in
configure)
if [ "$2" = "" ]; then
if [ -f $PDNSCONF ]; then
cp $PDNSCONF $PDNSCONF.backup
fi
if [ "$MASTER" != "nothing" ]; then
echo master;
sed -i -e "s/^\(#\)\?\(# \)\?$MASTER=$/$MASTER=yes/" $PDNSCONF
fi
if [ "$LAZY" = "true" ]; then
echo lazy
sed -i -e "s/^\(#\)\?\(# \)\?lazy-recursion=
$/lazy-recursion=yes/" $PDNSCONF
fi
if [ ! -z $ADDR ]; then
echo localaddress
sed -i -e "s/^\(#\)\?\(# \)\?local-address=$/local-address=
$ADDR/" $PDNSCONF
fi
if [ "$CHROOT" = "false" ]; then
echo falsechroot
sed -i -e "s/^chroot=/# chroot=/" $PDNSCONF
fi
if [ "$AXFR" = "true" ]; then
echo axfr
sed -i -e "s/^disable-axfr=.*$/disable-axfr=no/" $PDNSCONF
fi
if [ ! -z $PORT ]; then
if [ $PORT -ne 53 ]; then
echo port
sed -i -e "s/^\(#\)?\(# \)?local-port=$/local-port=$PORT/"
$PDNSCONF
fi
fi
if [ db_get pdns/autostart ]; then
echo start
sed -i -e "s/^START=.*$/START=\"yes\"/" /etc/default/pdns
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
If someone can point me out what i'm doing wrong ? The checks are always
true or always false. I think i do something wrong in the db_get
commands but i don't know what.
Reply to: