What I ended up doing:
Already had autofs installed (uses automounter, except it is used on distros other than debian and redhat).
installed cdde (compact disc detection and execution) available at
http://freshmeat.net/cdde
had to write a python script to launch cdde in daemon mode:
Code:
#!/usr/bin/python
import os
pid = file('/var/run/cdde.pid','w')
pgm = 'cdde'
arg = [pgm,'-c','/etc/cdde.xml']
this = os.spawnvp(os.P_NOWAIT,pgm,arg)
pid.write(str(this) + '\n')
pid.close()
Created init.d script:
Code:
#!/bin/bash
# Begin $rc_base/init.d/cdde
source /etc/sysconfig/rc
source $rc_functions
case "$1" in
start)
echo "Starting cdde..."
loadproc /usr/sbin/cdde_py
;;
stop)
echo "Stopping cdde..."
killproc /var/bin/cdde
;;
reload)
echo "Reloading cdde..."
killall -HUP cdde
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
statusproc /usr/bin/cdde
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/cdde
Then I make the init.d script execute on boot up using:
Code:
cd /etc/rc.d/init.d &&
ln -sf ../init.d/cdde ../rc0.d/K25cdde &&
ln -sf ../init.d/cdde ../rc1.d/K25cdde &&
ln -sf ../init.d/cdde ../rc2.d/K25cdde &&
ln -sf ../init.d/cdde ../rc3.d/S35cdde &&
ln -sf ../init.d/cdde ../rc4.d/S35cdde &&
ln -sf ../init.d/cdde ../rc5.d/S35cdde &&
ln -sf ../init.d/cdde ../rc6.d/K25cdde
I modified the /etc/cdde.xml according to the cdde instructions.
Now when I insert a cd, no matter the type, it will launch the desired application accordingly.
Works pretty much how I wanted.
[edit]Small clarification: I use as the command /auto/cdrom, when it is a data cd to get the drive mounted. Then all I do is use the information from it.
If it is an audio cd, I launch an application that rips the cd to mp3's and ejects the cd when complete.
[/edit]
Thanks for all of the pointers. I wouldn't have known where to look for any of the iformation without certian key words.
JN