67
62
while [ "$1" != "." ]
70
ln -s ../init.d/$base $tlet$lev$base
65
ln -sf ../init.d/$base $tlet$lev$base
73
if [ -r /proc/1/root ]; then
80
# Initialize rcS default file.
77
82
if [ ! -f /etc/default/rcS ]
80
# Install sample rcS file.
82
cp /usr/share/initscripts/default.rcS /etc/default/rcS
85
# Change GMT=-u to UTC=yes etc in existing rcS file.
87
if grep -q ^GMT /etc/default/rcS
89
cp /etc/default/rcS /etc/default/rcS.TMP
90
sed -e "s/^GMT=.*\(-u\|--utc\).*/UTC=yes/" \
91
-e "s/^GMT=.*/UTC=no/" \
92
-e 's/# Set GMT="-u".*/# Set UTC to yes or no/' \
93
< /etc/default/rcS.TMP > /etc/default/rcS
94
if [ -s /etc/default/rcS ]
96
rm -f /etc/default/rcS.TMP
84
cp -p /usr/share/initscripts/default.rcS /etc/default/rcS
88
# In 2.86.ds1-7 the "single" script was moved.
89
# We have to remove the old links _before_ we install new ones.
91
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7"
93
update-rc.d -f single remove >/dev/null 2>&1 || :
96
# In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved.
97
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
99
update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
100
update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
103
# In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35
105
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35"
107
update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
111
# Okay, we could do this with update-rc.d, but that would probably
112
# be pretty slow. This way we win some speed.
113
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
115
# Links in runlevel S
117
updatercd mountkernfs.sh start 2 S .
118
updatercd hostname.sh start 2 S .
119
updatercd mountdevsubfs.sh start 4 S .
120
updatercd bootlogd start 5 S .
121
updatercd checkroot.sh start 10 S .
122
updatercd mtab.sh start 12 S .
123
updatercd checkfs.sh start 30 S .
124
updatercd mountall.sh start 35 S .
125
updatercd mountall-bootclean.sh start 36 S .
126
updatercd mountoverflowtmp start 37 S . stop 63 0 6 .
127
updatercd mountnfs.sh start 45 S .
128
updatercd mountnfs-bootclean.sh start 46 S .
129
updatercd bootmisc.sh start 55 S .
130
updatercd urandom start 55 S . start 30 0 6 .
132
# Links in runlevels other than S
134
updatercd halt start 90 0 .
135
updatercd reboot start 90 6 .
136
updatercd umountroot start 60 0 6 .
137
updatercd umountfs start 40 0 6 .
138
updatercd umountnfs.sh start 31 0 6 .
139
updatercd sendsigs start 20 0 6 .
141
updatercd killprocs start 30 1 .
142
updatercd single start 90 1 .
143
updatercd rc.local start 99 2 3 4 5 .
144
updatercd rmnologin start 99 2 3 4 5 .
145
updatercd stop-bootlogd-single start 99 S .
146
updatercd stop-bootlogd start 99 2 3 4 5 .
149
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
150
# versions. We have the same functionality in mount{kern,devsub}fs.sh
153
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
154
# mountkernfs.sh and mountdevsubfs.sh. It was removed completely in
157
for F in mountkernfs devpts.sh mountvirtfs
160
update-rc.d $F remove >/dev/null 2>&1 || :
164
# Create /var/run and /var/lock on the root partition to make sure
165
# they are available when RAMRUN or RAMLOCK is enabled.
166
# If mount fail (like in a vserver environment), just clean up and ignore
167
# it. The admins enabling RAMRUN and RAMLOCK will have to create the
168
# directories themselves in this case.
170
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted
172
# We need to quickly bind / to another location so we can make them
173
# just in case /var is a mountpoint or a symlink to one.
175
if mount -n --bind / /.root ; then
176
if [ -L /.root/var ] && [ ! -d /.root/var ] ; then
177
# No use trying if /var is a relative symlink. It is not
181
mkdir -p /.root/var/run /.root/var/lock
102
# See if there were saved variables.
104
if [ -f /etc/default/rcS.sed ]
106
cp /etc/default/rcS /etc/default/rcS.TMP
107
sed -f /etc/default/rcS.sed < /etc/default/rcS.TMP > /etc/default/rcS
108
if [ -s /etc/default/rcS ]
110
rm -f /etc/default/rcS.TMP
112
rm -f /etc/default/rcS.sed
116
# Defaults for 2.85-16 and up for mountvirtfs levels changed,
117
# so remove the existing startup links if we upgraded from
122
update-rc.d -f mountvirtfs remove >/dev/null 2>&1 ||:
127
# Okay, we could do this with update-rc.d, but that would probably
128
# be pretty slow. This way we win some speed.
129
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
131
updatercd mountvirtfs start 2 S . start 36 S .
132
updatercd bootlogd start 5 S .
133
updatercd checkroot.sh start 10 S .
134
updatercd modutils start 20 S .
135
updatercd checkfs.sh start 30 S .
136
updatercd mountall.sh start 35 S .
137
updatercd hostname.sh start 40 S .
138
updatercd network start 40 S .
139
updatercd mountnfs.sh start 45 S .
140
updatercd bootmisc.sh start 55 S .
141
updatercd urandom start 55 S . start 30 0 6 .
144
# Links in "normal" runlevels.
146
updatercd sendsigs start 20 0 6 .
147
updatercd umountnfs.sh start 31 0 6 .
148
updatercd umountfs start 40 0 6 .
149
updatercd halt start 90 0 .
150
updatercd reboot start 90 6 .
151
updatercd rmnologin start 99 2 3 4 5 .
152
updatercd single start 20 1 .
153
updatercd stop-bootlogd start 99 2 3 4 5 .
156
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
157
# versions. We have the same functionality in mountvirtfs.
159
for i in devpts.sh mountkernfs
189
# When installing for the first time or upgrading from version before 2.86.ds1-27,
190
# a reboot is needed to make the /lib/init/rw/ tmpfs available. Flag this
191
# using notify-reboot-required. Not mounting it here as it creates problem
192
# for debootstrap, vservers, pbuilder and cowbuilder.
194
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \
195
&& [ -x /usr/share/update-notifier/notify-reboot-required ]; then
196
/usr/share/update-notifier/notify-reboot-required
200
# Create initial log files
202
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
203
for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
161
if [ -f /etc/init.d/$i ]
205
if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
164
update-rc.d $i remove >/dev/null 2>&1 ||:
207
echo "(Nothing has been logged yet.)" >| "$F"
168
# Create /dev/pts, /dev/shm, /sys
169
if [ `uname -s` = Linux ]
214
# Set up nologin symlink so that dynamic-login-disabling will work
215
# (when DELAYLOGIN is set to "yes")
217
if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
219
rm -f /var/lib/initscripts/nologin
220
ln -s /var/lib/initscripts/nologin /etc/nologin
224
# Set up motd stuff, putting variable file in /var/run/
226
if [ ! -f /etc/motd.tail ]
230
sed 1d /etc/motd > /etc/motd.tail
231
[ -s /etc/motd.tail ] || rm -f /etc/motd.tail
234
if [ ! -f /var/run/motd ]
238
cat /etc/motd > /var/run/motd
243
if [ ! -L /etc/motd ]
245
[ -f /etc/default/rcS ] && . /etc/default/rcS
246
if [ "$EDITMOTD" = no ]
248
cat /var/run/motd > /etc/motd.static
249
ln -sf motd.static /etc/motd
251
ln -sf /var/run/motd /etc/motd
256
# Mount kernel virtual filesystems...not.
257
# This causes problems in pbuilder.
260
#if [ -x /etc/init.d/mountkernfs.sh ]
262
# if which invoke-rc.d >/dev/null 2>&1
264
# invoke-rc.d mountkernfs.sh start || :
266
# /etc/init.d/mountkernfs.sh start
271
# Create /dev/pts, /dev/shm directories
273
if [ "$(uname -s)" = Linux ]
172
# Only create /dev/{pts,shm} if /dev is on the
173
# root file system. If some package has mounted a
174
# seperate /dev (ramfs from udev, devfs) it is
175
# responsible for the presence of those subdirs.
276
# Only create /dev/{pts,shm} if /dev is on the
277
# root file system. If some package has mounted a
278
# seperate /dev (ramfs from udev, devfs) it is
279
# responsible for the presence of those subdirs.
177
281
if ! mountpoint -q /dev
283
[ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts ; }
284
[ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm ; }
289
# Create /etc/rc.local on first time install and when upgrading from
290
# versions before "2.86.ds1-16"
292
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
294
if [ ! -e /etc/rc.local ]; then
295
cat << EOF > /etc/rc.local
300
# This script is executed at the end of each multiuser runlevel.
301
# Make sure that the script will "exit 0" on success or any other
304
# In order to enable or disable this script just change the execution
307
# By default this script does nothing.
311
# make sure it's enabled by default.
312
chmod 755 /etc/rc.local