Skip to content

Instantly share code, notes, and snippets.

@kaadmy
Last active September 7, 2018 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaadmy/77e6dee85e527f8e4283fb747ff34906 to your computer and use it in GitHub Desktop.
Save kaadmy/77e6dee85e527f8e4283fb747ff34906 to your computer and use it in GitHub Desktop.
#! /bin/sh
# Set this to "sudo" if you're installing in a root directory eg. /usr/local
SUDO=
#SUDO=sudo
CORES=`nproc`
DEFAULTINSTALLDIR=`pwd`/install
# Functions
function check_exit_status {
status=$?
if [ $status -ne 0 ]; then
echo "$1 failed with exit status $status"
exit $status
fi
}
# Startup notice
echo "This script is unofficial, and official install methods should be"
echo "preferred when possible."
echo
echo "This script only downloads and installs the game binaries from source"
echo "packages, and does not automatically download game data."
echo "To install game data, it is recommended that you download the official"
echo "installer from the website and link the data directory to the install"
echo "directory."
echo
echo "If you wish, you can edit this script to allow installing in a root"
echo "directory."
echo
echo "This script will create new directories in `pwd`, if you"
echo "do not want to create any directories here, you should run this script"
echo "from a different location."
echo
echo "It is recommended that you read and understand this script before"
echo "continuing this installation."
echo
echo "I AM NOT RESPONSIBLE FOR ANY DAMAGE THIS SCRIPT MAY CAUSE"
echo "USE THIS SCRIPT AT YOUR OWN RISK"
echo
while true; do
read -p "Do you wish to continue? (y/n) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes(Y) or no(N).";;
esac
done
# Ask user for install location
read -p "Where do you wish to place installed files? ($DEFAULTINSTALLDIR) " INSTALLDIR
if [ -z $GAMEDATADIR ]; then
INSTALLDIR=$DEFAULTINSTALLDIR
fi
DATADIR=$INSTALLDIR/share/quetoo
echo "Install directory structure (directories will be created if necessary):"
echo "> $INSTALLDIR/bin/quetoo"
echo "> $INSTALLDIR/lib/quetoo/default/game.so"
while true; do
read -p "Do you wish to continue? (y/n) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes(Y) or no(N).";;
esac
done
# Create installation directories if needed
mkdir -p $INSTALLDIR; check_exit_status "Create installation directory"
mkdir -p $DATADIR; check_exit_status "Create data directory"
# Change environment variables to find Objectively/ObjectivelyMVC properly
export PKG_CONFIG_PATH=$INSTALLDIR/lib/pkgconfig:$PKG_CONFIG_PATH
export OBJECTIVELYMVC_CFLAGS=-I$INSTALLDIR/include/
# Build Objectively
echo "Starting Objectively build..."
git clone https://github.com/jdolan/Objectively; check_exit_status "Objectively clone"
cd Objectively
autoreconf -i; check_exit_status "Objectively autoconf"
./configure --prefix=$INSTALLDIR; check_exit_status "Objectively configure"
make -j $CORES; check_exit_status "Objectively build"
$SUDO make install; check_exit_status "Objectively install"
cd ..
# Build ObjectivelyMVC
echo "Starting ObjectivelyMVC build..."
git clone https://github.com/jdolan/ObjectivelyMVC; check_exit_status "ObjectivelyMVC clone"
cd ObjectivelyMVC
autoreconf -i; check_exit_status "ObjectivelyMVC autoconf"
./configure --prefix=$INSTALLDIR; check_exit_status "ObjectivelyMVC configure"
make -j $CORES; check_exit_status "ObjectivelyMVC build"
$SUDO make install; check_exit_status "ObjectivelyMVC install"
cd ..
# Build Quetoo
echo "Starting Quetoo build..."
git clone https://github.com/jdolan/quetoo; check_exit_status "Quetoo clone"
cd quetoo
autoreconf -i; check_exit_status "Quetoo autoconf"
./configure --prefix=$INSTALLDIR; check_exit_status "Quetoo configure"
make -j $CORES; check_exit_status "Quetoo build"
$SUDO make install; check_exit_status "Quetoo install"
cd ..
# Cleanup
echo "Source binaries have been successfully installed."
echo
echo "You can install game data by either downloading the official snapshots or"
echo "cloning the Git repository for game data (which is rather large) and"
echo "linking them so the directory tree looks like this:"
echo "> $DATADIR/default/maps.lst"
echo
echo "If you have the official snapshot, run the bundled updater and then run:"
echo "$ cd $DATADIR && ln -s SNAPSHOT_DIR/share/default ."
echo
echo "If you have the game data Git repository, run:"
echo "$ cd $DATADIR && ln -s REPO_DIR/target/default ."
echo
echo "After game data is installed, you can launch Quetoo by running"
echo "$ $INSTALLDIR/bin/quetoo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment