At Wed, 10 Aug 2005 21:29:06 +0100,
Colin Watson wrote:
> A Debian patch to hotplug causes it to require the sed feature whereby,
> if you supply an empty regex, it repeats the previous match:
>
> -SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts)
> +SYSFS=$(sed -n '/^.* \([^ ]*\) sysfs .*$/ { s//\1/p ; q }' /proc/mounts)
>
> While I realise hotplug's probably entitled to depend on this feature
> since it's in POSIX, busybox sed doesn't support it in this context (my
> tests indicate that it works for e.g. two s/// commands in a row, but
> doesn't work for /regex/ { s//replacement/; }).
Hmm, to begin with, it seems busybox sed doesn't support block commands
{..} and q command.
> Would you be willing to accept a workaround for this problem? The patch
> is fairly simple:
>
> diff -u hotplug-0.0.20040329/debian/patches/firmware_misc
> hotplug-0.0.20040329/debian/patches/firmware_misc
> --- hotplug-0.0.20040329/debian/patches/firmware_misc
> +++ hotplug-0.0.20040329/debian/patches/firmware_misc
> @@ -6,7 +6,7 @@
>
> # mountpoint of sysfs
> -SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts)
> -+SYSFS=$(sed -n '/^.* \([^ ]*\) sysfs .*$/ { s//\1/p ; q }' /proc/mounts)
> ++SYSFS=$(grep '^.* [^ ]* sysfs .*$' /proc/mounts | head -n1 | sed 's/^.*
> \([^ ]*\) sysfs .*$/\1/')
>
> # use /proc for 2.4 kernels
> if [ "$SYSFS" = "" ]; then
>
> Debian's hotplug already requires grep and head.
grep is ok, but head is in /usr, so it wouldn't be nice. hotplug
should run without /usr, because /usr may be in some other device that
requires hotplug help to load device drivers.
head command is used in usb.rc, but it is for status subcommand, which
is usually used by administrator, so I think it's ok here.
Anyway, I'll fix it by this patch:
diff -ruN hotplug-2004_03_29.orig/etc/hotplug/firmware.agent
hotplug-2004_03_29/etc/hotplug/firmware.agent
--- hotplug-2004_03_29.orig/etc/hotplug/firmware.agent 2005-08-12
00:25:56.226129789 +0900
+++ hotplug-2004_03_29/etc/hotplug/firmware.agent 2005-08-12
00:25:23.972178157 +0900
@@ -23,7 +23,7 @@
FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware /usr/lib/hotplug/firmware"
# mountpoint of sysfs
-SYSFS=$(sed -n '/^.* \([^ ]*\) sysfs .*$/ { s//\1/p ; q }' /proc/mounts)
+SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts | sed -e '2,$d')
# use /proc for 2.4 kernels
if [ "$SYSFS" = "" ]; then
Regards,
Fumitoshi UKAI
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]