#! /bin/sh
#
# debian.preinst
#		Saves the GMT setting from /etc/init.d/boot.
#		This should really be set from a seperate
#		configfile, like /etc/sysconfig.
#
# Version:	debian.preinst  2.74  16-Mar-1998  miquels@cistron.nl
#

case "$1" in
	install|upgrade)
		;;
	abort-upgrade)
		exit 0
		;;
esac

umask 022

#
#	If there's an /etc/init.d/boot file, extract the variables from
#	it and rename it.
#
#	(Started in 2.72-1, Debian 2.0 unstable)
#
if [ -f /etc/init.d/boot ]
then
	echo "Saving variables from /etc/init.d/boot .."
	[ ! -d /etc/default ] && mkdir /etc/default
	rm -f /etc/default/rcS.sed
	grep '^[A-Z]*=' /etc/init.d/boot | (
		while read line
		do
			var=`echo $line | sed 's/=.*$//'`
			echo "s!^$var=.*\$!$line!" >> /etc/default/rcS.sed
		done
	)
	mv /etc/init.d/boot /etc/init.d/boot.OLD
	cat <<EOF

The file /etc/init.d/boot has been replaced with a collection of smaller files
located in /etc/init.d and linked into /etc/rc.S. The customization variables
are now located in the file /etc/default/rcS.

EOF
fi

#cat <<EOF
#
#  The package manager might ask you if you want to install new versions
#  of the /etc/init.d/whatever files. This is generally a good idea
#  (so reply with \`\`y'') unless you really changed any of these files.
#
#EOF

exit 0
