Sorry about the delay in getting back to you.
I corrected a missing a backquote on line 14 and now the script works
as it should on my computer, running Fedora Core 3. None of this code
uses OS specific functions and it should run on any computer that will
automaticly run the autorun script and has the following: sh (in FC3
sh is a symlink to bash, which works fine), which, sed, pidof (not
vital, only used to see if KDE is running, but should come with every
Linux distribution), and a web browser (Firefox, Mozilla, Opera,
Konqueror, or htmlview configured to run an installed browser, the
scrip can easily be rewritten to look for other browsers too).
It sounds like you are burning from Linux, because you asked if the
executable permissions will be preserved so, yes, mkisofs (or any
utility, like Gtoaster that, uses mkisofs) will preserve your file
permissions. All of the files I coppied to CD and to my flash drive
from Windows have had the executeable permission set (turned on) when
I have examined them in Linux so, if you are burning from Windows,
this will probably not be a problem.
I was unable to test UDF, so I am unable to provide you with any first
hand information there, but I don't know why you would go out of your
way to create a UDF disc when ISO9660 is generally the default for
most software.
If you are initially saving this script in Windows you will want to
convert it before you try running it because Windows ends each line
with a carriage return and a line feed, whereas Linux uses only a line
feed and this may cause the script to fail. This can be accomplished
using the following command:
dos2unix -c ascii autorun.txt
As for the script itself, here it is, as tested.
#!/bin/sh
# Determine path to cdrom
cdrompath=$(echo $0 |sed 's/\/autorun//')
# Try to locate a suitable HTML viewer.
htmlviewspec=`/usr/bin/which htmlview` 2> /dev/null
firefoxspec=`/usr/bin/which firefox` 2> /dev/null
mozillaspec=`/usr/bin/which mozilla` 2> /dev/null
operaspec=`/usr/bin/wich opera` 2> /dev/null
konquerorspec=`/usr/bin/which konqueror` 2> /dev/null
# Determine if KDE is running
pidofkwm=`/sbin/pidof kwm`
# Set htmlviewer to the full path and file name of the web browser to use
# Prefered browsers should be before depreciated ones to give them priority
if [ ! $htmlviewspec = "" ] ; then
htmlviewer=$htmlviewspec
elif [ ! $pidofkwm = "" ] ; then
if [ ! $konquerorspec = "" ] ; then
htmlviewer=$konquerorspec
fi
elif [ ! $firefoxspec = "" ] ; then
htmlviewer=$firefoxspec
elif [ ! $mozillaspec = "" ] ; then
htmlviewer=$mozillaspec
elif [ ! $operaspec = "" ] ; then
htmlviewer=$operaspec
fi
# Open an HTML file from CD using selected web browser
exec $htmlviewer $cdrompath/some_folder/some_file.html |