postinst is in micro-httpd 20051212-13.
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 | #!/bin/sh
set -e
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
PACKAGE=$(basename $0 | sed 's/\..*//')
WWWDIR=/var/www
conf=/etc/inetd.conf
pkgdir=/usr/share/$PACKAGE
port="www"
entry="$port\tstream\ttcp\tnowait nobody:www-data\t/usr/sbin/tcpd /usr/sbin/$PACKAGE $WWWDIR"
Debhelper ()
{
:
}
Which ()
{
which "$1" > /dev/null 2>&1
}
Warn ()
{
echo "$*" >&2
}
IsInetd ()
{
[ -x /usr/sbin/update-inetd ]
}
IsInetdConf ()
{
[ -f $conf ]
}
IsInInetd ()
{
[ -f $conf ] || return 10
# Debian may have inetd.conf entry already
grep -q "^[[:space:]]*$port.*$PACKAGE" $conf ||
# check for other PORT alias name as well
grep -q "^[[:space:]]*(http|80)[[:space:]].*$PACKAGE" $conf
}
IsConflictInetd ()
{
# Check if some other service already uses PORT
grep -q "^[[:space:]#]*$port" $conf
}
HttpdWarning ()
{
# There isn't much point of inetd if apache already installed and
# occupies port 80
if ls /etc/init.d/apache* > /dev/null 2>&1 ; then
Warn "$0: [WARN] Apache found. $PACKAGE $conf uses port '$port'" \
"which may be same as in Apache (you may need to change $PACKAGE port)"
fi
}
InetdName ()
{
local name=
if [ -f /etc/init.d/inetutils-inetd ]; then
name=inetutils-inetd
elif [ -f /etc/init.d/openbsd-inetd ]; then
name="openbsd-inetd"
elif [ -f /etc/init.d/rlinetd ]; then
name="rlinetd"
fi
[ ! "$name" ] || echo $name
}
CallInetd ()
{
local name=$1
local cmd=$2
[ "$cmd" ] || return 0
if Which invoke-rc.d ; then
invoke-rc.d $name $cmd
else
/etc/init.d/$name $cmd
fi
}
InstallInetd ()
{
Warn "$0: adding new $conf entry"
update-inetd --group STANDARD --add "$entry"
# This directory must be there
[ ! -d $WWWDIR ] && mkdir -p $WWWDIR
local name=$(InetdName)
CallInetd $name reload
}
MainInetd ()
{
if [ "$1" = "install" ] || [ "$1" = "configure" ]
then
if IsConflictInetd ; then
Warn "$PACKAGE: [WARNING] Not installing to $conf" \
"due to existing '$port' entry"
else
IsInInetd || InstallInetd
HttpdWarning
fi
fi
}
Main ()
{
if IsInetd ; then
MainInetd "$@"
fi
Debhelper
}
Main "$@"
# End of file
|