hotplugd(8) mount flash drive

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: OpenBSD Misc <misc@...>
Date: Tuesday, January 29, 2008 - 4:24 am

I am trying to use hotplugd(8) to mount my USB flash drive (/dev/sd1i)
automatically in /mn/flash when I plug it it. I enabled hotplugd in
/etc/rc.conf.local and wrote the following script (chmod +x bit set)

#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
2)
# disk devices

disklabel=`/sbin/disklabel $DEVNAME 2>&1 | \
sed -n '/^label: /s/^label: //p'`
case $disklabel in
flash)
# flash drive
mount /dev/"$DEVNAME"i /mnt/flash
;;
esac
;;
3)
# network devices

/sbin/dhclient $DEVNAME

;;
esac

I can mount the flash drive fine with mount /dev/sd1i /mnt/flash

Any help would be much appreciated. Thanks.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
hotplugd(8) mount flash drive, Chris, (Tue Jan 29, 4:24 am)
Re: hotplugd(8) mount flash drive, Chris, (Tue Jan 29, 6:01 am)
Re: hotplugd(8) mount flash drive, Heinrich Rebehn, (Tue Jan 29, 6:35 am)
Re: hotplugd(8) mount flash drive, Chris, (Fri Feb 1, 2:40 am)
Re: hotplugd(8) mount flash drive, Johan Fredin, (Fri Feb 1, 7:30 am)
Re: hotplugd(8) mount flash drive, frantisek holop, (Fri Feb 1, 7:19 am)
Re: hotplugd(8) mount flash drive, Chris, (Fri Feb 1, 7:43 am)
Re: hotplugd(8) mount flash drive, Johan Fredin, (Tue Jan 29, 6:26 am)
Re: hotplugd(8) mount flash drive, frantisek holop, (Tue Jan 29, 11:35 am)