remove bashisms from hotplug
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
Signature · 2 lines
ciao, | Marco | [3276 svFzLScsoTJLw]
hotplug.functions +0 -11
@@ -47,17 +47,6 @@ mesg "$@" } -# -# The modules.*map parsing uses BASH ("declare -i") and some version -# of AWK, typically /bin/gawk. Most GNU/Linux distros have these, -# but some specialized ones (floppy based, etc) may not. ("type -p" -# is also a bash-ism, more robust than "which".) -# -AWK=`type -p gawk` -if [ "$AWK" = "" ]; then - AWK=`type -p awk` -fi - # # Not "modprobe --autoclean" ... one driver module can handle many
ieee1394.agent +11 -10
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # IEEE1394-specific hotplug policy agent. #
@@ -24,7 +24,7 @@ # cd /etc/hotplug -. hotplug.functions +. ./hotplug.functions # DEBUG=yes export DEBUG # generated by modutils 2.4.9 or later, for 2.4.10 and later kernels
@@ -39,12 +39,10 @@ fi -declare -i device_vendor_id device_specifier_id device_version -device_vendor_id="0x$VENDOR_ID" -device_specifier_id="0x$SPECIFIER_ID" -device_version="0x$VERSION" +device_vendor_id=$((0x$VENDOR_ID)) +device_specifier_id=$((0x$SPECIFIER_ID)) +device_version=$((0x$VERSION)) -declare -i MATCH_VENDOR_ID MATCH_SPECIFIER_ID MATCH_VERSION MATCH_VENDOR_ID=0x0001 MATCH_SPECIFIER_ID=0x0004 MATCH_VERSION=0x0008
@@ -56,8 +54,11 @@ ieee1394_map_modules () { local module ignored - declare -i match_flags vendor_id model_id - declare -i specifier_id version + + # convert from hex to dec + match_flags=$(($match_flags)) + vendor_id=$(($vendor_id)); model_id=$(($model_id)) + specifier_id=$(($specifier_id)); version=$(($version)) # comment line lists (current) pci_device_id field names read ignored
@@ -98,7 +99,7 @@ load_drivers ieee1394 $MAP_CURRENT "$LABEL" fi - if [ "$DRIVERS" == "" ]; then + if [ "$DRIVERS" = "" ]; then mesg "... no drivers for $LABEL" exit 2 fi
pci.agent +20 -29
94 lines not on this page · raw message
pci.rc +41 -34
92 lines not on this page · raw message
firmware.agent +1 -1
@@ -16,7 +16,7 @@ # cd /etc/hotplug -. hotplug.functions +. ./hotplug.functions # DEBUG=yes export DEBUG # directory of the firmware files
input.agent +47 -48
148 lines not on this page · raw message
input.rc +2 -2
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # input.rc This loads handlers for those input devices # that have drivers compiled in kernel
@@ -61,7 +61,7 @@ export PRODUCT NAME PHYS EV KEY REL ABS MSC LED SND FF input_reset_state - declare line + local line # # the following reads from /proc/bus/input/devices. It is inherently
net.agent +2 -2
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Network hotplug policy agent for Linux 2.4 kernels #
@@ -17,7 +17,7 @@ # cd /etc/hotplug -. hotplug.functions +. ./hotplug.functions # DEBUG=yes export DEBUG if [ "$INTERFACE" = "" ]; then
NOTES +9 -0
@@ -0,0 +1,9 @@ +usb.rc: +- PCI hotplugging is supported when sysfs is present, the HC code should + be removed or made conditional to 2.4 kernels +- rmmod will always fail with some 2.6 kernel configurations, so it cannot + be used to check if everything has been loaded +- could maybe_stop_usb() be improved now? + +firmware.agent: +- /usr/lib/hotplug/firmware should become /usr/share/hotplug/firmware.
scsi.agent +2 -2
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # SCSI hotplug agent for 2.5 kernels #
@@ -7,7 +7,7 @@ # cd /etc/hotplug -. hotplug.functions +. ./hotplug.functions case $ACTION in
usb.agent +48 -55
176 lines not on this page · raw message
usb.rc +34 -9
80 lines not on this page · raw message
hotplug.functions +1 -1
@@ -81,7 +81,7 @@ # ought to expose the data we need to find all candidate drivers. # (on 2.5.48 it does for usb; but maybe not yet for pci.) case "$KERNEL" in - 2.2*|2.3*|2.4*) LISTER=`type -p ${TYPE}modules` ;; + 2.2*|2.3*|2.4*) LISTER=`which ${TYPE}modules` ;; *) LISTER="" ;; esac
pci.rc +1 -1
@@ -44,7 +44,7 @@ else - LISTER=`type -p pcimodules` + LISTER=`which pcimodules` if [ "$LISTER" = "" -o ! -f /proc/bus/pci/devices -o ! -x pci.agent ]; then echo $"** can't synthesize pci hotplug events" return
Quoted 2 lines · * Marco d'Itri ([email protected]) wrote:
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
[snip patch]
I'd just like to say that I'd love to see the bashisms removed upstream. I've been using a similar patch to remove the bashisms for my embedded distributions locally for some time now. --
Chris Larson - kergoth at handhelds dot org
Embedded Linux Developer - clarson at ti dot com OpenZaurus Project Maintainer - http://openzaurus.org/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · begin Chris Larson
Quoted 2 lines · * Marco d'Itri ([email protected]) wrote:
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
[snip patch]
I'd just like to say that I'd love to see the bashisms removed upstream. I've been using a similar patch to remove the bashisms for my embedded distributions locally for some time now.
But why upstream want to remove bashism? I did subited an offert some time ago, but I don't get any reaction.
Jörg.
end.
Signature · 13 lines
Damit das Mögliche entsteht, muß immer wieder das Unmögliche versucht werden. (Hermann Hesse) ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Marco d'Itri
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
I have sent these patches multiple times to multiple people and then to the mailing list. Does anybody feel responsible for hotplug nowadays?
Signature · 13 lines
ciao, | Marco | [3535 asesN5f7W3Xng] ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 6 lines · Marco d'Itri
Quoted 2 lines · Marco d'Itri
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
I have sent these patches multiple times to multiple people and then to the mailing list. Does anybody feel responsible for hotplug nowadays?
I'd bug David Brownell, as he's the primary author/maintainer of the bash scripts.
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 4 lines · Greg KH
Quoted 2 lines · Marco d'Itri
On Nov 25, Marco d'Itri <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
I have sent these patches multiple times to multiple people and then to the mailing list. Does anybody feel responsible for hotplug nowadays?
I'd bug David Brownell, as he's the primary author/maintainer of the bash scripts.
... who hasn't been merging many patches or even keeping up with the hotplug list lately, sorry. And it didn't help that some of Greg's email to me seems to trashed by a bad spam filter lately, I'm not sure why ... :-(
I think it's right to get rid of bash-isms, and will see if I can get on top of most of the script patches in the next month or so.
- Dave
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 2 lines · Marco d'Itri
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
Bugfix, to be applied on top of the other patches.
Signature · 2 lines
ciao, | Marco | [3784 tiJkekUnVwCzw]
input.agent +1 -2
@@ -164,7 +164,7 @@ set $line - module=$(($1)) + module=$1 matchBits=$(($2)) bustype=$(($3))
@@ -173,7 +173,6 @@ product=$(($6)) evBits=$(($7)) -echo "|||$8|||" keyBits=$(($8)) relBits=$(($9))
input.rc +1 -1
@@ -81,7 +81,7 @@ P:* ) # Physical eval "${line#P: }" PHYS=$Phys - ;; + ;; B:* ) # Controls supported line="${line#B: }" eval "${line%%=*}=\"${line#*=}\""
usb.agent line 205
Quoted 13 lines · Marco d'Itri
These patches remove bashisms from hotplug (tested with the debian dash shell) and add (partial) support for sysfs.
usb.agent +3
-3@@ -208,14 +200,14 @@ if [ "$INTERFACE" != "" ]; then IFS=/ set $INTERFACE '' - usb_bInterfaceClass=$1 - usb_bInterfaceSubClass=$2 - usb_bInterfaceProtocol=$3 + usb_bInterfaceClass=$((0x$1)) + usb_bInterfaceSubClass=$((0x$2)) + usb_bInterfaceProtocol=$((0x$3))
This doesnt match reality.
drivers/usb/core/usb.c: "INTERFACE=%d/%d/%d",
Signature · 14 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel