More auto-run success

I'm back from a week in an ocean-side cabin on Cape Cod, and I'm feeling refreshed. So refreshed, in fact, that I dusted off my rusty C++ skills and did some hacking on autorun.

For those who don't know about it, autorun is a little program that detects when you insert a CD into a CDROM drive and automatically mounts it and pops up a file manager at the mount point. Yes, this is essentially the same thing I did with udev just a couple of weeks ago. The difference is that since the CDROM devices aren't created dynamically (they're always there, like the hard drives), udev doesn't create anything when you insert a disc. Thus we need a separate program to check if the contents of the drive have changed, which is where autorun comes in.

Now, there's only one problem with autorun: it isn't designed to work with autofs. In fact, half the point of autorun is to automatically mount a CD when it is inserted. Now, in my case, I don't want it to do that, because autofs takes care of that for me. Furthermore, autorun detects mount points from /etc/fstab, which doesn't really work that well for autofs. Thus the need to hack on it.

So, I re-worked autorun a bit so that it now works well with my automounting CDROM and DVD-ROM drives. You pass it the device files on the command line and, if automount is running, it will check /etc/auto.master and get the mount points from the map files listed there. It will also refrain from trying to mount the medium and will just run the notification commands (e.g. kfmclient for data discs and kscd for audio discs) when the medium is changed. This gets me the ability to run commands on a CDROM change, yet still allows me to use automount. Cool.

I realize I'm probably the only person in the world who cares about this, but if you happen to be curious, you can download the patch file here. For those who don't like to deal with patches, I also put up a full patched source archive. If you get an error due to not having xmltoman installed, you can just run touch autorun.1 to update the modtime on the man page and bypass that step of the build.

You can reply to this entry by leaving a comment below. This entry accepts Pingbacks from other blogs. You can follow comments on this entry by subscribing to the RSS feed.

Comments #

    I care!

    Hi peter,

    This is excellent news.
    You are not the only person who cares about this.

    I recently moved from suse to ubuntu and the one thing I missed was the SuSEwatcher program which did the same thing.

    I hope to use your system to perform things like automatic ripping of AudioCDs when inserted, auto playing of DVDs, and automatic installation of games.

    Keep up the grand work.

    Kind regards,
    Cedric.

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.