Package: nbd-client Version: 1:2.8.4-1 Severity: normal Tags: patch Hi,
as you've requested in debian-devel, here is a patch for the init script.
The idea is simply to replace the array $foo[n] by different variables
$foo_n and use eval to get their values.
#v+
--- /etc/init.d/nbd-client 2006-01-31 12:20:38.000000000 +0100
+++ /tmp/nbd-client 2006-05-20 17:43:18.544319149 +0200
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
# We use some bashisms (arrays), so /bin/sh won't work.
# I hope this is policy-compliant; I couldn't find anything different,
# but if so, I'm gonna need help here to find a better way of handling
@@ -35,11 +35,11 @@
modprobe -k nbd
echo -n 'Connecting...'
i=0
- while [ ! -z ${NBD_DEVICE[$i]} ]
+ while eval [ ! -z \${NBD_DEVICE_$i} ]
do
- $DAEMON ${NBD_HOST[$i]} ${NBD_PORT[$i]} ${NBD_DEVICE[$i]}
- echo "connected ${NBD_DEVICE[$i]}"
- i=`expr $i + 1`
+ eval $DAEMON \${NBD_HOST_$i} \${NBD_PORT_$i} \${NBD_DEVICE_$i}
+ eval echo "connected \${NBD_DEVICE_$i}"
+ i=$(($i + 1))
done
;;
start)
@@ -50,36 +50,37 @@
activate)
echo 'Activating...'
i=0
- while [ ! -z ${NBD_DEVICE[$i]} ]
+ while eval [ ! -z \${NBD_DEVICE_$i} ]
do
- case ${NBD_TYPE[$i]} in
+ eval device=\${NBD_DEVICE_$i} type=\${NBD_TYPE_$i}
+ case $type in
"s")
- /sbin/swapon ${NBD_DEVICE[$i]}
- echo "${NBD_DEVICE[$i]}: swap activated."
+ /sbin/swapon $device
+ echo "$device: swap activated."
;;
"f")
spinner="-C"
case "$TERM" in
dumb|network|unknown|"") spinner="" ;;
esac
- /sbin/fsck $spinner -a ${NBD_DEVICE[$i]}
+ /sbin/fsck $spinner -a $device
if [ $? -lt 2 ]
then
- /bin/mount ${NBD_DEVICE[$i]}
- echo "${NBD_DEVICE[$i]}: filesystem mounted."
+ /bin/mount $device
+ echo "$device: filesystem mounted."
else
- echo "fsck of ${NBD_DEVICE[$i]} failed. Not mounting."
+ echo "fsck of $device failed. Not mounting."
fi
;;
"r")
# Nothing needs to be done
- echo "${NBD_DEVICE[$i]}: raw selected. doing nothing."
+ echo "$device: raw selected. doing nothing."
;;
*)
- echo "Error: NBD_TYPE[$i] contains unknown value
${NBD_TYPE[$i]}"
+ echo "Error: NBD_TYPE_$i contains unknown value $type"
;;
esac
- i=`expr $i + 1`
+ i=$(($i + 1))
done
echo "$NAME."
;;
#v-
You can update the config files in postinst with
sed -i -e 's/\[\([[:digit:]]*\)\]/_\1/' /etc/nbd-client
Hope this helps you.
Bye, Jörg.
-- System Information:
Debian Release: unstable/experimental
APT prefers unstable
APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-rc4
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Versions of packages nbd-client depends on:
ii debconf [debconf-2.0] 1.5.1 Debian configuration management sy
ii libc6 2.3.6-7 GNU C Library: Shared libraries
nbd-client recommends no packages.
-- debconf information excluded
pgpPBJgF2EOLY.pgp
Description: PGP signature

