[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash
From: |
Alfred M. Szmidt |
Subject: |
Re: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash. |
Date: |
Fri, 04 Jan 2002 01:18:50 +0100 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 |
* Roland McGrath writes:
>> 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?).
> I don't follow the logic or see the goal. Depending on bash is not
> a problem for the GNU system.
This mostly applies to Debian GNU/Hurd, but I think that it should apply
in our case too, please see Marcus' mail.
>> The function `remove_translator' has be removed and replaced with a
>> single command that is a lot cleaner.
> Your change has the wrong semantics because find will call stat and
> activate translators. If you don't understand how remove_translator
> works differently than your find command, please read up on
> translators.
Yes, you are absolutely correct, I forgot how find works. Thank you
for reminding me.
I changed it back to the original version but modified it a bit so it
works under a POSIX shell. Currently its a really ugly hack, so if
you have any suggestions on how one could do it differently please
tell me.
2002-01-04 Alfred M. Szmidt <ams@kemisten.nu>
* rc.sh: Changed back to using `/bin/sh'.
Removed all occurrences of the keyword `function'.
Removed duplicate test case for `/var/run'.
(remove_translator): Added the -c option to settrans.
Removing the dirname of $f instead $f itself, because $f was
changed in the recursion.
* runsystem.sh: Changed to use `/bin/sh' instead of `/bin/bash'
Removed all occurrences of the keyword `function'.
Fixed if condition.
Index: runsystem.sh
===================================================================
RCS file: /cvsroot/hurd/hurd/daemons/runsystem.sh,v
retrieving revision 1.3
diff -u -r1.3 runsystem.sh
--- runsystem.sh 20 Dec 2001 17:29:33 -0000 1.3
+++ runsystem.sh 4 Jan 2002 00:09:06 -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 [ "${FALLBACK_CONSOLE:+set}" = set ]; then
singleuser "Running on fallback console ${FALLBACK_CONSOLE}"
fi
Index: rc.sh
===================================================================
RCS file: /cvsroot/hurd/hurd/daemons/rc.sh,v
retrieving revision 1.23
diff -u -r1.23 rc.sh
--- rc.sh 8 Jun 2001 22:07:18 -0000 1.23
+++ rc.sh 4 Jan 2002 00:09:06 -0000
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
PATH=/bin:/sbin
@@ -59,34 +59,27 @@
# 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
+ remove_translators() {
for f; do
- settrans -pagfS "$f"
+ settrans -cpagfS "$f"
if [ -L "$f" ] || [ ! -d "$f" ]; then
rm "$f"
else
remove_translators "$f"/* "$f"/.[!.] "$f"/.??*
- rmdir "$f"
+ rmdir `dirname $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; })
fi
+(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
echo done
# This file must exist for e2fsck to work. XXX
--
Alfred M. Szmidt
- Re: [PATCH] `daemons/rc.sh' and `daemons/runsystem.sh' depending on Bash.,
Alfred M. Szmidt <=