LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Call of Duty 1.4 Dedicated Linux Server Script (https://www.linuxquestions.org/questions/programming-9/call-of-duty-1-4-dedicated-linux-server-script-273279/)

fotoguy 01-03-2005 08:53 AM

Call of Duty 1.4 Dedicated Linux Server Script
 
The other week I wanted to install a Call of Duty dedicated linux server, so i set about making and install script to help make loading it on other machines a lot easier, and also so I don't have to keep going over the same thing over and over.

All you need is to download the Call of Duty dedicated linux binaries (large) approx 180 mb, extract the tar file, then copy my script to the main directory of the extracted binaries. The script will create the directories, install the binaries files to the right directories and install all data files required from both retail cd's. For the server to run you will need to configure the server.cfg and map_rotation files for the server to function.

I've made it for install from either mandrake 10 official and Suse 9.2, it may also work for other distros, I just don't know how the other distro setup their cdroms. I'm not a programmer, or know anything about scripting, but I thought I would post this script since it was my first, others may find it useful as well.

I would like to make the script a bit more professional, like being able to check for the right cd before installing, and maybe even a nice little GUI for the installation, maybe someone could lend some advice or point me in the direction of some good reference material.


#!/bin/bash
osch=0

echo ""
echo ""
echo "1. Mandrake 10.0 Official Release"
echo "2. Suse 9.2"
echo ""
echo -n "Select your os choice and then hit the Enter Key [1 or 2]? "
echo ""
read osch

if [ $osch -eq 1 ] ; then

echo ""
echo ""
echo ""
echo "This Will Install A Call of Duty Dedicated 1.4 Linux Server"
echo ""
echo "On Mandrake 10.0 Official Release"
echo ""
echo "This may also work on ealier versions of Mandrake"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
# Make the game directory
mkdir /usr/local/games/codserver


# This will copy all the files required for the server
# Call of Duty Disc 1
umount /dev/cdrom /mnt/cdrom
eject /mnt/cdrom
echo ""
echo ""
echo "Please Insert Call of Duty Disc 1"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
eject -t /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/Setup/Data -rfv /usr/local/games/codserver


# This will copy all the files required for the server
# Call of Duty Disc 2
umount /dev/cdrom /mnt/cdrom
eject /mnt/cdrom
echo ""
echo ""
echo "Please Insert Call of Duty Disc 2"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
eject -t /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/Setup/Data -rfv /usr/local/games/codserver

echo ""
echo ""
echo "Installing Linux Binaries"
echo ""
echo ""

cp -rfv languages /usr/local/games/codserver
cp -rfv pb /usr/local/games/codserver
cp -rfv main /usr/local/games/codserver
cp -rfv cod_lnxded /usr/local/games/codserver


umount /dev/cdrom /mnt/cdrom
eject /mnt/cdrom
echo ""
echo ""
echo "Call of Duty Dedicated 1.4 Linux Server"
echo ""
echo "Successfuly Installed"
echo ""
echo -n "Please remove your CD-ROM and Press the enter key"
echo ""
echo ""
read
eject -t /mnt/cdrom


else

if [ $osch -eq 2 ] ; then


echo ""
echo ""
echo ""
echo "This Will Install A Call of Duty Dedicated 1.4 Linux Server"
echo ""
echo "On Suse 9.2 This may also work on ealier versions of Suse"
echo ""
echo "This may also work on ealier versions of Suse"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
# Make the game directory
mkdir /usr/local/games/codserver


# This will copy all the files required for the server
# Call of Duty Disc 1
umount /dev/cdrecorder /media/cdrecorder
eject /media/cdrecorder
echo ""
echo ""
echo "Please Insert Call of Duty Disc 1"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
eject -t /media/cdrecorder
mount /dev/cdrecorder /media/cdrecorder
cp /media/cdrecorder/Setup/Data -rfv /usr/local/games/codserver


# This will copy all the files required for the server
# Soldier of Fortune 2 Disc 2
umount /dev/cdrecorder /media/cdrecorder
eject /media/cdrecorder
echo ""
echo ""
echo "Please insert Call of Duty Disc 2"
echo ""
echo -n "Press the enter key to continue."
echo ""
echo ""
read
eject -t /media/cdrecorder
mount /dev/cdrecorder /media/cdrecorder
cp /media/cdrecorder/Setup/Data -rfv /usr/local/games/codserver

echo ""
echo ""
echo "Installing Linux Binaries"
echo ""
echo ""

cp -rfv languages /usr/local/games/codserver
cp -rfv pb /usr/local/games/codserver
cp -rfv main /usr/local/games/codserver
cp -rfv cod_lnxded /usr/local/games/codserver


umount /dev/cdrecorder /media/cdrecorder
eject /media/cdrecorder
echo ""
echo ""
echo "Call of Duty Dedicated 1.4 Linux Server"
echo ""
echo "Successfuly Installed"
echo ""
echo -n "Please remove your CD-ROM and Press the enter key"
echo ""
echo ""
read
eject -t /media/cdrecorder


fi
fi

bigearsbilly 01-04-2005 05:42 AM

try using the 'select' command for user choices.
(see man select bash or ksh)

also, IMHO lots of echo's looks untidy,
maybe:

Code:

cat <<EOF

lots
of lines
of stuff

EOF

a bit neater maybe?

as for checking CD, is there an info file on it you can check
like a file called disk1 or something?

GUI would be a job for TCL or python maybe.


regards billy

fotoguy 01-05-2005 03:29 AM

Yeah lots of echos, does need to be tidier. Thanks for the tips.


All times are GMT -5. The time now is 09:34 PM.