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
86
# in Ubuntu we use /var/run and /var/lock tmpfses; transition it to the new
87
# settings in /etc/default/rcS
88
if dpkg --compare-versions "$PREV_VER" le-nl "2.86.ds1-56ubuntu1"
90
grep -wq RAMRUN /etc/default/rcS || echo 'RAMRUN=yes' >> /etc/default/rcS
91
grep -wq RAMLOCK /etc/default/rcS || echo 'RAMLOCK=yes' >> /etc/default/rcS
96
# In 2.86.ds1-7 the "single" script was moved.
97
# We have to remove the old links _before_ we install new ones.
99
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7"
101
update-rc.d -f single remove >/dev/null 2>&1 || :
104
# In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved.
105
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
107
update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
108
update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
111
# In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35
113
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35"
115
update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
118
# In 2.86.ds1-56ubuntu1, the waitnfs.sh was renamed to mountnfs.sh to be in
119
# sync with Debian again.
120
if dpkg --compare-versions "$PREV_VER" le-nl "2.86.ds1-56ubuntu1"
122
update-rc.d -f waitnfs.sh remove >/dev/null 2>&1 || :
126
# Okay, we could do this with update-rc.d, but that would probably
127
# be pretty slow. This way we win some speed.
128
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
130
# Links in runlevel S
132
updatercd mountkernfs.sh start 1 S .
133
updatercd hostname.sh start 2 S .
134
updatercd mountdevsubfs.sh start 11 S .
135
#updatercd bootlogd start 5 S .
136
updatercd checkroot.sh start 20 S .
137
updatercd mtab.sh start 22 S .
138
updatercd checkfs.sh start 30 S .
139
updatercd mountall.sh start 35 S .
140
updatercd mountall-bootclean.sh start 36 S .
141
updatercd mountoverflowtmp start 37 S . stop 63 0 6 .
142
updatercd mountnfs.sh start 45 S .
143
updatercd mountnfs-bootclean.sh start 46 S .
144
updatercd bootmisc.sh start 55 S .
145
updatercd urandom start 55 S . start 30 0 6 .
147
# Links in runlevels other than S
149
updatercd halt start 90 0 .
150
updatercd reboot start 90 6 .
151
updatercd umountroot start 60 0 6 .
152
updatercd umountfs start 40 0 6 .
153
updatercd umountnfs.sh start 31 0 6 .
154
updatercd sendsigs start 20 0 6 .
156
updatercd killprocs start 30 1 .
157
updatercd single start 90 1 .
158
updatercd bootlogs.sh start 70 1 2 3 4 5 .
159
updatercd ondemand start 99 2 3 4 5 .
160
updatercd rc.local start 99 2 3 4 5 .
161
updatercd rmnologin start 99 2 3 4 5 .
162
#updatercd stop-bootlogd-single start 99 S .
163
#updatercd stop-bootlogd start 99 2 3 4 5 .
166
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
167
# versions. We have the same functionality in mount{kern,devsub}fs.sh
170
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
171
# mountkernfs.sh and mountdevsubfs.sh. It was removed completely in
174
for F in mountkernfs devpts.sh mountvirtfs
177
update-rc.d $F remove >/dev/null 2>&1 || :
181
# Create /var/run and /var/lock on the root partition to make sure
182
# they are available when RAMRUN or RAMLOCK is enabled.
183
# If mount fail (like in a vserver environment), just clean up and ignore
184
# it. The admins enabling RAMRUN and RAMLOCK will have to create the
185
# directories themselves in this case.
187
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted
189
# We need to quickly bind / to another location so we can make them
190
# just in case /var is a mountpoint or a symlink to one.
192
if mount -n --bind / /.root ; then
193
if [ -L /.root/var ] && [ ! -d /.root/var ] ; then
194
# No use trying if /var is a relative symlink. It is not
198
mkdir -p /.root/var/run /.root/var/lock
206
# When installing for the first time or upgrading from version before 2.86.ds1-27,
207
# a reboot is needed to make the /lib/init/rw/ tmpfs available. Flag this
208
# using notify-reboot-required. Not mounting it here as it creates problem
209
# for debootstrap, vservers, pbuilder and cowbuilder.
211
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \
212
&& [ -x /usr/share/update-notifier/notify-reboot-required ]; then
213
/usr/share/update-notifier/notify-reboot-required
217
# Create mount point for spufs, and create spu system group
219
if mountpoint -q /proc && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
220
if ! getent group spu >/dev/null; then
221
# the adduser package is priority important; cannot use addgroup
222
groupadd -K GID_MAX=1000 spu
225
if ! mountpoint -q /spu; then
226
# No need to fail configuration if this isn't possible. Mount
227
# will still display an error. See LP #261490 and #251593.
228
mount -t spufs -ogid=spu spufs /spu || true
233
# Create initial log files
235
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
236
for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
238
if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
240
echo "(Nothing has been logged yet.)" >| "$F"
247
# Set up nologin symlink so that dynamic-login-disabling will work
248
# (when DELAYLOGIN is set to "yes")
250
if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
252
rm -f /var/lib/initscripts/nologin
253
ln -s /var/lib/initscripts/nologin /etc/nologin
257
# Set up motd stuff, putting variable file in /var/run/
259
if [ ! -f /etc/motd.tail ]
263
sed 1d /etc/motd > /etc/motd.tail
264
[ -s /etc/motd.tail ] || rm -f /etc/motd.tail
267
if [ ! -f /var/run/motd ]
271
cat /etc/motd > /var/run/motd
276
if [ ! -L /etc/motd ]
278
[ -f /etc/default/rcS ] && . /etc/default/rcS
279
if [ "$EDITMOTD" = no ]
281
cat /var/run/motd > /etc/motd.static
282
ln -sf motd.static /etc/motd
284
ln -sf /var/run/motd /etc/motd
289
# Mount kernel virtual filesystems...not.
290
# This causes problems in pbuilder.
293
#if [ -x /etc/init.d/mountkernfs.sh ]
295
# if which invoke-rc.d >/dev/null 2>&1
297
# invoke-rc.d mountkernfs.sh start || :
299
# /etc/init.d/mountkernfs.sh start
304
# Create /dev/pts, /dev/shm directories
306
if [ "$(uname -s)" = Linux ]
309
# Only create /dev/{pts,shm} if /dev is on the
310
# root file system. If some package has mounted a
311
# seperate /dev (ramfs from udev, devfs) it is
312
# responsible for the presence of those subdirs.
314
if ! mountpoint -q /dev
316
[ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts ; }
317
[ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm ; }
322
# Create /etc/rc.local on first time install and when upgrading from
323
# versions before "2.86.ds1-16"
325
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
327
if [ ! -e /etc/rc.local ]; then
328
cat << EOF > /etc/rc.local
333
# This script is executed at the end of each multiuser runlevel.
334
# Make sure that the script will "exit 0" on success or any other
337
# In order to enable or disable this script just change the execution
340
# By default this script does nothing.
344
# make sure it's enabled by default.
345
chmod 755 /etc/rc.local