~ubuntu-branches/ubuntu/karmic/sysvinit/karmic-updates

« back to all changes in this revision

Viewing changes to debian/initscripts.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-09-07 19:56:53 UTC
  • mfrom: (1.1.4 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090907195653-2i6t0j91wfbf1f0d
Tags: 2.87dsf-4ubuntu1
* Merge from debian unstable, remaining changes:
  - Support Cell processor:
    + debian/initscripts/postinst: Create spu system group and /spu mount
      point if we are running on a Cell processor.
    + debian/initscripts/etc/init.d/mountkernfs.sh: Mount spufs if Cell
      processor is detected.
    + debian/initscripts/lib/init/mount-functions.sh: Modprobe spufs
      if not available.
    + debian/control: Add initscripts dependency 'passwd' for groupadd.
    (Forwarded to Debian #483399)
  - Use tmpfs mounts for /var/lock and /var/run:
    + debian/initscripts/share/default.rcS: Enable RAMRUN and RAMLOCK by
      default.
    + debian/initscripts.postinst: Enable RAMRUN and RAMLOCK in
      /etc/default/rcS on upgrades. This needs to be kept until the next
      LTS.
    + debian/initscripts/etc/init.d/mountkernfs.sh: Propagate files from the
      initramfs to our new /var/run, so that we can populate
      /var/run/sendsigs.omit from initramfs.
  - Boot ordering differences:
    + mountkernfs.sh: 02 -> 01
    + mountdevsubfs.sh: 04 -> 11
    + bootlogd: disabled by default
    + checkroot.sh: 10 -> 20
    + mtab.sh: 12 -> 22
  - debian/patches/91_sulogin_lockedpw.dpatch: Disable "root account is
    locked" warning, since this is the default in Ubuntu. Document this in
    sulogin.8.
  - debian/control: Drop Essential: yes from packages since we use Upstart.
  - debian/control: Conflict/Replace sysvconfig which has also previously
    provided service(8).
  - debian/control, debian/rules: Previous name for sysvinit-utils was
    'sysvutils' in Ubuntu, so Conflict/Replace/Provide it. Also create a
    dummy sysvutils package, since Hardy has reverse versioned dependencies
    to it. This needs to be kept until after the next LTS.
  - debian/control: Depend on lsb-base (>= 3.2-14) for status_of_proc()
    function.
  - debian/initscripts/etc/init.d/checkfs.sh: Don't depend on hwclockfirst
    which Ubuntu does not have.
  - debian/initscripts/etc/init.d/mountkernfs.sh: Always mount devpts, and
    do not touch /dev/ptmx (which is already managed by udev).
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount fusectl if it is
    available
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount securityfs if it is
    available. This allows for easier AppArmor confinement of applications
    early in the boot process. LP: #399954
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount debugfs if it is
    available.
  - debian/initscripts/etc/init.d/ondemand: Sleep for 60 seconds, then
    set CPU Frequency Scaling governor to "ondemand".   LP: #341573.
  - debian/initscripts/etc/init.d/umountfs: Don't unmount filesystems
    that precede root or use force for some mountpoints.
  - debian/initscripts/etc/network/if-up.d/mountnfs: Rename ifstate
    file to /var/run/network/ifstate
  - ./debian/initscripts/lib/init/usplash-fsck-functions.sh: Use blkid,
    vol_id is gone.
  - debian/initscripts.{pre,postinst}: waitnfs.sh -> mountnfs.sh renaming
    transition. This needs to be kept until after the next LTS.

LP: #32455, #94120, #160197, #382097 (amongst others).

* debian/sysv-rc/sbin/update-rc.d: Dropped support for "multiuser"
  command-line option.
* debian/rules: Compat symlink from /usr/bin/service to /usr/sbin/service
* debian/initscripts.postinst: Transition from bootlogs.sh to bootlogs

* debian/sysv-rc.postinst: Don't try and use insserv by default, though
  everything's in place for you to try if you like.  It can be activated
  with:
      USEINSSERV=yes dpkg-reconfigure sysv-rc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# initscripts postinst
 
4
#
 
5
 
 
6
set -e
 
7
 
 
8
case "$1" in
 
9
  configure)
 
10
        PREV_VER=$2
 
11
        ;;
 
12
  abort-upgrade|abort-remove|abort-deconfigure)
 
13
        exit 0
 
14
        ;;
 
15
esac
 
16
 
 
17
umask 022
 
18
 
 
19
chrooted() {
 
20
  if [ -r /proc/1/root ]; then
 
21
    return 1
 
22
  fi
 
23
  return 0
 
24
}
 
25
 
 
26
#
 
27
# Initialize rcS default file.
 
28
#
 
29
if [ ! -f /etc/default/rcS ]
 
30
then
 
31
        cp -p /usr/share/initscripts/default.rcS /etc/default/rcS
 
32
else
 
33
        # in Ubuntu we use /var/run and /var/lock tmpfses; transition
 
34
        # it to the new settings in /etc/default/rcS
 
35
        if dpkg --compare-versions "$PREV_VER" le-nl "2.86.ds1-56ubuntu1"
 
36
        then
 
37
                grep -wq RAMRUN /etc/default/rcS || echo 'RAMRUN=yes' >> /etc/default/rcS
 
38
                grep -wq RAMLOCK /etc/default/rcS || echo 'RAMLOCK=yes' >> /etc/default/rcS
 
39
        fi
 
40
fi
 
41
 
 
42
#
 
43
# In 2.86.ds1-7 the "single" script was moved.
 
44
# We have to remove the old links _before_ we install new ones.
 
45
#
 
46
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7"
 
47
then
 
48
        update-rc.d -f single remove >/dev/null 2>&1 || :
 
49
fi
 
50
 
 
51
# In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved.
 
52
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
 
53
then
 
54
        update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
 
55
        update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
 
56
fi
 
57
 
 
58
# In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35
 
59
# it was moved back.
 
60
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35"
 
61
then
 
62
        update-rc.d -f sendsigs remove >/dev/null 2>&1 || :
 
63
fi
 
64
 
 
65
# In 2.86.ds1-56ubuntu1, the waitnfs.sh was renamed to mountnfs.sh to be in
 
66
# sync with Debian again.
 
67
if dpkg --compare-versions "$PREV_VER" le-nl "2.86.ds1-56ubuntu1"
 
68
then
 
69
        update-rc.d -f waitnfs.sh remove >/dev/null 2>&1 || :
 
70
fi
 
71
 
 
72
#
 
73
# In 2.87dsf-2 the "mountoverflowtmp" script was dropped
 
74
# from runlevels 0 and 6.
 
75
# We have to remove the old links _before_ we install new ones.
 
76
#
 
77
if dpkg --compare-versions "$PREV_VER" lt "2.87dsf-2" ; then
 
78
        update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || :
 
79
fi
 
80
 
 
81
# In 2.87dsf-4ubuntu1, the bootlogs.sh was renamed to bootlogs to be in
 
82
# sync with Debian again.
 
83
if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu1"
 
84
then
 
85
        update-rc.d -f bootlogs.sh remove >/dev/null 2>&1 || :
 
86
fi
 
87
 
 
88
 
 
89
#
 
90
# Okay, we could do this with update-rc.d, but that would probably
 
91
# be pretty slow. This way we win some speed.
 
92
# DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
 
93
#
 
94
# Links in runlevel S
 
95
#
 
96
update-rc.d mountkernfs.sh         start 01 S . >/dev/null || exit $?
 
97
update-rc.d hostname.sh            start 02 S . >/dev/null || exit $?
 
98
update-rc.d mountdevsubfs.sh       start 11 S . >/dev/null || exit $?
 
99
#update-rc.d bootlogd               start 05 S . >/dev/null || exit $?
 
100
update-rc.d checkroot.sh           start 20 S . >/dev/null || exit $?
 
101
update-rc.d mtab.sh                start 22 S . >/dev/null || exit $?
 
102
update-rc.d checkfs.sh             start 30 S . >/dev/null || exit $?
 
103
update-rc.d mountall.sh            start 35 S . >/dev/null || exit $?
 
104
update-rc.d mountall-bootclean.sh  start 36 S . >/dev/null || exit $?
 
105
update-rc.d mountoverflowtmp       start 37 S . >/dev/null || exit $?
 
106
update-rc.d mountnfs.sh            start 45 S . >/dev/null || exit $?
 
107
update-rc.d mountnfs-bootclean.sh  start 46 S . >/dev/null || exit $?
 
108
update-rc.d bootmisc.sh            start 55 S . >/dev/null || exit $?
 
109
update-rc.d urandom                start 55 S . start 30 0 6 . >/dev/null || exit $?
 
110
#
 
111
# Links in runlevels other than S
 
112
#
 
113
update-rc.d halt                   start 90 0 . >/dev/null || exit $?
 
114
update-rc.d reboot                 start 90 6 . >/dev/null || exit $?
 
115
update-rc.d umountroot             start 60 0 6 . >/dev/null || exit $?
 
116
update-rc.d umountfs               start 40 0 6 . >/dev/null || exit $?
 
117
update-rc.d umountnfs.sh           start 31 0 6 . >/dev/null || exit $?
 
118
update-rc.d sendsigs               start 20 0 6 . >/dev/null || exit $?
 
119
 
 
120
update-rc.d killprocs              start 30 1 . >/dev/null || exit $?
 
121
update-rc.d single                 start 90 1 . >/dev/null || exit $?
 
122
update-rc.d bootlogs               start 70 1 2 3 4 5 . >/dev/null || exit $?
 
123
update-rc.d ondemand               start 99 2 3 4 5 . >/dev/null || exit $?
 
124
update-rc.d rc.local               start 99 2 3 4 5 . >/dev/null || exit $?
 
125
update-rc.d rmnologin              start 99 2 3 4 5 . >/dev/null || exit $?
 
126
#update-rc.d stop-bootlogd-single   start 99 S . >/dev/null || exit $?
 
127
#update-rc.d stop-bootlogd          start 99 2 3 4 5 . >/dev/null || exit $?
 
128
 
 
129
#
 
130
# Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
 
131
# versions. We have the same functionality in mount{kern,devsub}fs.sh 
 
132
#
 
133
#
 
134
# In 2.86.ds1-10 the "mountvirtfs" script was replaced by
 
135
# mountkernfs.sh and mountdevsubfs.sh.  It was removed completely in
 
136
# 2.86.ds1-16.
 
137
#
 
138
for F in mountkernfs devpts.sh mountvirtfs
 
139
do
 
140
        rm -f /etc/init.d/$F
 
141
        update-rc.d $F remove >/dev/null 2>&1 || :
 
142
done
 
143
 
 
144
#
 
145
# Create /var/run and /var/lock on the root partition to make sure
 
146
# they are available when RAMRUN or RAMLOCK is enabled.
 
147
# If mount fail (like in a vserver environment), just clean up and ignore
 
148
# it.  The admins enabling RAMRUN and RAMLOCK will have to create the
 
149
# directories themselves in this case.
 
150
#
 
151
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted
 
152
then
 
153
        # We need to quickly bind / to another location so we can make them
 
154
        # just in case /var is a mountpoint or a symlink to one.
 
155
        mkdir -p /.root
 
156
        if mount -n --bind / /.root ; then
 
157
                if [ -L /.root/var ] && [ ! -d /.root/var ] ; then
 
158
                        # No use trying if /var is a relative symlink.  It is not
 
159
                        # going to work.
 
160
                        :
 
161
                else
 
162
                        mkdir -p /.root/var/run /.root/var/lock
 
163
                fi
 
164
                umount /.root
 
165
        fi
 
166
        rmdir /.root
 
167
fi
 
168
 
 
169
#
 
170
# When installing for the first time or upgrading from version before
 
171
# 2.86.ds1-27, a reboot is needed to make the /lib/init/rw/ tmpfs
 
172
# available.  Flag this using notify-reboot-required.  Not mounting it
 
173
# here as it creates problem for debootstrap, vservers, pbuilder and
 
174
# cowbuilder.
 
175
#
 
176
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \
 
177
 && [ -x /usr/share/update-notifier/notify-reboot-required ]; then
 
178
        /usr/share/update-notifier/notify-reboot-required
 
179
fi
 
180
 
 
181
#
 
182
# Create mount point for spufs, and create spu system group
 
183
#
 
184
if mountpoint -q /proc && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
 
185
       if ! getent group spu >/dev/null; then
 
186
               # the adduser package is priority important; cannot use addgroup
 
187
               groupadd -K GID_MAX=1000 spu
 
188
       fi
 
189
       mkdir -p /spu
 
190
       if ! mountpoint -q /spu; then
 
191
               # No need to fail configuration if this isn't possible. Mount
 
192
               # will still display an error. See LP #261490 and #251593.
 
193
               mount -t spufs -ogid=spu spufs /spu || true
 
194
       fi
 
195
fi
 
196
 
 
197
#
 
198
# Create initial log files
 
199
#
 
200
[ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
 
201
for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
 
202
do
 
203
        if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
 
204
        then
 
205
                echo "(Nothing has been logged yet.)" >| "$F"
 
206
                chown root:adm "$F"
 
207
                chmod 640 "$F"
 
208
        fi
 
209
done
 
210
 
 
211
#
 
212
# Set up nologin symlink so that dynamic-login-disabling will work
 
213
# (when DELAYLOGIN is set to "yes")
 
214
#
 
215
if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
 
216
then
 
217
        rm -f /var/lib/initscripts/nologin
 
218
        ln -s /var/lib/initscripts/nologin /etc/nologin
 
219
fi
 
220
 
 
221
#
 
222
# Set up motd stuff, putting variable file in /var/run/
 
223
#
 
224
if [ ! -f /etc/motd.tail ]
 
225
then
 
226
        if [ -f /etc/motd ]
 
227
        then
 
228
                sed 1d /etc/motd > /etc/motd.tail
 
229
                [ -s /etc/motd.tail ] || rm -f /etc/motd.tail
 
230
        fi
 
231
fi
 
232
if [ ! -f /var/run/motd ]
 
233
then
 
234
        if [ -f /etc/motd ]
 
235
        then
 
236
                cat /etc/motd > /var/run/motd
 
237
        else
 
238
                :>/var/run/motd
 
239
        fi
 
240
fi
 
241
if [ ! -L /etc/motd ]
 
242
then
 
243
        [ -f /etc/default/rcS ] && . /etc/default/rcS
 
244
        if [ "$EDITMOTD" = no ]
 
245
        then
 
246
                cat /var/run/motd > /etc/motd.static
 
247
                ln -sf motd.static /etc/motd
 
248
        else
 
249
                ln -sf /var/run/motd /etc/motd
 
250
        fi
 
251
fi
 
252
 
 
253
#
 
254
# Mount kernel virtual filesystems...not.
 
255
# This causes problems in pbuilder.
 
256
#
 
257
#
 
258
#if [ -x /etc/init.d/mountkernfs.sh ]
 
259
#then
 
260
#       if which invoke-rc.d >/dev/null 2>&1
 
261
#       then
 
262
#               invoke-rc.d mountkernfs.sh start || :
 
263
#       else
 
264
#               /etc/init.d/mountkernfs.sh start
 
265
#       fi
 
266
#fi
 
267
 
 
268
#
 
269
# Create /dev/pts, /dev/shm directories
 
270
#
 
271
if [ "$(uname -s)" = Linux ]
 
272
then
 
273
        #
 
274
        # Only create /dev/{pts,shm} if /dev is on the
 
275
        # root file system. If some package has mounted a
 
276
        # seperate /dev (ramfs from udev, devfs) it is
 
277
        # responsible for the presence of those subdirs.
 
278
        # (it is OK for these to fail under fakechroot)
 
279
        #
 
280
        if ! mountpoint -q /dev
 
281
        then
 
282
                [ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; }
 
283
                [ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; }
 
284
        fi
 
285
fi
 
286
 
 
287
#
 
288
# Create /etc/rc.local on first time install and when upgrading from
 
289
# versions before "2.86.ds1-16"
 
290
#
 
291
if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
 
292
then
 
293
        if [ ! -e /etc/rc.local ]; then
 
294
                cat << EOF > /etc/rc.local
 
295
#!/bin/sh -e
 
296
#
 
297
# rc.local
 
298
#
 
299
# This script is executed at the end of each multiuser runlevel.
 
300
# Make sure that the script will "exit 0" on success or any other
 
301
# value on error.
 
302
#
 
303
# In order to enable or disable this script just change the execution
 
304
# bits.
 
305
#
 
306
# By default this script does nothing.
 
307
 
 
308
exit 0
 
309
EOF
 
310
                # make sure it's enabled by default.
 
311
                chmod 755 /etc/rc.local
 
312
        fi
 
313
fi
 
314
 
 
315
: