Automount USB drives
Branch: master
Clone or download
raamsri Read only the required udev values
Unlike the drives with dos partion tables, gpt tables allow partition
lables. `blkid -o udev` doesn't escape white spaces of
`ID_FS_PARTLABEL`, so `eval` of that command fails.

Though `eval` is not the right approach, as a quick workaround, read
only the necessary entries from `blkid` output before passing it to
`eval`.

Addresses #4

Signed-off-by: Raamsri KP <raam@tinkershack.in>
Latest commit 4a54344 May 5, 2018

README.md

Automount USB drives with systemd

This is a dirty solution; but works. A good approach would be to use libudev.

On inserting an USB drive, automounts the drive at /media/ as a directory named by device label; just the device name if label is empty: /media/usbtest, /media/sdd

Tracks the list of mounted drives in /var/log/usb-mount.track.

Logs the actions in /var/log/messages with tag 'usb-mount.sh'

Please do not expect it to perfectly handle all your needs. Be warned, minimally tested; okay for temporary plug-ins but certainly not recommended for enclosures with longer TTL.

To setup, run CONFIGURE.sh with sudo or as root; REMOVE.sh to undo the setup.