postinst is in atftpd 0.7.git20120829-3.
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | #!/bin/sh -e
#
# TODO:
# - error checking on values provided by debconf frontend
BASEDIR=/srv/tftp
DAEMON="--daemon"
. /usr/share/debconf/confmodule
db_version 2.0
# Do not ask if we want to configure it
#db_get atftpd/configure
#if [ "$RET" = "true" ]; then
db_get atftpd/use_inetd
if [ "$RET" ]; then
if [ "$RET" = "true" ]; then
USE_INETD=true
else
USE_INETD=false
fi
else
USE_INETD=true
fi
db_get atftpd/port
if [ "$RET" ]; then
TFTPD_PORT="--port $RET"
fi
db_get atftpd/tftpd-timeout
if [ "$RET" ]; then
TFTPD_TIMEOUT="--tftpd-timeout $RET"
fi
db_get atftpd/retry-timeout
if [ "$RET" ]; then
RETRY_TIMEOUT="--retry-timeout $RET"
fi
db_get atftpd/maxthread
if [ "$RET" ]; then
MAXTHREAD="--maxthread $RET"
fi
db_get atftpd/timeout
if [ "$RET" != "true" ]; then
NOTIMEOUT="--no-timeout"
fi
db_get atftpd/tsize
if [ "$RET" != "true" ]; then
NOTSIZE="--no-tsize"
fi
db_get atftpd/blksize
if [ "$RET" != "true" ]; then
NOBLKSIZE="--no-blksize"
fi
db_get atftpd/multicast
if [ "$RET" != "true" ]; then
NOMCAST="--no-multicast"
else
db_get atftpd/mcast_port
if [ "$RET" ]; then
MCASTPORT="--mcast-port $RET"
fi
db_get atftpd/mcast_addr
if [ "$RET" ]; then
MCASTADDR="--mcast-addr $RET"
fi
db_get atftpd/ttl
if [ "$RET" ]; then
MCASTTTL="--mcast-ttl $RET"
fi
fi
db_get atftpd/verbosity
if [ "$RET" ]; then
RET=`echo $RET | cut -f1 -d ' '`
VERBOSITY="--verbose=$RET"
fi
db_get atftpd/logtofile
if [ "$RET" = "true" ]; then
db_get atftpd/logfile
if [ "$RET" ]; then
LOGFILE="--logfile $RET"
# if the file doesn't exist, create it
if [ ! -f $RET ]; then
touch $RET
chown nobody:nogroup $RET
chmod 640 $RET
fi
# create the logrotate file
if [ ! -f /etc/logrotate.d/atftpd ] ; then
cat >/etc/logrotate.d/atftpd <<EOF
$RET {
daily
rotate 5
compress
copytruncate
missingok
}
EOF
fi
fi
else
LOGFILE=""
# remove the logrotate file
rm -f /etc/logrotate.d/atftpd
fi
db_get atftpd/basedir
if [ "$RET" ]; then
BASEDIR="$RET"
if [ ! -d $BASEDIR ]; then
mkdir $BASEDIR
chown nobody $BASEDIR
fi
fi
#fi
# Make sure atftpd is stoped. Needed for dpkg-reconfigure.
if [ -e "/etc/init.d/atftpd" ]; then
/etc/init.d/atftpd stop
fi
if [ "$USE_INETD" = "false" ]; then
if [ ! -f /etc/default/atftpd ]; then
echo "USE_INETD=false" > /etc/default/atftpd
echo "# OPTIONS below are used only with init script" >> /etc/default/atftpd
echo "OPTIONS=\"$DAEMON $TFTPD_PORT $RETRY_TIMEOUT $NOTIMEOUT $NOTSIZE $NOBLKSIZE $NOMCAST \
$MCASTPORT $MCASTADDR $MCASTTTL $MAXTHREAD $VERBOSITY $LOGFILE $BASEDIR\""|tr -s " " >> /etc/default/atftpd
fi
update-inetd --disable tftp
else
INETOPTS=`echo "$TFTPD_TIMEOUT $RETRY_TIMEOUT $NOTIMEOUT $NOTSIZE $NOBLKSIZE $NOMCAST $MCASTPORT $MCASTADDR $MCASTTTL $MAXTHREAD $VERBOSITY $LOGFILE $BASEDIR"|tr -s " "`
update-inetd --group BOOT --add "tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd $INETOPTS"
if [ ! -f /etc/default/atftpd ]; then
echo "USE_INETD=true" > /etc/default/atftpd
echo "# OPTIONS below are used only with init script" >> /etc/default/atftpd
echo "OPTIONS=\"$INETOPTS\""|tr -s " " >> /etc/default/atftpd
fi
fi
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/atftpd" ]; then
update-rc.d atftpd defaults >/dev/null
invoke-rc.d atftpd start || exit $?
fi
fi
# End automatically added section
# tell debconf we are done. otherwise, it hangs waiting for the daemon.
db_stop;
exit 0;
|