[Pkg-sysvinit-devel] Bug#557648: Confusing mix of different styles in /lib/init/vars.sh

Goswin von Brederlow goswin-v-b at web.de
Mon Nov 23 14:27:21 UTC 2009


Package: initscripts
Version: 2.87dsf-8
Severity: normal
File: /lib/init/vars.sh
Tags: patch

Hi,

the vars.sh script uses different code styles to check for noswap and
quiet options in /proc/cmdline that makes reading the code harder. It
can also get confused by similary spelled options:

  % echo not-quiet | grep -qw quiet && echo quiet
quiet

The attached vars.sh script adds default values (so they never are
undefined) that can be overriden in /etc/defaults/rcS and then uses a
for loop with case statements to parse /proc/cmdline.

MfG
	Goswin

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (499, 'unstable'), (2, 'experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31.5 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  coreutils                     8.0-2      GNU core utilities
ii  debianutils                   3.2.2      Miscellaneous utilities specific t
ii  libc6                         2.10.1-7   GNU C Library: Shared libraries
ii  lsb-base                      3.2-23     Linux Standard Base 3.2 init scrip
ii  mount                         2.16.1-4   Tools for mounting and manipulatin
ii  sysv-rc                       2.87dsf-8  System-V-like runlevel change mech
ii  sysvinit-utils                2.87dsf-8  System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.9-1   ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.8-1     utilities that use the proc file s

initscripts suggests no packages.

-- no debconf information
-------------- next part --------------
#
# Set rcS vars
#

# Set defaults
TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=no
VERBOSE=no
FSCKFIX=no
NOSWAP=no

# Source conffile
if [ -f /etc/default/rcS ]; then
    . /etc/default/rcS || true
fi

# Parse kernel command line
if [ -r /proc/cmdline ]; then
    for ARG in $(cat /proc/cmdline); do
        case $ARG in
            # check for bootoption 'noswap' and do not activate swap
            # partitions/files when it is set.
            (noswap) NOSWAP=yes; break;;
            # Accept the same 'quiet' option as the kernel
            (quiet) VERBOSE=no; break;;
	esac
    done
fi

# But allow both rcS and the kernel options 'quiet' to be overrided
# when INIT_VERBOSE=yes is used as well.
[ "$INIT_VERBOSE" ] && VERBOSE="$INIT_VERBOSE" || true


More information about the Pkg-sysvinit-devel mailing list