#!/bin/sh -e # create a new /etc/inetd.conf file if it doesn't already exist create_inetd() { [ -e /etc/inetd.conf ] && return 0 cat < /etc/inetd.conf # /etc/inetd.conf: see inetd(8) for further informations. # # Internet superserver configuration database # # # Lines starting with "#:LABEL:" or "##" should not # be changed unless you know what you are doing! # # If you want to disable an entry so it isn't touched during # package updates just comment it out with a single '#' character. # # Packages should modify this file by using update-inetd(8) # # # #:INTERNAL: Internal services #discard stream tcp nowait root internal #discard dgram udp wait root internal #daytime stream tcp nowait root internal #time stream tcp nowait root internal #:STANDARD: These are standard services. #:BSD: Shell, login, exec and talk are BSD protocols. #:MAIL: Mail, news and uucp services. #:INFO: Info services #:BOOT: TFTP service is provided primarily for booting. Most sites # run this only on machines acting as "boot servers." #:RPC: RPC based services #:HAM-RADIO: amateur-radio services #:OTHER: Other services EOF chmod 644 /etc/inetd.conf } upgrade_from_old_inetd() { if [ "$2" ] && dpkg --compare-versions "$2" ge 0.20040915-1; then return 0 fi # XXX the binary will change after removing the diversions, so we want # to be sure that the daemon has been stopped by that time start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid # remove the diversions created by old versions of this package DIVERT="/usr/sbin/inetd /usr/share/man/man8/inetd.8.gz /usr/share/man/man5/inetd.conf.5.gz" for file in $DIVERT; do [ -e $file.netkit ] || continue rm -f $file dpkg-divert --package openbsd-inetd --remove --divert $file.netkit $file done } upgrade_from_netkit_inetd() { if [ -e /etc/cron.daily/netkit-inetd ]; then rm -f /etc/cron.daily/netkit-inetd fi if [ -e /etc/init.d/inetd ]; then rm -f /etc/init.d/inetd /etc/rc[2345].d/S20inetd fi # be sure to kill the netkit-inetd daemon, which may still be active if # the moon is wrongly aligned if [ -e /var/run/inetd.pid ]; then start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/inetd.pid fi } case "$1" in install) create_inetd upgrade_from_netkit_inetd ;; upgrade|abort-upgrade) upgrade_from_old_inetd "$@" ;; *) echo "$0 called with unknown argument '$1'" >&2 exit 1 ;; esac