postinst is in isdnlog 1:3.25+dfsg1-3.7ubuntu1.
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #! /bin/sh
# postinst script for isdnlog
set -e
. /usr/share/debconf/confmodule
dowhat="$1"
case "$dowhat" in
configure)
db_get isdnlog/countryprefix || true; countryprefix=$RET
db_get isdnlog/countrycode || true; countrycode=$RET
db_get isdnlog/areaprefix || true; areaprefix=$RET
db_get isdnlog/areacode || true; areacode=$RET
db_get isdnlog/isdnrate-daemon || true; isdnrate_daemon=$RET
db_get isdnlog/country || true; country=$RET
if [ "$country" = other ]; then
if db_get isdnlog/country_manual; then
country=$RET
else
country=DE # cant happen
fi
fi
country=`echo $country | tr '[A-Z]' '[a-z]'`
if [ "$country" = other ]; then
country=default
fi
defdir=/usr/share/isdn/default
conffile=/etc/isdn/isdn.conf
tempfile=$(mktemp -t isdnutils.XXXXXX)
trap 'rm -f "$tempfile"' EXIT
chmod uog+r "$tempfile"
for cfg in isdn.conf rate.conf; do
# the sed call further down only affects isdn.conf
if [ -e $defdir/$cfg.$country ]; then
cat $defdir/$cfg.$country
elif [ -e $defdir/$cfg.$country.gz ]; then
gzip -dc $defdir/$cfg.$country.gz
elif [ -e $defdir/$cfg.default ]; then
cat $defdir/$cfg.default
elif [ -e $defdir/$cfg.default.gz ]; then
gzip -dc $defdir/$cfg.default.gz
elif [ -e $defdir/$cfg ]; then
cat $defdir/$cfg
elif [ -e $defdir/$cfg.gz ]; then
gzip -dc $defdir/$cfg.gz
else
echo "Warning: no suitable $cfg file found, proceeding with an empty one." >&2
fi | sed \
-e "/^[[:space:]]*COUNTRYPREFIX[[:space:]]*=/ c COUNTRYPREFIX = $countryprefix" \
-e "/^[[:space:]]*COUNTRYCODE[[:space:]]*=/ c COUNTRYCODE = $countrycode" \
-e "/^[[:space:]]*AREAPREFIX[[:space:]]*=/ c AREAPREFIX = $areaprefix" \
-e "/^[[:space:]]*AREACODE[[:space:]]*=/ c AREACODE = $areacode" \
> "$tempfile"
ucf --three-way --debconf-ok "$tempfile" /etc/isdn/$cfg
ucfr isdnlog /etc/isdn/$cfg
done
sed '/REMOVE the next line/,/REMOVE the above/d' < /usr/share/isdn/default/isdnlog.DEVICE > "$tempfile"
ucf --three-way --debconf-ok "$tempfile" /etc/isdn/isdnlog.isdnctrl0
ucfr isdnlog /etc/isdn/isdnlog.isdnctrl0
if [ -x /etc/init.d/isdnutils-base ]; then
invoke-rc.d isdnutils-base start isdnlog
fi
conffile=/etc/isdn/isdnrate.conf
daemon=false
socket=/var/run/isdnrate/socket
if [ -s $conffile ]; then
set +e
. $conffile
set -e
else
md5sum=dummyvalue
( echo "# isdnrate configuration"
echo ""
echo "# This file is sourced into a Bourne shell."
echo ""
) > "$tempfile"
ucf --three-way --debconf-ok "$tempfile" $conffile
ucfr isdnlog $conffile
fi
if [ "x$isdnrate_daemon" = "xyes" ]; then
daemon=true
else
daemon=false
fi
cp -f $conffile "$tempfile"
for var in socket daemon; do
grep -e "^[[:space:]]*$var[[:space:]]*=" "$tempfile" || echo "$var=defaults" >> "$tempfile"
done >/dev/null 2>&1
sed -i \
-e "/^[[:space:]]*daemon[[:space:]]*=/ c daemon=$daemon" \
-e "/^[[:space:]]*socket[[:space:]]*=/ c socket=$socket" \
"$tempfile"
ucf --three-way --debconf-ok "$tempfile" $conffile
ucfr isdnlog $conffile
if [ -x /etc/init.d/isdnutils-base ]; then
invoke-rc.d isdnutils-base reload isdnlog
fi
rm -f "$tempfile"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$dowhat'" >&2
exit 0
;;
esac
db_stop
exit 0
|