Several of the shell-scripts contain non-POSIXisms (such as XPIisms and
BASHisms); this simple patch fixes them.
(Manual) substitutions done:
-a and -o = expressions that uses and || instead
type = which
trap: use signal-names instead of signal-numbers
tail +num = tail -n+num
egrep = grep -E
If I've missed anything, feel free to complain. As soon as time
permits, I will finish my audit of the rest of the /bin/sh-scripts in
base, and submit patches for these as well.
Regards: David Weinehall
--
/) David Weinehall [EMAIL PROTECTED] /) Northern lights wander (\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\) http://www.acc.umu.se/~tao/(/ Full colour fire (/
diff -ur base-config-2.26/apt-setup base-config-2.26-patched/apt-setup
--- base-config-2.26/apt-setup 2004-05-30 01:31:45.0 +0200
+++ base-config-2.26-patched/apt-setup 2004-06-11 07:09:29.0 +0200
@@ -257,7 +257,7 @@
fi
fi
-if [ $CDPROBE -a $CDDEV ]; then
+if [ $CDPROBE ] [ $CDDEV ]; then
umount /cdrom 2/dev/null || true
# Try mounting the detected cd rom.
if mount $CDDEV /cdrom -o ro -t iso9660 2/dev/null scan_cd; then
@@ -285,7 +285,7 @@
# If they chose to use CD, there is little point in asking
# these questions, since the CD's they insert will answer them for us.
# Same goes if they are entering manually.
- if [ $URI != cdrom -a $URI != edit sources list by hand ]; then
+ if [ $URI != cdrom ] [ $URI != edit sources list by hand ]; then
db_beginblock
db_fset mirror/suite seen false
db_input low mirror/suite || true
@@ -379,7 +379,7 @@
fi
# Ask about a proxy if no proxy is yet defined.
- if [ $URI = http -a -z $http_proxy ]; then
+ if [ $URI = http ] [ -z $http_proxy ]; then
if [ ! -e $APTETC/apt.conf ] || \
! grep -iq 'Acquire::http::Proxy' $APTETC/apt.conf; then
db_fset mirror/http/proxy seen false
@@ -409,7 +409,7 @@
# Make /dev/cdrom link now, with device
# they entered. This is for later use by
# apt.
- if [ $CDDEV -a $CDDEV != '/dev/cdrom' ]; then
+ if [ $CDDEV ] [ $CDDEV != '/dev/cdrom' ]; then
ln -sf $CDDEV /dev/cdrom
fi
fi
@@ -527,7 +527,7 @@
else
CONTRIB=
fi
- if [ $URI = ftp -o $URI = http ]; then
+ if [ $URI = ftp ] || [ $URI = http ]; then
SEP=//
else
SEP=
diff -ur base-config-2.26/base-config base-config-2.26-patched/base-config
--- base-config-2.26/base-config2004-05-30 01:31:50.0 +0200
+++ base-config-2.26-patched/base-config2004-06-11 07:02:56.0 +0200
@@ -11,12 +11,12 @@
export TEXTDOMAIN
# Get the parameter past the script invocation.
-if [ -z $NEW -a $1 = new ]; then
+if [ -z $NEW ] [ $1 = new ]; then
NEW=$1
fi
export NEW
-if [ -x /usr/bin/script -a -z $BASE_CONFIG_IN_SCRIPT ]; then
+if [ -x /usr/bin/script ] [ -z $BASE_CONFIG_IN_SCRIPT ]; then
# We want this program to run inside script. So if it's not already
# running, run script.
export BASE_CONFIG_IN_SCRIPT=1
@@ -59,7 +59,7 @@
if [ $NEW ]; then
# Trap most signals because a ctrl-c killing base-config
# in the middle of the second stage install would be bad.
- trap 1 2 3 15
+ trap HUP INT QUIT TERM
if [ $KEEP_DEBS != yes ]; then
# Free up some disk space used by the debs that debootstrap
@@ -70,7 +70,7 @@
else
# Running again on an existing install. Just trap ctrl-c, and
# cleanly exit.
- trap cleanup 2
+ trap cleanup INT
fi
ORIG_PRIORITY=$(get_priority)
diff -ur base-config-2.26/lib/menu/hostname base-config-2.26-patched/lib/menu/hostname
--- base-config-2.26/lib/menu/hostname 2004-05-30 01:31:49.0 +0200
+++ base-config-2.26-patched/lib/menu/hostname 2004-06-11 07:32:03.0 +0200
@@ -23,7 +23,7 @@
# The interface testing work best if the loopback device is skipped.
# Sorted order to test eth1 before eth0, so that the setting in eth0
# is the one that take effect
- interfaces=`netstat -i | tail +3 | awk '{print $1}' | grep -v '^lo$' | sort -r`
+ interfaces=`netstat -i | tail -n+3 | awk '{print $1}' | grep -v '^lo$' | sort
-r`
for interface in $interfaces; do
ip=`/sbin/ifconfig $interface 21 | grep 'inet addr:' | tr a-zA-Z:
| awk '{print $1}'`
if [ $ip ]; then
@@ -53,7 +53,7 @@
if [ 2 -gt $length ] || [ $length -ge 63 ]; then
return