-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c34bf2e
commit 960956e
Showing
8 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assets/bf1942 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
assets/*.run | ||
assets/*.tar.gz | ||
assets/bf1942 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:14.04 | ||
|
||
MAINTAINER Chris Grimmett <[email protected]> | ||
|
||
# add server assets to container | ||
ADD ./assets /srv/assets | ||
|
||
# satisfy some deps | ||
RUN apt-get update && apt-get -y install wget expect | ||
|
||
# setup battlefield server package | ||
# * downloads needed bf server files | ||
# * extracts 1.6 files | ||
# * patches to 1.61 | ||
RUN bash -x /srv/assets/setup.sh | ||
|
||
# open ports for BF server | ||
EXPOSE 14567 | ||
|
||
# run battlefield server | ||
# RUN bash -x /srv/assets/bf1942/start.sh #dont do this here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
af60e2a2abd3a142da248276d558d43a *bf1942_lnxded-1.6-rc2.run | ||
7534f940c5e0db0bc0653a2b37076622 *bf1942-update-1.61.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/expect | ||
|
||
spawn "/home/chris/scripts/bff/assets/bf1942_lnxded-1.6-rc2.run" --keep | ||
|
||
expect { | ||
timeout { send_user "\ntimeout in extraction\n"; exit 1 } | ||
eof { send_user "\nunexpected eof in extraction\n"; exit 1 } | ||
"*ress return" | ||
} | ||
|
||
send "^c" | ||
|
||
send_user "\nfinished\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
serverFile='/tmp/bf1942_lnxded-1.6-rc2.run' | ||
patchFile='/tmp/bf1942-update-1.61.tar.gz' | ||
|
||
|
||
# verify needed files are downloaded | ||
# download the server if it's not already downloaded | ||
if [[ ! -e $serverFile ]]; then | ||
echo 'downloading 1.6 server' | ||
wget 'https://www.dropbox.com/s/dnjan96ol1t5rms/bf1942_lnxded-1.6-rc2.run?dl=0' -O $serverFile | ||
fi | ||
|
||
# download patch if not already downloaded | ||
if [[ ! -e $patchFile ]]; then | ||
echo 'downloading 1.61b patch' | ||
wget 'https://www.dropbox.com/s/9sfg0hd8xae42r5/bf1942-update-1.61.tar.gz?dl=0' -O $patchFile | ||
fi | ||
|
||
# copy downloaded files in tmp dir to current dir | ||
cp $serverFile /srv/assets | ||
cp $patchFile /srv/assets | ||
|
||
# verify downloaded files are valid | ||
cd /srv/assets | ||
md5sum -c MD5SUMS | ||
|
||
if [[ $? -ne 0 ]]; then | ||
echo 'downloaded file integrity check failed' | ||
else | ||
echo 'downloaded files are full of integrity' | ||
fi | ||
|
||
# extract 1.6 files | ||
./extract | ||
|
||
# patch to 1.61 | ||
tar -xvf ./bf1942-update-1.61.tar.gz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
# send heartbeat to the new master server (workaround for gamespy shutdown) | ||
echo '109.71.69.254 master.gamespy.com' >> /etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# battlefield 1942 upstart script | ||
description "start and stop battlefield 1942 server" | ||
version "0.1" | ||
author "Chris Grimmett <[email protected]>" | ||
|
||
# config | ||
env BF1942_HOME=/srv | ||
env BF1942_PORT=145678 | ||
env BF1942_HOST=0.0.0.0 | ||
env BF1942_EXEC=$BF1942_HOME/start | ||
|
||
# tell upstart we're creating a daemon | ||
expect fork | ||
|
||
# start when filesystems and network device are up, | ||
# stop when powering down or rebooting | ||
start on (local-filesystems and net-device-up) | ||
stop on runlevel [!2345] | ||
|
||
pre-start script | ||
#cd $BF1942_HOME | ||
#exec /usr/bin/bash $BF1942_EXEC | ||
#emit bf1942_starting | ||
end script | ||
|
||
|
||
script | ||
cd $BF1942_HOME | ||
exec bin/bash $BF1942_EXEC $BF1942_HOST:$BF1942_PORT & | ||
emit bf1942_running | ||
end script | ||
|