Bochs/bochs/build/linux/bochs-dlx

86 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
BOCHS=/usr/local/bin/bochs
DLXINST=/usr/local/bochs/dlxlinux
GZIP=gzip
if [ ! -z $1 ]; then
DLXPATH=$1
else
DLXPATH=$HOME/.bochs
fi
CONFFILE=$HOME/.bochs/bochsconf
makedlxdir() {
echo DEBUG: Creating $HOME/.bochs/bochsrc
echo DLXPATH=$DLXPATH > $CONFFILE
. $CONFFILE
for file in bochsrc.txt README testform.txt; do
if [ ! -f $DLXPATH/$file ]; then
cp -av $DLXINST/$file $DLXPATH/.
else
echo "ERROR: $file already exists in $DLXPATH. Remove it to replace."
fi;
done
if [ ! -f $DLXPATH/hd10meg.img ]; then
echo Uncompressing $DLXINST/hd10meg.img.gz '->' $DLXPATH/hd10meg.img
$GZIP -dc $DLXINST/hd10meg.img.gz > $DLXPATH/hd10meg.img
else
echo "ERROR: hd10meg.img already exists in $DLXPATH. Remove it to replace."
fi
}
echo -n "Checking for bochs binary..."
if test ! -x $BOCHS; then
echo FAILED
echo ERROR: I could not find bochs in $BOCHS
exit 1
fi
echo ok
echo -n "Checking for DLX linux directory..."
if test ! -d $DLXINST; then
echo FAILED
echo ERROR: I could not find the DLX linux directory.
exit 1
fi
echo ok
echo -n "Checking for $GZIP..."
$GZIP < /dev/null >& /dev/null
if test $? = 0; then
echo ok
else
echo not found
echo ERROR: without $GZIP in your PATH, I cannot continue.
exit 1
fi
echo -n "Checking for $HOME/.bochs directory..."
if test -d "$HOME/.bochs"; then
echo "ok"
if test -f "$CONFFILE"; then
. $CONFFILE
else
makedlxdir
fi
else
echo DEBUG: Creating $HOME/.bochs
mkdir -p $HOME/.bochs
mkdir -p $DLXPATH
makedlxdir
fi
echo Entering $DLXPATH
cd $DLXPATH
# Now that we're in the DLXPATH, make sure that bochsrc.txt & hd10meg.img exist
if test ! -f bochsrc.txt; then
echo ERROR: bochsrc.txt not found
exit 1
fi
if test ! -f hd10meg.img; then
echo ERROR: hd10meg.img not found
exit 1
fi
echo Running bochs
# ok now try it
$BOCHS -nocontrolpanel