On Sun, Jul 26, 2015 at 11:18:58PM -0400, Steve Litt wrote:
> You can roll your own automount with one day's work using inotify-wait,
> dmesg, sudo, lsblk, and the mount command. Works without X or window
> manager. Heck, I'll do it myself if more than 20 people want it.
Or you can do it with mount, sudo, sh, and nlmon (
http://git.r-36.net/nlmon).
Here's a demo of how to do it:
./nlmon -f block | { \
while read LINE
do
case "x$LINE" in
(xACTION=*|xDEVNAME=*) eval $LINE
;;
(x) if [ "x$DEVNAME" != "x" ]
then
echo "automount $DEVNAME $ACTION"
fi
unset ACTION DEVNAME
;;
esac
done
}
Only instead of echo automount ..., you would use your mount helper
(pmount, sudo mount, ...)
nlmon reqires only libc-dev, linux-libc-dev, and a working make and
compiler.
I will note, however, that you currently need to make one small change
in nlmon.c before compiling it:
change "write(0," to "write(1,".
This example can be run from a user session; if one prefers, the automounter
could be replaced with a popup or anything else.
HTH,
Isaac Dunham