postinst is in chillispot 1.0-10.1.
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 | #!/bin/sh
# Postinst file based on debconf and ucf help
# Rudy Godoy <rudy@kernel-panik.org>, 2006
set -e
# config file
CONFIGFILE=/etc/chilli.conf
# upstream config file
TEMPCONFIG=$(mktemp -t chilli.conf.XXXXXX)
# Source debconf library
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
# unpack upstream config
zcat /usr/share/doc/chillispot/chilli.conf.gz > $TEMPCONFIG
# Get configuration data
db_get chillispot/config
if [ "$RET" = false ]; then
echo "NOTE:"
echo "You have choosed to edit configuration by hand.";
echo "A default configuration will be available on '/etc/chilli.conf'";
if [ ! -e $CONFIGFILE ]; then
mv $TEMPCONFIG $CONFIGFILE
else
ucf $TEMPCONFIG $CONFIGFILE
fi
else
db_get chillispot/radiusserver1
radius_server_1=$RET
db_get chillispot/radiusserver2
radius_server_2=$RET
db_get chillispot/radiussecret
radius_secret=$RET
db_get chillispot/dhcpif
dhcp_if=$RET
db_get chillispot/uamserver
uam_server=$RET
# safe escape for substitution
uam_server=`echo $uam_server | sed 's|\/|\\\/|g'`
db_get chillispot/uamhomepage
uam_homepage=$RET
# safe escape for substitution
uam_homepage=`echo $uam_homepage | sed 's|\/|\\\/|g'`
db_get chillispot/uamsecret
uam_secret=$RET
db_stop
# Substitute and write the new configfile
tempfile=`tempfile`
sed -r -e "s/^(#)?radiusserver1.*/radiusserver1\ $radius_server_1/" \
-e "s/^(#)?radiusserver2.*/radiusserver2\ $radius_server_2/" \
-e "s/^(#)?radiussecret.*/radiussecret\ $radius_secret/" \
-e "s/^(#)?dhcpif.*/dhcpif\ $dhcp_if/" \
-e "s/^(#)?uamserver.*/uamserver\ $uam_server/" \
-e "s/^(#)?uamhomepage.*/uamhomepage\ $uam_homepage/" \
-e "s/^(#)?uamsecret.*/uamsecret\ $uam_secret/" \
< $TEMPCONFIG > $tempfile
if [ ! -e $CONFIGFILE ]; then
mv $tempfile $CONFIGFILE
else
ucf $tempfile $CONFIGFILE
fi
db_stop
fi
# ucf registration
ucfr chillispot $CONFIGFILE
# cleaning
rm -f $tempfile $TEMPCONFIG
echo "Make sure you've configured a radius server and UAM server before enabling Chillispot."
# Automatically added by dh_installinit
if [ -x "/etc/init.d/chillispot" ]; then
update-rc.d chillispot defaults >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d chillispot start || exit $?
else
/etc/init.d/chillispot start || exit $?
fi
fi
# End automatically added section
|