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

« back to all changes in this revision

Viewing changes to debian/initscripts/etc/init.d/checkroot.sh

  • 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:
7
7
# Should-stop:
8
8
# Default-Start:     S
9
9
# Default-Stop:
 
10
# X-Interactive:     true
10
11
# Short-Description: Check to root file system.
11
12
### END INIT INFO
12
13
 
193
194
        # See if we're on AC Power.  If not, we're not gonna run our
194
195
        # check.  If on_ac_power (in /usr/) is unavailable, behave as
195
196
        # before and check all file systems needing it.
196
 
        if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
197
 
        then
198
 
                if [ -d /proc/acpi ]; then
199
 
                        modprobe ac >/dev/null 2>&1
200
 
                fi
201
 
                on_ac_power >/dev/null 2>&1
202
 
                if [ "$?" -eq 1 ]
203
 
                then
204
 
                        log_warning_msg "On battery power, so skipping file system check."
205
 
                        rootcheck=no
206
 
                fi
207
 
        fi
 
197
# Disabled AC power check until fsck can be told to only check the
 
198
# file system if it is corrupt when running on battery. (bug #526398)
 
199
#       if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
 
200
#       then
 
201
#               on_ac_power >/dev/null 2>&1
 
202
#               if [ "$?" -eq 1 ]
 
203
#               then
 
204
#                       log_warning_msg "On battery power, so skipping file system check."
 
205
#                       rootcheck=no
 
206
#               fi
 
207
#       fi
 
208
        rootcheck=yes
208
209
 
209
210
        #
210
211
        # See if we want to check the root file system.
211
212
        #
212
213
        FSCKCODE=0
213
 
        if [ -f /fastboot ]
 
214
        if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline
214
215
        then
215
 
                [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
 
216
                [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
216
217
                rootcheck=no
217
218
        fi
218
219
 
246
247
        #
247
248
        if [ "$rootcheck" = yes ]
248
249
        then
249
 
                if [ -f /forcefsck ]
 
250
                if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
250
251
                then
251
252
                        force="-f"
252
253
                else
274
275
                if [ "$VERBOSE" = no ]
275
276
                then
276
277
                        log_action_begin_msg "Checking root file system"
277
 
                        if [ "$roottype" = "ext2" -o "$roottype" = "ext3" -o "$roottype" = "ext4" ] && pidof usplash; then
278
 
                            PROGRESS_FILE=`mktemp -p /var/run` || PROGRESS_FILE=/var/run/checkroot_fsck
279
 
                            set -m
280
 
                            logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE &
281
 
                            set +m
282
 
                            usplash_progress "$PROGRESS_FILE"
283
 
                            rm -f $PROGRESS_FILE
284
 
                        else
285
 
                            logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
286
 
                            FSCKCODE=$?
287
 
                        fi
 
278
                        if [ "$roottype" = "ext2" -o "$roottype" = "ext3" -o "$roottype" = "ext4" ] && usplash_running; then
 
279
                            PROGRESS_FILE=`mktemp -p /lib/init/rw` || PROGRESS_FILE=/lib/init/rw/checkroot_fsck
 
280
                            set -m
 
281
                            logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE &
 
282
                            set +m
 
283
                            usplash_progress "$PROGRESS_FILE"
 
284
                            rm -f $PROGRESS_FILE
 
285
                        else
 
286
                            splash_start_indefinite
 
287
                            logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
 
288
                            FSCKCODE=$?
 
289
                            splash_stop_indefinite
 
290
                        fi
288
291
                        if [ "$FSCKCODE" = 0 ]
289
292
                        then
290
293
                                log_action_end_msg 0
292
295
                                log_action_end_msg 1 "code $FSCKCODE"
293
296
                        fi
294
297
                else
 
298
                        splash_start_indefinite
295
299
                        log_daemon_msg "Will now check root file system"
296
300
                        logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
297
301
                        FSCKCODE=$?
298
302
                        log_end_msg $FSCKCODE
 
303
                        splash_stop_indefinite
299
304
                fi
300
305
        fi
301
306
 
394
399
        rm -f /lib/init/rw/rootdev
395
400
}
396
401
 
 
402
do_status () {
 
403
        # If / is read-write or swap is enabled, this script have done
 
404
        # its job.
 
405
        rootrw=false
 
406
        swapon=false
 
407
        if [ -f /etc/mtab ] ; then
 
408
            if grep " / " /etc/mtab |grep -q rw ; then
 
409
                rootrw=true
 
410
            fi
 
411
        fi
 
412
        if [ -f /proc/swaps ] ; then
 
413
            if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
 
414
                swapon=true
 
415
            fi
 
416
        fi
 
417
        if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
 
418
                return 0
 
419
        else
 
420
                return 4
 
421
        fi
 
422
}
 
423
 
397
424
case "$1" in
398
425
  start|"")
399
426
        do_start
405
432
  stop)
406
433
        # No-op
407
434
        ;;
 
435
  status)
 
436
        do_status
 
437
        exit $?
 
438
        ;;
408
439
  *)
409
440
        echo "Usage: checkroot.sh [start|stop]" >&2
410
441
        exit 3