12
abort-upgrade|abort-remove|abort-deconfigure)
20
# Function like update-rc.d but simpler & faster.
21
# Usage: updatercd basename start|stop NN runlevel .
23
# Heuristic: use the real update-rc.d if file-rc or insserv is
24
# detected, or if the /etc/rc2.d directory is not present.
28
[ -f /etc/init.d/$1 ] || return 0
31
[ -d /usr/share/file-rc/. ] \
32
|| [ -d /usr/lib/file-rc/. ] \
33
|| [ -d /usr/share/insserv/. ] \
34
|| [ ! -d /etc/rc2.d/. ]
36
# Funniness on next line is because we are running with set -e
37
update-rc.d "$@" >/dev/null && return 0 || return $?
43
tmp="$(echo /etc/rc?.d/[SK]??$base)"
45
"/etc/rc?.d/[SK]??$base") : ;;
65
ln -sf ../init.d/$base $tlet$lev$base
73
if [ -r /proc/1/root ]; then
80
# Initialize rcS default file.
82
if [ ! -f /etc/default/rcS ]
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
# In 2.87dsf-2 the "mountoverflowtmp" script was dropped
112
# from runlevels 0 and 6.
113
# We have to remove the old links _before_ we install new ones.
115
if dpkg --compare-versions "$PREV_VER" lt "2.87dsf-2" ; then
116
update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || :
120
# Okay, we could do this with update-rc.d, but that would probably
121
# be pretty slow. This way we win some speed.
122
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
124
# Links in runlevel S
126
updatercd mountkernfs.sh start 2 S .
127
updatercd hostname.sh start 2 S .
128
updatercd mountdevsubfs.sh start 4 S .
129
updatercd bootlogd start 5 S .
130
updatercd checkroot.sh start 10 S .
131
updatercd mtab.sh start 12 S .
132
updatercd checkfs.sh start 30 S .
133
updatercd mountall.sh start 35 S .
134
updatercd mountall-bootclean.sh start 36 S .
135
updatercd mountoverflowtmp start 37 S .
136
updatercd mountnfs.sh start 45 S .
137
updatercd mountnfs-bootclean.sh start 46 S .
138
updatercd bootmisc.sh start 55 S .
139
updatercd urandom start 55 S . start 30 0 6 .
141
# Links in runlevels other than S
143
updatercd halt start 90 0 .
144
updatercd reboot start 90 6 .
145
updatercd umountroot start 60 0 6 .
146
updatercd umountfs start 40 0 6 .
147
updatercd umountnfs.sh start 31 0 6 .
148
updatercd sendsigs start 20 0 6 .
150
updatercd killprocs start 30 1 .
151
updatercd single start 90 1 .
152
updatercd bootlogs start 70 1 2 3 4 5 .
153
updatercd rc.local start 99 2 3 4 5 .
154
updatercd rmnologin start 99 2 3 4 5 .
155
updatercd stop-bootlogd-single start 99 S .
156
updatercd stop-bootlogd start 99 2 3 4 5 .
159
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
160
# versions. We have the same functionality in mount{kern,devsub}fs.sh
163
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
164
# mountkernfs.sh and mountdevsubfs.sh. It was removed completely in
167
for F in mountkernfs devpts.sh mountvirtfs
170
update-rc.d $F remove >/dev/null 2>&1 || :
174
# Create /var/run and /var/lock on the root partition to make sure
175
# they are available when RAMRUN or RAMLOCK is enabled.
176
# If mount fail (like in a vserver environment), just clean up and ignore
177
# it. The admins enabling RAMRUN and RAMLOCK will have to create the
178
# directories themselves in this case.
180
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted
182
# We need to quickly bind / to another location so we can make them
183
# just in case /var is a mountpoint or a symlink to one.
185
if mount -n --bind / /.root ; then
186
if [ -L /.root/var ] && [ ! -d /.root/var ] ; then
187
# No use trying if /var is a relative symlink. It is not
191
mkdir -p /.root/var/run /.root/var/lock
199
# When installing for the first time or upgrading from version before 2.86.ds1-27,
200
# a reboot is needed to make the /lib/init/rw/ tmpfs available. Flag this
201
# using notify-reboot-required. Not mounting it here as it creates problem
202
# for debootstrap, vservers, pbuilder and cowbuilder.
204
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \
205
&& [ -x /usr/share/update-notifier/notify-reboot-required ]; then
206
/usr/share/update-notifier/notify-reboot-required
210
# Create initial log files
212
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
213
for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
215
if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
217
echo "(Nothing has been logged yet.)" >| "$F"
224
# Set up nologin symlink so that dynamic-login-disabling will work
225
# (when DELAYLOGIN is set to "yes")
227
if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
229
rm -f /var/lib/initscripts/nologin
230
ln -s /var/lib/initscripts/nologin /etc/nologin
234
# Set up motd stuff, putting variable file in /var/run/
236
if [ ! -f /etc/motd.tail ]
240
sed 1d /etc/motd > /etc/motd.tail
241
[ -s /etc/motd.tail ] || rm -f /etc/motd.tail
244
if [ ! -f /var/run/motd ]
248
cat /etc/motd > /var/run/motd
253
if [ ! -L /etc/motd ]
255
[ -f /etc/default/rcS ] && . /etc/default/rcS
256
if [ "$EDITMOTD" = no ]
258
cat /var/run/motd > /etc/motd.static
259
ln -sf motd.static /etc/motd
261
ln -sf /var/run/motd /etc/motd
266
# Mount kernel virtual filesystems...not.
267
# This causes problems in pbuilder.
270
#if [ -x /etc/init.d/mountkernfs.sh ]
272
# if which invoke-rc.d >/dev/null 2>&1
274
# invoke-rc.d mountkernfs.sh start || :
276
# /etc/init.d/mountkernfs.sh start
281
# Create /dev/pts, /dev/shm directories
283
if [ "$(uname -s)" = Linux ]
286
# Only create /dev/{pts,shm} if /dev is on the
287
# root file system. If some package has mounted a
288
# seperate /dev (ramfs from udev, devfs) it is
289
# responsible for the presence of those subdirs.
290
# (it is OK for these to fail under fakechroot)
292
if ! mountpoint -q /dev
294
[ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; }
295
[ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; }
300
# Create /etc/rc.local on first time install and when upgrading from
301
# versions before "2.86.ds1-16"
303
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
305
if [ ! -e /etc/rc.local ]; then
306
cat << EOF > /etc/rc.local
311
# This script is executed at the end of each multiuser runlevel.
312
# Make sure that the script will "exit 0" on success or any other
315
# In order to enable or disable this script just change the execution
318
# By default this script does nothing.
322
# make sure it's enabled by default.
323
chmod 755 /etc/rc.local