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.

Reply via email to