Results 1 to 6 of 6
Hi Friends,
I like to know the CD-autorun script that can be used to launch a html page present in the CD when I insert that CD into the driver ...
- 08-08-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
CD Autorun in Linux
Hi Friends,
I like to know the CD-autorun script that can be used to launch a html page present in the CD when I insert that CD into the driver of a Linux machine.
I had already tried with the following two different CD-autorun scripts. But, they both didn't work for me.
#!/bin/sh
exec /usr/bin/nautilus index.html
and
#!/bin/sh
htmlview index.html
I'm not sure what mistake I had done. Is there any other way by which we can achieve this CD autorun.
Could you please help me out in getting this work?
Thanks in advance.
A. Balasubramanian
- 08-08-2008 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
Please do not duplicate threads, if you find you are not getting an answer you can bump your original thread after some time has passed.
Original thread
Often autorun is disabled for security reasons. You will find that it has even been disabled in Windows since XP service pack 2.
If you are sure that it has not been disabled, check out this script from here
Code:#! /bin/sh # autorun binary for Linux CDs. Put this file on the CD in the root # directory. It will execute automatically when the CD is inserted. # It looks for a browser and runs it on index.html or similar. # Copyleft 1999, 2000, 2001, 2002 Silmaril Consultants # Terms of the GNU General Public License apply. ################################################################### BROWSER=`which mozilla 2>&1` if [ ! -x "$BROWSER" ]; then BROWSER=`which netscape` if [ ! -x "$BROWSER" ]; then BROWSER=`which opera` if [ ! -x "$BROWSER" ]; then BROWSER=`which konqueror` if [ ! -x "$BROWSER" ]; then echo No known browser available exit 1 fi fi fi fi HOMEPAGE=`grep homepage autorun.inf | awk 'BEGIN {FS="="} {print $2}'` if [ ! -f "$HOMEPAGE" ]; then $BROWSER /media/cdrom & fi $BROWSER $HOMEPAGE & exit 0
- 08-08-2008 #3Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
Hi Bigtomrodinator,
I'm sorry for the thread duplication. This won't happen in future from my side. I just thought to bring this issue to the notice of more legends.
Moreover, I had a look at this script. In this sample, they have hard-coded the path of index.html. The mount point(i.e. directory) may be different from machine to machine based on where they mounted the cdrom. If I try to get the mount point of cdrom from etc/fstab, still I require the device name which can be vary based on what IDE user used to mount the cdrom.
Could you please let me know if you have any idea in resolving this?
- 08-08-2008 #4Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
I think this script is quite old. A good trick these days is that udev will mount it at /media/ with the volumename. So if the CD title is CDROM it will be mounted at /media/CDROM.
However, that said I always think it's a bad idea to hardcode any path. You can use the dirname command combined with the special variable $0 which contains the name and path of the script. You can then work out the location of the CD mount point - assuming that the autorun is at the root where it should be - with the followingI have a suspicion that the script will execute from its directory. In that case the $PWD variable or the pwd command will give you the current working directory.Code:CURRENTDIR=$(dirname $0)
With all of that said the difficulty is whether a distro allows autorun at all, and if the parameters it runs with are compatible with what you need.
- 08-09-2008 #5Just Joined!
- Join Date
- Aug 2008
- Posts
- 4
Thanks for your thoughts on this issue, Bigtomrodinator. It could also be that the autorun feature is disabled in some of the distro because of security reasons, as you said. But, this is not confirmed. I had tried a script both in Red-hat and Suse. While that script works in Red-hat, it does not work in Suse.
Thank you once again for showing interest and providing information on this problem.
- 08-09-2008 #6Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
No problem bala_isthere, sorry we didn't get the result you were looking for


Reply With Quote
