mdev automount questions

Denys Vlasenko vda.linux at googlemail.com
Fri May 18 14:25:43 UTC 2012


On Mon, May 14, 2012 at 11:04 AM, walter harms <wharms at bfs.de> wrote:
> Am 14.05.2012 09:45, schrieb Walter Dnes:
>>   This really should be a separate topic.  Sorry for derailing the wifi
>> question.
>>
>> On Sun, May 13, 2012 at 12:16:37PM +0200, Laurent Bercot wrote
>>
>>>  Just have a single rule for /dev/sd* and have a
>>>   if [ "$DEV" = "/dev/sda" ] ; exit 0
>>> line at the beginning of your rule script. (Maybe $DEV isn't the right
>>> variable name, I don't remember.)
>>
>>   A couple of options...
>>
>> 1) The comments in /lib/mdev/usbdisk_link say
>> # NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars.
>> Can I use the lack of an ACTION var to assume that this call is from
>> "mdev -s" (i.e. bootup), whereas if ACTION is present, assume that it's
>> a hotplug

Yes.
"mdev -s" exports only $MDEV and $SUBSYSTEM.
(Maybe we need to export $DEVPATH too (/sys/... path to the device)?
We know it...)


>> if [ "X${ACTION}" == "X" ]; then
>
> a bit off-topic but ...
> adding a char to avoid comparision to "" is to avoid an ancient bug.

It is a guard against $ACTION value starting with dash.
If ACTION is "-f" then

if [ "$ACTION" -eq "add" ]  =>  if [ -f -eq add ]

and I'm not sure all shells (even bbox ones) have no bugs
where they will not be fooled to think that -f is an operator!

> Is this "fix" realy in the commen busybox example ?

It's healthy paranoia :)

-- 
vda


More information about the busybox mailing list