hotplug-mount.pl is a port of Christophe Combelles' updfstab shell script to Perl 5.6 and later. hotplug-mount.pl is meant to not update /etc/fstab but an autofs map. REQUIREMENTS ============ Therefore installation of the following programs is needed: perl - anything from perl 5.6 on should work disktype - to determine the contents of disks/partitions autofs - this package contains the automount daemon and the usual requirements of updfstab: udev hotplug a kernel with sysfs and hotplug support INSTALLATION ============ The default configuration is accomplished with the following setup for automount: 1. in /etc/auto.master add the line ----------------->8---------------------------------------------------- /media/hotplug /etc/auto.hotplug --timeout=60 --ghost ----------------->8---------------------------------------------------- 2. create /etc/auto.hotplug (the dummy entry is necessary because of a bug in autofs, or rather not really a bug but an undocumented behaviour) ----------------->8---------------------------------------------------- # dummy entry to prevent automount from dying .dummy --fstype=none :/dev/null ----------------->8---------------------------------------------------- 3. copy hotplug-mount.pl to /etc/dev.d/default/hotplug-mount.dev and change its mode to executable if it's not already: # chmod 744 /etc/dev.d/default/hotplug-mount.dev 4. hotplug-mount.pl is currently in an early but working development state. You will probably want to change the line reading my $debug=1; to my $debug=0; after successful installation. WHAT hotplug-mount PROVIDES =========================== On insertion/plugin of usb-storage/firewire sbp2 (sbp2 is the name of the protocol firewire disks use) the script will add an entry like this: ----------------->8---------------------------------------------------- # hotplug-mount mobile_data -fstype=xfs,noexec,nodev,nosuid,noatime :/dev/sdc5 ----------------->8---------------------------------------------------- (in this case for my usb disk I use to take my home dir with me) to the automount map /etc/auto.hotplug. On disconnect/removal of media, the entry will be removed. There will be an entry for every partition recognized on inserted media. Because I only have so many USB devices I ask fellow users to provide entries for filesystems I haven't covered or email me to provide experimental versions. After the map has been modified the corresponding automount daemon will be notified of the change and reload the map a "ls" of the /media/hotplug directory will then show like this: $ ls -l /media/hotplug/ dr-xr-xr-x 2 root root 0 Jan 5 23:25 mobile_data And if you cd into /media/hotplug/mobile_data /dev/sdc5 will be mounted automatically. CONFIGURABLE ASPECTS OF HOTPLUG-MOUNT ===================================== Configuration does currently mean editing of the script, the following lines might be of interest (lines 51+): my $mapfile='/etc/auto.hotplug'; my $mapdir='/media/hotplug'; $mapfile and $mapdir correspond to the automount map and daemon to be modified by hotplug-mount respectively.