Created
December 28, 2009 17:19
-
-
Save klette/264786 to your computer and use it in GitHub Desktop.
Small bash script for downloading and installing latest openttd with opensfx and opengfx
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
#!/bin/bash | |
set -e | |
# Simple script for getting and installing latest openttd with opengfx and opensfx | |
# Downloads latest trunk version by default, but if you supply the revision you want | |
# as the first argument, it downloads that version. | |
# | |
# Examples: | |
# | |
# # Get the latest version | |
# ./get_latest_openttd.sh | |
# | |
# # Get a specific revision | |
# ./get_latest_openttd.sh r18641 | |
# Configuration | |
# i686 or amd64 | |
ARCHITECTURE=amd64 | |
OPENTTD_INSTALL_BASE=/home/klette/openttd_installs | |
OPENSFX_VERSION=0.2.1 | |
OPENGFX_VERSION=0.2.1 | |
######################### Do not edit below this line. You will be shot. | |
OPENSFX_URL=http://bundles.openttdcoop.org/opensfx/releases/opensfx-$OPENSFX_VERSION.zip | |
OPENGFX_URL=http://bundles.openttdcoop.org/opengfx/releases/opengfx-$OPENGFX_VERSION.zip | |
function latest_openttd_trunk_version { | |
wget -q http://www.openttd.org/en/download-trunk -O - | grep -o -P 'release in trunk is r(\d+)' | cut -d" " -f5 | |
} | |
function download_trunk_openttd { | |
wget -c http://binaries.openttd.org/nightlies/trunk/$1/openttd-trunk-$1-linux-generic-$ARCHITECTURE.tar.bz2 -O /tmp/$1.tar.bz2 | |
} | |
function extract_trunk_openttd { | |
cd $OPENTTD_INSTALL_BASE ; tar xjpf /tmp/$1.tar.bz2 | |
} | |
function clean_trunk_openttd_dl { | |
rm /tmp/$1.tar.bz2 | |
} | |
function get_and_install_trunk { | |
download_trunk_openttd $1 | |
extract_trunk_openttd $1 | |
clean_trunk_openttd_dl $1 | |
} | |
function get_and_install_opensfx { | |
cd $OPENTTD_INSTALL_BASE/openttd-trunk-$1-linux-generic-$ARCHITECTURE/data | |
wget -c -q $OPENSFX_URL -O /tmp/opensfx-$OPENSFX_VERSION.zip | |
unzip -jo /tmp/opensfx-$OPENSFX_VERSION.zip | |
} | |
function get_and_install_opengfx { | |
cd $OPENTTD_INSTALL_BASE/openttd-trunk-$1-linux-generic-$ARCHITECTURE/data | |
wget -c -q $OPENGFX_URL -O /tmp/opengfx-$OPENGFX_VERSION.zip | |
unzip -jo /tmp/opengfx-$OPENGFX_VERSION.zip | |
} | |
if echo $1 | grep -P 'r(\d+)'; | |
then | |
LATEST_REV=$1 | |
echo "Forcing rev $1" | |
else | |
LATEST_REV=$(latest_openttd_trunk_version) | |
fi | |
get_and_install_trunk $LATEST_REV | |
get_and_install_opensfx $LATEST_REV | |
get_and_install_opengfx $LATEST_REV | |
echo "Install of openttd rev $LATEST_REV complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment