From b1c3fe8675bf6d6831b2d63adb42dc43ef96f69e Mon Sep 17 00:00:00 2001 From: Florian La Roche Date: Wed, 26 Jun 2002 09:02:16 +0000 Subject: - start cleaning up some sh coding things --- Makefile | 26 ++++++++++------------ initscripts.spec | 3 +++ prefdm | 6 +++--- rc.d/init.d/halt | 62 +++++++++++++++++++++++++---------------------------- rc.d/init.d/killall | 3 +-- rc.d/rc.sysinit | 7 +++--- service | 5 ++--- setsysfont | 22 ++++++------------- static-routes-ipv6 | 5 ----- sys-unconfig.8 | 2 +- sysctl.conf | 4 ++-- sysctl.conf.s390 | 14 ++++++++++-- sysctl.conf.sparc | 22 +++++++++++++------ 13 files changed, 89 insertions(+), 92 deletions(-) diff --git a/Makefile b/Makefile index 81357b33..ea62d3d7 100644 --- a/Makefile +++ b/Makefile @@ -9,22 +9,19 @@ CVSROOT = $(shell cat CVS/Root) mandir=/usr/share/man all: - (cd src; make) - (make -C po) + make -C src + make -C po + install: - mkdir -p $(ROOT)/etc mkdir -p $(ROOT)/etc/profile.d $(ROOT)/sbin $(ROOT)/usr/sbin mkdir -p $(ROOT)$(mandir)/man8 - install -m644 inittab $(ROOT)/etc + install -m644 inittab adjtime $(ROOT)/etc if uname -m | grep -q s390 ; then \ install -m644 inittab.s390 $(ROOT)/etc/inittab ; \ fi - install -m644 adjtime $(ROOT)/etc - install -m755 setsysfont $(ROOT)/sbin - install -m755 lang.sh $(ROOT)/etc/profile.d - install -m755 lang.csh $(ROOT)/etc/profile.d - install -m755 service $(ROOT)/sbin + install -m755 service setsysfont $(ROOT)/sbin + install -m755 lang.csh lang.sh $(ROOT)/etc/profile.d install -m755 sys-unconfig $(ROOT)/usr/sbin install -m644 sys-unconfig.8 $(ROOT)$(mandir)/man8 install -m644 sysctl.conf $(ROOT)/etc/sysctl.conf @@ -56,15 +53,14 @@ install: ln -sf ifdown-ippp ifdown-isdn ; \ ln -sf ../../../sbin/ifup . ; \ ln -sf ../../../sbin/ifdown . ) - (cd src; make install ROOT=$(ROOT) mandir=$(mandir)) - (cd po ; make install PREFIX=$(ROOT)) + make install ROOT=$(ROOT) mandir=$(mandir) -C src + make install PREFIX=$(ROOT) -C po # Make sure locale stuff from initscripts goes in /usr/share/locale too mkdir -p $(ROOT)/usr/share/locale cp -a $(ROOT)/etc/locale/* $(ROOT)/usr/share/locale/ - mkdir -p $(ROOT)/var/run/netreport - mkdir -p $(ROOT)/var/log + mkdir -p $(ROOT)/var/run/netreport $(ROOT)/var/log chown $(SUPERUSER).$(SUPERGROUP) $(ROOT)/var/run/netreport chmod u=rwx,g=rwx,o=rx $(ROOT)/var/run/netreport touch $(ROOT)/var/run/utmp @@ -116,8 +112,8 @@ changelog: rm -f changenew clean: - (cd src; make clean) - (cd po; make clean) + make clean -C src + make clean -C po @rm -fv *~ changenew ChangeLog.old *gz tag-archive: @cvs -Q tag -F $(CVSTAG) diff --git a/initscripts.spec b/initscripts.spec index aeac93c1..900499fa 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -244,6 +244,9 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/locale/*/LC_MESSAGES %changelog +* Wed Jun 26 2002 Florian La Roche +- start some sh coding cleanups + * Wed Jun 12 2002 Bill Nottingham 6.78-1 - fix UTF-8 checks diff --git a/prefdm b/prefdm index 828e741e..8e9e9918 100755 --- a/prefdm +++ b/prefdm @@ -3,7 +3,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin # We need to source this so that the login screens get translated -. /etc/profile.d/lang.sh +[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh # Run preferred X display manager @@ -18,11 +18,11 @@ fi preferred= if [ -f /etc/sysconfig/desktop ]; then - source /etc/sysconfig/desktop >/dev/null 2>&1 + . /etc/sysconfig/desktop [ -n "$DISPLAYMANAGER" ] && DESKTOP=$DISPLAYMANAGER if [ "$DESKTOP" = GNOME ]; then preferred=gdm - elif [ "$DESKTOP" = "KDE" -o "$DESKTOP" = "KDE1" -o "$DESKTOP" = "KDE2" ]; then + elif [ "$DESKTOP" = KDE -o "$DESKTOP" = KDE1 -o "$DESKTOP" = KDE2 ]; then preferred=kdm fi fi diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 815ac4ac..82ffe34e 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -1,6 +1,6 @@ #!/bin/bash # -# rc.halt This file is executed by init when it goes into runlevel +# halt This file is executed by init when it goes into runlevel # 0 (halt) or runlevel 6 (reboot). It kills all processes, # unmounts file systems and then either halts or reboots. # @@ -11,7 +11,7 @@ # Set the path. PATH=/sbin:/bin:/usr/bin:/usr/sbin -export NOLOCALE=1 +NOLOCALE=1 . /etc/init.d/functions runcmd() { @@ -32,29 +32,27 @@ halt_get_remaining() { # See how we were called. case "$0" in - *halt) + *halt) message=$"Halting system..." - command="halt" + command="/sbin/halt" ;; - *reboot) + *reboot) message=$"Please stand by while rebooting the system..." - command="reboot" + command="/sbin/reboot" ;; - *) - echo $"$0: call me as 'rc.halt' or 'rc.reboot' please!" + *) + echo $"$0: call me as 'halt' or 'reboot' please!" exit 1 ;; esac -if [ -n "$1" ]; then - case "$1" in +case "$1" in *start) ;; *) - echo $"Usage: (halt|reboot) {start}" + echo $"Usage: $0 {start}" exit 1 ;; - esac -fi +esac # Kill all processes. [ "${BASH+bash}" = bash ] && enable kill @@ -64,7 +62,7 @@ sleep 5 runcmd $"Sending all processes the KILL signal..." /sbin/killall5 -9 # Write to wtmp file before unmounting /var -halt -w +/sbin/halt -w # Save mixer settings, here for lack of a better place. grep -q "\(sparcaudio\|sound\)" /proc/devices @@ -93,26 +91,26 @@ CLOCKFLAGS="$CLOCKFLAGS --systohc" case "$UTC" in yes|true) - CLOCKFLAGS="$CLOCKFLAGS -u"; - CLOCKDEF="$CLOCKDEF (utc)"; - ;; + CLOCKFLAGS="$CLOCKFLAGS -u"; + CLOCKDEF="$CLOCKDEF (utc)"; + ;; no|false) - CLOCKFLAGS="$CLOCKFLAGS --localtime"; - CLOCKDEF="$CLOCKDEF (localtime)"; - ;; + CLOCKFLAGS="$CLOCKFLAGS --localtime"; + CLOCKDEF="$CLOCKDEF (localtime)"; + ;; esac case "$ARC" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -A"; - CLOCKDEF="$CLOCKDEF (arc)"; - ;; + yes|true) + CLOCKFLAGS="$CLOCKFLAGS -A"; + CLOCKDEF="$CLOCKDEF (arc)"; + ;; esac case "$SRM" in - yes|true) + yes|true) CLOCKFLAGS="$CLOCKFLAGS -S"; CLOCKDEF="$CLOCKDEF (srm)"; - ;; + ;; esac runcmd $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS @@ -197,15 +195,13 @@ if [ -f /poweroff -o ! -f /halt ]; then HALTARGS="$HALTARGS -p" fi -if [ "$command" = halt ] ; then - if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then - . /etc/sysconfig/ups - [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE - fi +if [ "$command" = /sbin/halt -a -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then + . /etc/sysconfig/ups + [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE fi -if [ -x "/sbin/halt.local" ]; then +if [ -x /sbin/halt.local ]; then /sbin/halt.local fi -eval $command $HALTARGS +exec $command $HALTARGS diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall index 823169e5..82208730 100755 --- a/rc.d/init.d/killall +++ b/rc.d/init.d/killall @@ -5,7 +5,7 @@ for i in /var/lock/subsys/*; do # Check if the script is there. - [ ! -f $i ] && continue + [ -f $i ] || continue # Get the subsystem name. subsys=${i#/var/lock/subsys/} @@ -19,4 +19,3 @@ for i in /var/lock/subsys/*; do rm -f $i fi done - diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 61e21c4e..0d0786b1 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -1,19 +1,18 @@ #!/bin/bash # -# /etc/rc.sysinit - run once at boot time +# /etc/rc.d/rc.sysinit - run once at boot time # # Taken in part from Miquel van Smoorenburg's bcheckrc. # # Rerun ourselves through initlog -if [ -z "$IN_INITLOG" ]; then - [ -f /sbin/initlog ] && exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.sysinit +if [ -z "$IN_INITLOG" -a -x /sbin/initlog ]; then + exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.d/rc.sysinit fi # If we're using devfs, start devfsd now - we need the old device names [ -e /dev/.devfsd -a -x /sbin/devfsd ] && /sbin/devfsd /dev -# Set the path PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH diff --git a/service b/service index 3f5e71a0..f5a3406d 100755 --- a/service +++ b/service @@ -12,8 +12,7 @@ if [ $# -eq 0 ]; then fi cd / -while [ $# -gt 0 ] -do +while [ $# -gt 0 ]; do case "${1}" in --help | -h | --h* ) echo $"${USAGE}" >&2 @@ -26,7 +25,7 @@ do *) if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then cd / - for SERVICE in *; do + for SERVICE in * ; do case "${SERVICE}" in functions | halt | killall | single| linuxconf| kudzu | \ *rpmorig | *rpmnew | *rpmsave | *~ | *.orig) diff --git a/setsysfont b/setsysfont index afa14a81..8790153a 100755 --- a/setsysfont +++ b/setsysfont @@ -6,22 +6,11 @@ if [ -f /etc/sysconfig/i18n ]; then . /etc/sysconfig/i18n fi -if [ -n "$LANG" ]; then - case $LANG in - *.utf8|*.UTF-8) - if [ -n "$SYSFONT" ]; then - if [ -n "$SYSFONTACM" ]; then - unicode_start $SYSFONT $SYSFONTACM - else - unicode_start $SYSFONT - fi - else - unicode_start - fi - exit $? - ;; - esac -fi +case "$LANG" in + *.utf8|*.UTF-8) + exec unicode_start $SYSFONT $SYSFONTACM + ;; +esac if [ -x /bin/consolechars -o -x /usr/bin/consolechars ]; then if [ -n "$SYSFONT" ]; then @@ -46,4 +35,5 @@ else echo $"can't set font" exit 1 fi + exit 0 diff --git a/static-routes-ipv6 b/static-routes-ipv6 index 657bceab..a4c3b8d9 100644 --- a/static-routes-ipv6 +++ b/static-routes-ipv6 @@ -10,17 +10,12 @@ #Device IPv6 network to route IPv6 gateway address - ## Example: static routes through a gateway on local link #eth0 fec0:0:0:2::/64 fec0:0:0:1:0:0:0:20 #eth0 3ffe:ffff:1234::/48 3ffe:ffff:1234:0002:0:0:0:1 - ## Example: default route through a gateway on local link #eth0 2000::/3 3ffe:ffff:1234:0002:0:0:0:1 - ## Example: static route through a dedicated tunnel #sit1 3ffe:ffff:1234::/48 - - diff --git a/sys-unconfig.8 b/sys-unconfig.8 index 4651d634..6e3e26f0 100644 --- a/sys-unconfig.8 +++ b/sys-unconfig.8 @@ -14,7 +14,7 @@ kbdconfig, authconfig, and ntsysv. .PD 0 .TP 20 \fI/.unconfigured\fR -The presence of this file will cause /etc/rc.sysinit to run +The presence of this file will cause /etc/rc.d/rc.sysinit to run the programs mentioned above. .PD diff --git a/sysctl.conf b/sysctl.conf index fe4b3791..044bf27a 100644 --- a/sysctl.conf +++ b/sysctl.conf @@ -1,7 +1,7 @@ # Kernel sysctl configuration file for Red Hat Linux # -# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) for -# more details. +# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and +# sysctl.conf(5) for more details. # Controls IP packet forwarding net.ipv4.ip_forward = 0 diff --git a/sysctl.conf.s390 b/sysctl.conf.s390 index 21350846..ef22e8bb 100644 --- a/sysctl.conf.s390 +++ b/sysctl.conf.s390 @@ -1,4 +1,14 @@ -# Disables packet forwarding +# Kernel sysctl configuration file for Red Hat Linux +# +# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and +# sysctl.conf(5) for more details. + +# Controls IP packet forwarding net.ipv4.ip_forward = 0 -# Enables source route verification + +# Controls source route verification net.ipv4.conf.default.rp_filter = 1 + +# Controls whether core dumps will append the PID to the core filename. +# Useful for debugging multi-threaded applications. +kernel.core_uses_pid = 1 diff --git a/sysctl.conf.sparc b/sysctl.conf.sparc index 5eed1c61..d96eafc3 100644 --- a/sysctl.conf.sparc +++ b/sysctl.conf.sparc @@ -1,10 +1,20 @@ -# Disables packet forwarding +# Kernel sysctl configuration file for Red Hat Linux +# +# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and +# sysctl.conf(5) for more details. + +# Controls IP packet forwarding net.ipv4.ip_forward = 0 -# Enables source route verification + +# Controls source route verification net.ipv4.conf.default.rp_filter = 1 -# Disables automatic defragmentation (needed for masquerading, LVS) -net.ipv4.ip_always_defrag = 0 -# Disables the magic-sysrq key + +# Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 -# Disables stop-a on the sparc + +# Controls whether core dumps will append the PID to the core filename. +# Useful for debugging multi-threaded applications. +kernel.core_uses_pid = 1 + +# Controls stop-a on the sparc kernel.stop-a = 0 -- cgit v1.2.1