Skip to contentSkip to conversation

I don't want much...

DISCUSSION David Greaves 2 participants 2 messages Jul 24, 2004

lore
Share & tools
lore
#0 lore raw

Hi

This overview page:
http://linux-hotplug.sourceforge.net/?selected=overview
Says that a "Starting an application" is a reasonable thing to want to do.

I just want to run a script.
A simple script.
That's it.
Why on earth is it so hard?

Hmm, maybe not the best tone to start with - but isn't hotplugging about making the user's life easier?
It's cool that it automatically loads my modules.
Now all I have to do is start a shell and type: mount -t vfat -o uidÚvid,gid=greaves,sync /dev/sda1 /mnt/lexar
Not exactly plug-and-play is it?

When I plug in my Lexar Jumpshot I want to mount the drive and rsync my piccies.
What happens?
I get a usb event
then a scsi-host event
then a scsi event
then a block event
and another block event
then a scsi-device event

Fine.
So I add a usermap tied to the usb vendor/product id (the 'right' place) and create a dummy module called lexar.script with a control script. It runs - good.
At the wring time (ie before the scsi devices are registered) - bad.

Do I really have to hack into the generic scsi-device agent?

David

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 2 lines · On Sat, 24 Jul 2004 22:34:35 +0100 David Greaves <[email protected]> wrote:

Now all I have to do is start a shell and type: mount -t vfat -o uid=david,gid=greaves,sync /dev/sda1 /mnt/lexar

(...)

Quoted 2 lines

When I plug in my Lexar Jumpshot I want to mount the drive and rsync my piccies.

(...)

Quoted 4 lines

So I add a usermap tied to the usb vendor/product id (the 'right' place) and create a dummy module called lexar.script with a control script. It runs - good.
At the wring time (ie before the scsi devices are registered) - bad.

It worked well for me with my usb stick, I put the script, called the same as the entry in the usb.usermap file, in the /etc/hotplug/usb directory, and it worked well, but I assumed the block device was always named the same.

What did put in your script ?

Mine follows:

----->8---cut-here---------
#!/bin/bash
logger -t usbbar Mounting...
err_mesg=/bin/mount /key 2>&1
if [ "$?" == "0" ]; then
logger -t usbbar OK
else
logger -t usbbar Error: $err_mesg
fi
----->8---cut-here---------

(BTW, I had an entry in my fstab)

However, my best advice would be to use udev, and not hotplug only, and to use the dev.d scripts.

Signature · 2 lines
Olivier Mehani <[email protected]>
PGP fingerprint = 3720 A1F7 1367 9FA3 C654  6DFB 6845 4071 E346 2FD1