bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash.


From: Alfred M. Szmidt
Subject: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash.
Date: Mon, 24 Dec 2001 14:23:53 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1

Hi,

The following two patches will make `daemons/rc.sh' and `daemons/runsystem.sh'
POSIX shell compatible (or at least very close to being compatible without
adding any unnecessary complexity).  The reason for making them POSIX shell
compliant was because they were supposedly POSIX shell compatible in the
beginning (or maybe that was Bourne shell compatible?).

The function `remove_translator' has be removed and replaced with a single
command that is a lot cleaner.

The change from `[' to `test' was mostly made so that the scripts are
consistent with each other.

daemons:
2001-12-24  Alfred M. Szmidt <ams@kemisten.nu>
        * rc.sh: Changed back to using `/bin/sh'.
        Changed all occurrences of `[' to `test'.
        Removed duplicate test case for `/var/run'.
        (remove_translator): Function removed, replaced with a single command.

        * runsystem.sh: Changed to use `/bin/sh' instead of `/bin/bash'
        Changed all occurrences of `[' to `test'.
        Removed all occurrences of the keyword `function'.


Index: daemons/rc.sh
===================================================================
RCS file: /cvsroot/hurd/hurd/daemons/rc.sh,v
retrieving revision 1.23
diff -u -r1.23 rc.sh
--- daemons/rc.sh       8 Jun 2001 22:07:18 -0000       1.23
+++ daemons/rc.sh       24 Dec 2001 02:20:23 -0000
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 PATH=/bin:/sbin
 
@@ -9,13 +9,11 @@
 swapon -a
 
 # Check filesystems.
-if [ -r /fastboot ]
-then
+if test -r /fastboot; then
        # ... or don't.
        rm -f /fastboot
        echo Fast boot ... skipping disk checks
-elif [ $1x = autobootx ]
-then
+elif test $1x = autobootx; then
        echo Automatic boot in progress...
        date
 
@@ -58,35 +56,10 @@
 
   # Forcibly remove all translators in the directory.
   # It is then safe to attempt to remove files and descend directories.
-  # All parameters must begin with "./".
-  function remove_translators() {
-    local f
-    for f; do
-      settrans -pagfS "$f"
-      if [ -L "$f" ] || [ ! -d "$f" ]; then
-       rm "$f"
-      else
-       remove_translators "$f"/* "$f"/.[!.] "$f"/.??*
-       rmdir "$f"
-      fi
-    done
-  }
-
-  (cd /tmp
-   shopt -s nullglob
-   for f in * .[!.] .??*; do
-     case "$f" in
-     'lost+found'|'quotas') ;;
-     *) remove_translators "./$f"
-     esac
-   done)
-
-  unset -f remove_translators  # because it relies on nullglob
-
-fi
-if test -d /var/run; then
-  (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
+  find /tmp -name \* ! -name lost+found ! -name quotas ! -type l ! -type d \
+      -exec settrans -pafgS '{}' \;
 fi
+(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
 echo done
 
 # This file must exist for e2fsck to work. XXX
Index: daemons/runsystem.sh
===================================================================
RCS file: /cvsroot/hurd/hurd/daemons/runsystem.sh,v
retrieving revision 1.3
diff -u -r1.3 runsystem.sh
--- daemons/runsystem.sh        20 Dec 2001 17:29:33 -0000      1.3
+++ daemons/runsystem.sh        24 Dec 2001 02:20:23 -0000
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This program is run by /hurd/init at boot time after the essential
 # servers are up, and is responsible for running the "userland" parts of a
@@ -31,7 +31,7 @@
 
 # If we get a SIGLOST, attempt to reopen the console in case
 # our console ports were revoked.  This lets us print messages.
-function reopen_console ()
+reopen_console ()
 {
   exec 1>/dev/console 2>&1 || exit 3
 }
@@ -42,7 +42,7 @@
 # startup entirely.  We exec a single-user shell, so we will not come back
 # here.  The only way to get to multi-user from that shell will be
 # explicitly exec this script or something like that.
-function singleuser ()
+singleuser ()
 {
   test $# -eq 0 || echo "$0: $*"
   for try in ${fallback_shells}; do
@@ -57,7 +57,7 @@
 # puts FALLBACK_CONSOLE=file-name in the environment if our console is
 # other than a normal /dev/console.
 
-if [ "${FALLBACK_CONSOLE+set}" = set ]; then
+if test "${FALLBACK_CONSOLE:+set}" = set; then
   singleuser "Running on fallback console ${FALLBACK_CONSOLE}"
 fi
 
@@ -70,7 +70,7 @@
 # The first argument is the kernel file name; skip that.
 shift
 flags=
-while [ $# -gt 0 ]; do
+while test $# -gt 0; do
   arg="$1"
   shift
   case "$arg" in
        
-- 
Alfred M. Szmidt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]