File: preinst

package info (click to toggle)
sysvinit 2.84-2woody1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 652 kB
  • ctags: 463
  • sloc: ansic: 5,282; sh: 1,193; perl: 158; makefile: 156
file content (85 lines) | stat: -rw-r--r-- 1,914 bytes parent folder | download | duplicates (4)
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
#! /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

# First see if we have a new enough version of dpkg.
dpkg --assert-support-predepends >/dev/null 2>&1
if [ $? != 0 ]
then
	cat <<EOF
Your dpkg version does not support the "Pre-depends" field. Upgrade your
version of dpkg first (to 1.1.0 or later) and reinstall.
EOF
	exit 1
fi


#
#	Save /etc/init.d/network if needed. This file has been removed from
#	sysvinit but we don't want it to be _actually_ removed.
#
#	(For compat with sysvinit <= 2.66, Debian 1.1)
#
if [ -f /etc/init.d/network ]
then
	cp -a /etc/init.d/network /etc/init.d/network.saved
fi
#	Inittab - same story.
if [ -f /etc/inittab ]
then
	cp -a /etc/inittab /etc/inittab.saved
fi

#
#	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