diff --git a/.gitignore b/.gitignore index b2407f2a..7505aec8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ config/init.cfg config/saved.cfg config/servers.cfg config/configtemplates.zip +packages/misc/checksums_md5.txt source/enet/.deps/ source/enet/.libs/ source/enet/Makefile diff --git a/assaultcube.sh b/assaultcube.sh index addc3e14..ffaa6bbd 100755 --- a/assaultcube.sh +++ b/assaultcube.sh @@ -3,7 +3,7 @@ # CUBE_DIR should refer to the directory in which AssaultCube is placed. #CUBE_DIR=~/assaultcube #CUBE_DIR=/usr/local/assaultcube -#CUBE_DIR=./ +#CUBE_DIR=. CUBE_DIR=$(dirname "$(readlink -f "${0}")") # CUBE_OPTIONS starts AssaultCube with any command line options you choose. @@ -49,47 +49,14 @@ then MACHINE_NAME= fi -if [ -x "/sbin/ldconfig" ]; then - if [ -z "$(/sbin/ldconfig -p | grep "libX11")" ]; then - echo "To run AssaultCube, please ensure X11 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libSDL-1.2")" ]; then - echo "To run AssaultCube, please ensure SDL v1.2 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libSDL_image")" ]; then - echo "To run AssaultCube, please ensure SDL_image libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libz")" ]; then - echo "To run AssaultCube, please ensure z libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libogg")" ]; then - echo "To run AssaultCube, please ensure ogg libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libvorbis")" ]; then - echo "To run AssaultCube, please ensure vorbis libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libopenal")" ]; then - echo "To run AssaultCube, please ensure OpenAL-Soft libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libcurl")" ]; then - echo "To run AssaultCube, please ensure Curl libraries are installed." - exit 1 - fi -fi +BINARYPATH="${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}client" -if [ -x "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}client" ]; then +if [ "$1" = "--outputbinarypath" ]; then + echo "${BINARYPATH}" + exit 0 +elif [ -x "${BINARYPATH}" ]; then cd "${CUBE_DIR}" - exec "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}client" ${CUBE_OPTIONS} "$@" -elif [ -e "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}client" ]; then - echo "Insufficient permissons to run AssaultCube." - echo "Please change (chmod) the AssaultCube client in the bin_unix folder to be readable/executable." + exec "${BINARYPATH}" ${CUBE_OPTIONS} "$@" else echo "Your platform does not have a pre-compiled AssaultCube client." echo "Please follow the following steps to build a native client:" @@ -100,3 +67,4 @@ else echo "4) If the compile succeeds, return to this directory and re-run this script." exit 1 fi + diff --git a/check_install.sh b/check_install.sh index 59abfced..16c60eb8 100755 --- a/check_install.sh +++ b/check_install.sh @@ -1,274 +1,91 @@ #!/bin/sh -# Launches AssaultCube, configures an AC server, or installs/removes an AC menuitem. -# This file remains compatible with Bourne Shell, in case it is used on another *nix system. - -# AC Version, this suffix is used to name the userdata directory and desktop launcher. -ACVERSION="v1.2" -# Default server options: -DEFSERVER="-Cconfig/servercmdline.txt" -# Default client options: -DEFCLIENT="--home=${HOME}/.assaultcube_v1.2 --init" - -# These two aliases below are automatically chosen later in this script. -# You can specify them here though, if you would prefer. +# Checks certain parts of an AssaultCube installation +# +# Try this, if your game does not start. # -# Path to the AssaultCube directory: -CUBEDIRC="" -# Name of the AssaultCube executable: -CUBEEXEC="" -# --help document -for cmdoptions in $@; do - if [ "$cmdoptions" = "--help" ]; then - echo "Usage: "$0" OPTION(S)" - echo "" - echo "The AssaultCube launcher/menuitem installer. AssaultCube is a multiplayer," - echo "first-person shooter game, based on the CUBE engine, with fast, arcade gameplay." - echo "" - echo "If none of the below options are chosen, this script will launch an AssaultCube" - echo "client and any arguments from http://assault.cubers.net/docs/commandline.html" - echo "will be added to AssaultCube's launch." - echo "" - echo "Note: Except for --basedirectory and --defaultsoff the below commands can't be" - echo " used conjunctionally with one another." - echo "" - echo "Options:" - echo "--help This help message." - echo "--installmenuitem Installs (or overwrites an existing "$ACVERSION") menuitem for" - echo " the current user (only), then exits. Any arguments used" - echo " from http://assault.cubers.net/docs/commandline.html" - echo " will be added to the launcher." - echo "--removemenuitem Removes all menuitems for the current user, then exits." - echo "--basedirectory=value Specifies the absolute path to AssaultCube's base" - echo " directory. Useful if you're running this script from a" - echo " different directory." - echo "--installserver=value Helps you configure an AssaultCube server launcher. If" - echo " no \"value\" is chosen, the launcher file will be named" - echo " \"serverlauncher\"." - echo "--runserver Runs an AssaultCube server with the default" - echo " configuration found in ./config/servercmdline.txt, plus" - echo " whatever you specify yourself on this commandline (not" - echo " recommended - preferably use --installserver instead)." - echo "--defaultsoff Turns off ./config/servercmdline.txt options, when using" - echo " --runserver, or turns off --init and --home when using" - echo " an AssaultCube client." - exit 0 - fi -done +CUBE_DIR=$(dirname "$(readlink -f "${0}")") +cd "$CUBE_DIR" -for cmdoptions in $@; do - # Store all arguments that aren't part of this script: - TEMP1=`echo "$ACARGUMENTS" "$cmdoptions" | sed 's/--installmenuitem.*\|--removemenuitem.*\|--basedirectory.*\|--installserver.*\|--runserver.*\|--defaultsoff.*\|//g'` - ACARGUMENTS=`echo "$TEMP1"` - # Turn off the defaults if this was requested: - if [ "$cmdoptions" = "--defaultsoff" ]; then - DEFCLIENT="" && DEFSERVER="" - fi -done +# check libs -# Work out the absolute path to the AssaultCube directory. -# This will skip if it's already chosen (see head of script). -if [ -z "$CUBEDIRC" ]; then - # Check if specified via switch. - for cmdoptions in $@; do - TEMP1="$(echo "$cmdoptions" | sed -n 's/--basedirectory=//p')" - if [ -n "$TEMP1" ]; then - CUBEDIRC="$(readlink -f "$(eval echo $TEMP1)")" +SERVERLIBS="libz libcurl" +CLIENTLIBS="libSDL-1.2 libz libcurl libX11 libSDL_image libogg libvorbis libopenal" + +if [ -x "/sbin/ldconfig" ]; then + echo "checking libraries:" + for libname in $SERVERLIBS; do + if [ -z "$(/sbin/ldconfig -p | grep $libname)" ]; then + echo " library $libname not found - this lib is required for server and client installations" + else + echo " found $libname" fi done - # Or, use current directory. - if [ "$CUBEDIRC" = "" ]; then - CUBEDIRC="$(dirname "$(readlink -f "${0}")")" - fi -fi - -# Work out if we're using a server or client binary. -for cmdoptions in $@; do - TEMP1="$(echo "$cmdoptions" | grep -e --installserver)" - TEMP2="$(echo "$cmdoptions" | grep -e --runserver)" - if [ -n "$TEMP2" ]; then - EXECTYPE="server" - fi - if [ -n "$TEMP1" ]; then - EXECTYPE="server" - # If --installserver was used, prepare the value to be used. - SERVERLAUNCHER="$(echo "$TEMP1" | sed -n 's/--installserver=//p')" - if [ -z "$SERVERLAUNCHER" ]; then - SERVERLAUNCHER="serverlauncher" - fi - fi -done -if [ "$EXECTYPE" != "server" ]; then - EXECTYPE="client" -fi - -# Work out what binary our processor/OS requires. -# This will skip if it's already chosen (see head of script). -if [ -z "$CUBEEXEC" ]; then - if [ -x "$CUBEDIRC"/bin_unix/native_"$EXECTYPE" ]; then - CUBEEXEC="native_"$EXECTYPE"" - elif [ "$(uname -s)" = "Linux" ]; then - if [ "$(uname -m)" = "x86_64" ]; then - CUBEEXEC="linux_64_"$EXECTYPE"" + for libname in $CLIENTLIBS; do + if [ -z "$(/sbin/ldconfig -p | grep $libname)" ]; then + echo " library $libname not found - this lib is required for client installations only" else - CUBEEXEC="linux_"$EXECTYPE"" + echo " found $libname" fi + done +else + echo "skipping libraries check: couldn't find /sbin/ldconfig" + echo " to run a server, you'll need:" $SERVERLIBS + echo " to run a client, you'll need:" $SERVERLIBS $CLIENTLIBS +fi +echo "" + +# check all files that belong to the installation +# (use source/dev_tools/generate_md5_checksums.sh to generate a checksum file) + +CHKSUMFILE="packages/misc/checksums_md5.txt" +if [ -e $CHKSUMFILE ]; then + echo "checking installed game files:" + if md5sum -c $CHKSUMFILE --status; then + echo " all files of the AC package are checked and OK" else - if [ "$(uname -m)" = "x86_64" ]; then - CUBEEXEC="unknown_64_"$EXECTYPE"" - else - CUBEEXEC="unknown_"$EXECTYPE"" - fi - fi -fi - -# Remove existing menuitems, if they exist: -for cmdoptions in $@; do - if [ "$cmdoptions" = "--removemenuitem" ]; then - EXISTINGEXEC=`find "${HOME}"/.local/share/applications/ -name "assaultcube*" | xargs` - if [ -n "$EXISTINGEXEC" ]; then - echo "The following menuitem(s) currently exist:" - echo "$EXISTINGEXEC" - read -p "Would you like them all to be deleted? (Y/N): " -r REPLY - if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - find "${HOME}"/.local/share/applications/ -name "assaultcube*" -delete - echo "Deleted menuitems as requested." - exit 0 - else - echo "The existing menuitems will remain." - exit 0 - fi - else - echo "No pre-existing menuitems were found." - exit 1 - fi - fi -done - -# A few bits of error checking, before we try doing anything else: -if [ ! -x "$CUBEDIRC"/bin_unix/"$CUBEEXEC" ]; then - # Maybe this script in the wrong directory? - if [ ! -d ""$CUBEDIRC"/bin_unix" ]; then - echo "The \"bin_unix\" folder was not found." - echo "Please run this script from inside the main AssaultCube directory." - echo "Or, use the --basedirectory switch to state the absolute path as an argument." - echo "Example: sh "$0" --basedirectory=/path/to/assaultcube/directory" - exit 1 - # Or perhaps, the binary exists, but isn't executable? - elif [ ! -x "$CUBEDIRC"/bin_unix/"$CUBEEXEC" ] && [ -e "$CUBEDIRC"/bin_unix/"$CUBEEXEC" ]; then - echo "Insufficient permissons to run AssaultCube." - echo "Please change (chmod) the AssaultCube "$EXECTYPE" in the bin_unix folder to be readable/executable." - exit 1 - else - echo "Your platform does not have a pre-compiled AssaultCube "$EXECTYPE"." - echo "Please follow the following steps to build a native "$EXECTYPE":" - echo "1) Ensure you have the following DEVELOPMENT libraries installed:" - if [ "$EXECTYPE" = "server" ]; then - echo " SDL, zlib, libcurl" - else - echo " OpenGL, SDL, SDL_image, zlib, libogg, libvorbis, OpenAL Soft, libcurl" - fi - echo "2) Ensure clang++ and any other required build tools are installed." - if [ "$EXECTYPE" = "server" ]; then - echo "3) Change directory to ./source/src/ and type \"make server_install\"." - else - echo "3) Change directory to ./source/src/ and type \"make install\"." - fi - echo "4) If the compile succeeds, return to this directory and re-run this script." - exit 1 - fi -fi - -# Some more bits of error checking before we try anything else. This test checks if -# all required libraries are installed, then warns the user accordingly. -# -# Firstly, server requirements (as they're also required for the client): -if [ -x "/sbin/ldconfig" ]; then - if [ -z "$(/sbin/ldconfig -p | grep "libSDL-1.2")" ]; then - echo "To run an AssaultCube server, please ensure SDL v1.2 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libz")" ]; then - echo "To run an AssaultCube server, please ensure z libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libcurl")" ]; then - echo "To run an AssaultCube server, please ensure Curl libraries are installed." - exit 1 - fi - # Next, client requirements: - if [ "$EXECTYPE" = "client" ]; then - if [ -z "$(/sbin/ldconfig -p | grep "libX11")" ]; then - echo "To run AssaultCube, please ensure X11 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libSDL_image")" ]; then - echo "To run AssaultCube, please ensure SDL_image libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libogg")" ]; then - echo "To run AssaultCube, please ensure ogg libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libvorbis")" ]; then - echo "To run AssaultCube, please ensure vorbis libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libopenal")" ]; then - echo "To run AssaultCube, please ensure OpenAL-Soft libraries are installed." - exit 1 - fi + echo " some files of your AC installation appear to be missing or damaged" + read -p " press enter, to see the list of files..." -r dummy + md5sum -c $CHKSUMFILE --quiet | less fi else - echo "NOTE: We couldn't find /sbin/ldconfig, so we're unable to test if you have all." - echo "of the libraries required to run an AssaultCube server. We'll continue anyway." + echo "skipping file check: couldn't find $CHKSUMFILE" fi +echo "" -for cmdoptions in $@; do - if [ "$cmdoptions" = "--installmenuitem" ]; then - # Installing the .desktop item: - mkdir -p "${HOME}"/.local/share/applications - cat > ""${HOME}"/.local/share/applications/assaultcube_$ACVERSION.desktop" << EOF -[Desktop Entry] -Version=1.0 -Type=Application -Name=AssaultCube $ACVERSION -Keywords=assaultcube;game;fps; -GenericName=First Person Shooter Game -Categories=Game;ActionGame;Shooter; -Terminal=false -StartupNotify=false -Exec=sh -c "cd "$CUBEDIRC" && bin_unix/$CUBEEXEC $DEFCLIENT $ACARGUMENTS" -Icon=$CUBEDIRC/docs/images/icon.png -Comment=A multiplayer, first-person shooter game, based on the CUBE engine. Fast, arcade gameplay. -EOF - chmod +x ""${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop" - if [ -x "${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop ]; then - echo "An AssaultCube menuitem has been successfully installed to" - echo ""${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop" - exit 0 - else - echo "Installing an AssaultCube menuitem has failed for an unknown reason." - exit 1 - fi - fi -done +# list existing desktop launcher items -# Runs an AssaultCube server, or starts serverwizard to configure a launcher for it: -if [ "$EXECTYPE" = "server" ]; then - if [ -n "$SERVERLAUNCHER" ]; then - cd "$CUBEDIRC" && touch "$SERVERLAUNCHER".sh - chmod 755 "$SERVERLAUNCHER".sh - bin_unix/"$CUBEEXEC" --wizard "$SERVERLAUNCHER".sh bin_unix/"$CUBEEXEC" - else - cd "$CUBEDIRC" && bin_unix/"$CUBEEXEC" $DEFSERVER $ACARGUMENTS - fi -# Runs an AssaultCube client: -elif [ "$EXECTYPE" = "client" ]; then - cd "$CUBEDIRC" && bin_unix/"$CUBEEXEC" $DEFCLIENT $ACARGUMENTS +LAUNCHERPATH="${HOME}/.local/share/applications/" +EXISTINGEXEC=`find "${LAUNCHERPATH}" -name "assaultcube*" | xargs` +if [ "$EXISTINGEXEC" != "" ]; then + echo "the following menuitem(s) wer found:" + echo " $EXISTINGEXEC" else - echo "Tried launching AssaultCube, but we couldn't detect if a server or client was required." - echo "This is most likely a bug, rather than a user error." + echo "no desktop launcher items were found - run install_or_remove_menuitem.sh to create one" +fi +echo "" + +# find out, which binaries would be used to start the game + +echo "checking game executables:" +SERVERBIN=`./server.sh --outputbinarypath` +CLIENTBIN=`./assaultcube.sh --outputbinarypath` + +if [ -x "$SERVERBIN" ]; then + echo " the server will use the binary $SERVERBIN" +elif [ -e "$SERVERBIN" ]; then + echo " the server would use the binary $SERVERBIN, if the permissions would allow it" +else + echo " the server would use the binary $SERVERBIN, but the file does not exist" fi +if [ -x "$CLIENTBIN" ]; then + echo " the game client will use the binary $CLIENTBIN" +elif [ -e "$CLIENTBIN" ]; then + echo " the server would use the binary $CLIENTBIN, if the permissions would allow it" +else + echo " the server would use the binary $CLIENTBIN, but the file does not exist" +fi + +exit 0 diff --git a/install_or_remove_menuitem.sh b/install_or_remove_menuitem.sh index b0d90227..339acf19 100755 --- a/install_or_remove_menuitem.sh +++ b/install_or_remove_menuitem.sh @@ -1,193 +1,51 @@ #!/bin/bash # Adds a custom menuitem for AssaultCube to your Desktop's launcher. -# AC Version, this suffix is used to name the userdata directory and launcher. -ACVERSION="v1.2" -# -# The two aliases below are automatically chosen, as per the scripts below it. -# You can specify them here though, if you would prefer. -# -# Path to the AssaultCube directory: -CUBEDIRC="" -# Name of the AssaultCube executable: -CUBEEXEC="" +CUBE_DIR=$(dirname "$(readlink -f "${0}")") +CUBE_EXEC=assaultcube.sh +LAUNCHERPATH="${HOME}/.local/share/applications/" -# State the path to the AssaultCube directory. -if [ "$CUBEDIRC" = "" ]; then - if [ "$1" = "" ]; then - CUBEDIRC="$(dirname "$(readlink -f "${0}")")" - else - CUBEDIRC="$(readlink -f "$*")" - fi -fi - -# What kind of binary file are we looking for? -if [ "$CUBEEXEC" = "" ]; then - if [ -x "${CUBEDIRC}/bin_unix/native_client" ]; then - CUBEEXEC="native_client" - elif [ "$(uname -s)" = "Linux" ]; then - if [ "$(uname -m)" = "x86_64" ]; then - CUBEEXEC="linux_64_client" - else - CUBEEXEC="linux_client" - fi - else - if [ "$(uname -m)" = "x86_64" ]; then - CUBEEXEC="unknown_64_client" - else - CUBEEXEC="unknown_client" - fi - fi -fi +LAUNCHERFILE=assaultcube_dev.desktop +LAUNCHERTITLE="Assaultcube v1.2dev" # Remove existing menuitem, if it exists: -EXISTINGEXEC=`find "${HOME}"/.local/share/applications/ -name "assaultcube*" | xargs` +EXISTINGEXEC=`find "${LAUNCHERPATH}" -name "assaultcube*" | xargs` if [ "$EXISTINGEXEC" != "" ]; then echo "The following menuitem(s) currently exist:" echo "$EXISTINGEXEC" - read -p "Would you like them to be deleted? (Y/N): " -r REPLY + read -p "Would you like them all to be deleted? (y/N): " -r REPLY if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - find "${HOME}"/.local/share/applications/ -name "assaultcube*" -delete + find "${LAUNCHERPATH}" -name "assaultcube*" -delete echo "Deleted menuitems as requested." && echo "" + exit 0 else echo "The existing menuitems will remain." && echo "" fi fi -echo "We'll now install a custom menuitem for launching AssaultCube (only for your" -echo "user). If you're ready to continue, press ENTER (or ctrl+c to exit)." -read -r DUMMY - -echo "Would you like to run some tests to ensure that you have installed all of the" -read -p "required libraries? Without them, AssaultCube won't be able to run (Y/N): " -r REPLY -if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - if [ -x "/sbin/ldconfig" ]; then - if [ -z "$(/sbin/ldconfig -p | grep "libX11")" ]; then - echo "To run AssaultCube, please ensure X11 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libSDL-1.2")" ]; then - echo "To run AssaultCube, please ensure SDL v1.2 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libSDL_image")" ]; then - echo "To run AssaultCube, please ensure SDL_image libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libz")" ]; then - echo "To run AssaultCube, please ensure z libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libogg")" ]; then - echo "To run AssaultCube, please ensure ogg libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libvorbis")" ]; then - echo "To run AssaultCube, please ensure vorbis libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libopenal")" ]; then - echo "To run AssaultCube, please ensure OpenAL-Soft libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libcurl")" ]; then - echo "To run AssaultCube, please ensure Curl libraries are installed." - exit 1 - fi - else - echo "Couldn't find /sbin/ldconfig, so we're unable to run these tests." - echo "We'll install the menuitem anyway..." - fi -else - echo "Yes sir! No tests will be done." -fi - -# TODO: Add more options to the installer, if wanted. -echo "" && echo "We'll install AssaultCube's menuitem with the default options." -read -p "Unless you want to set advanced options? (Y/N): " -r REPLY -if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - echo "" && echo "AssaultCube will store userdata in ~/.assaultcube_"$ACVERSION" by default." - read -p "Do you want to store userdata elsewhere? (Y/N) " -r REPLY - if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - echo "Please state the absolute path of where to store AssaultCube files. Note, that" - read -p "you should ensure this folder doesn't conflict with existing AssaultCube versions: " -r ACHOME1 - echo "Thank you. We'll store userdata in "$ACHOME1"" - mkdir -p "$ACHOME1" - ACHOME="--home="$ACHOME1"" - else - echo "We'll store userdata in ~/.assaultcube_"$ACVERSION" then." - ACHOME="--home="${HOME}"/.assaultcube_"$ACVERSION"" - fi - echo "" && echo "AssaultCube will run the \"init\" script before running graphics/sound" - echo "subsystems by default. We normally use ./config/init.cfg" - echo "Note that this script normally stores options, such as fullscreen, screen width/height and" - echo "therefore makes specifying those options via this script, fairly redundant." - read -p "Do you want to change this? (Y/N) " -r REPLY - if [ "$REPLY" = "y" ] || [ "$REPLY" = "yes" ] || [ "$REPLY" = "Y" ] || [ "$REPLY" = "YES" ]; then - echo "Please state the relative path of where your new init.cfg file is. Or, leave" - read -p "this field blank to disable this option: " -r ACINIT1 - if [ "$ACINIT1" = "" ]; then - echo "--init has been disabled." - ACINIT="" - else - echo "Thank you. We'll run "$ACINIT1" as an init script." - ACINIT="--init=\""$ACINIT1"\"" - fi - else - echo "We'll run ./config/init.cfg as an init script then." - ACINIT="--init" - fi -else - echo "The default options will be installed only." - ACHOME="--home="${HOME}"/.assaultcube_"$ACVERSION"" - ACINIT="--init" -fi - -# Check that a binary exists and is executable for this system: -if [ -x "$CUBEDIRC"/bin_unix/"$CUBEEXEC" ]; then - mkdir -p "${HOME}"/.local/share/applications - cat > ""${HOME}"/.local/share/applications/assaultcube_$ACVERSION.desktop" << EOF +mkdir -p "${LAUNCHERPATH}" +cat > "${LAUNCHERPATH}"${LAUNCHERFILE} << EOF [Desktop Entry] Version=1.0 Type=Application -Name=AssaultCube $ACVERSION +Name=$LAUNCHERTITLE Keywords=assaultcube;game;fps; GenericName=First Person Shooter Game Categories=Game;ActionGame;Shooter; Terminal=false StartupNotify=false -Exec=sh -c "cd "$CUBEDIRC" && bin_unix/$CUBEEXEC $ACHOME $ACINIT" -Icon=$CUBEDIRC/docs/images/icon.png +Exec=$CUBE_DIR/$CUBE_EXEC +Icon=$CUBE_DIR/docs/images/icon.png Comment=A multiplayer, first-person shooter game, based on the CUBE engine. Fast, arcade gameplay. EOF - chmod +x ""${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop" - if [ -x "${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop ]; then - echo "" && echo "An AssaultCube menuitem has been successfully installed to" - echo ""${HOME}"/.local/share/applications/assaultcube_"$ACVERSION".desktop" - exit 0 - else - echo "" && echo "For some reason, we're unable to install an AssaultCube menuitem." - exit 1 - fi -# But, if no binary exists, is this script perhaps in the wrong directory? -elif [ -z ""$CUBEDIRC"/bin_unix" ]; then - echo "The \"bin_unix\" folder was not found." - echo "Please run this script inside the main AssaultCube directory." - echo "Or, type the path to the directory as an argument when executing "$0"" - echo "Example: bash "$0" /path/to/assaultcube/directory" - exit 1 -# Or perhaps, the binary exists, but isn't executable? -elif [ -e "$CUBEDIRC"/bin_unix/"$CUBEEXEC" ]; then - echo "Insufficient permissons to run AssaultCube." - echo "Please change (chmod) the AssaultCube client in the bin_unix folder to be readable/executable." - exit 1 + +chmod +x "${LAUNCHERPATH}"${LAUNCHERFILE} +if [ -x "${LAUNCHERPATH}"${LAUNCHERFILE} ]; then + echo "An AssaultCube menuitem has been successfully created at" + echo "${LAUNCHERPATH}"${LAUNCHERFILE} + exit 0 else - echo "Your platform does not have a pre-compiled AssaultCube client." - echo "Please follow the following steps to build a native client:" - echo "1) Ensure you have the following DEVELOPMENT libraries installed:" - echo " OpenGL, SDL, SDL_image, zlib, libogg, libvorbis, OpenAL Soft, libcurl" - echo "2) Ensure clang++ and any other required build tools are installed." - echo "3) Change directory to ./source/src/ and type \"make install\"." - echo "4) If the compile succeeds, return to this directory and re-run this script." + echo "For some reason, we're unable to install an AssaultCube menuitem." exit 1 fi + diff --git a/server.sh b/server.sh index b3a0aeea..65f80ef5 100755 --- a/server.sh +++ b/server.sh @@ -3,7 +3,7 @@ # CUBE_DIR should refer to the directory in which AssaultCube is placed. #CUBE_DIR=~/assaultcube #CUBE_DIR=/usr/local/assaultcube -CUBE_DIR=./ +CUBE_DIR=. # CUBE_OPTIONS starts AssaultCube with any command line options you choose. CUBE_OPTIONS="" @@ -51,32 +51,19 @@ then MACHINE_NAME= fi -if [ -x "/sbin/ldconfig" ]; then - if [ -z "$(/sbin/ldconfig -p | grep "libSDL-1.2")" ]; then - echo "To run AssaultCube, please ensure SDL v1.2 libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libz")" ]; then - echo "To run AssaultCube, please ensure z libraries are installed." - exit 1 - fi - if [ -z "$(/sbin/ldconfig -p | grep "libcurl")" ]; then - echo "To run AssaultCube, please ensure Curl libraries are installed." - exit 1 - fi -fi +BINARYPATH="${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" -if [ -x "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ]; then +if [ "$1" = "--outputbinarypath" ]; then + echo "${BINARYPATH}" + exit 0 +elif [ -x "${BINARYPATH}" ]; then cd "${CUBE_DIR}" - exec "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ${CUBE_OPTIONS} ${CUBE_OPTIONFILE} "$@" -elif [ -e "${CUBE_DIR}/bin_unix/${SYSTEM_NAME}${MACHINE_NAME}server" ]; then - echo "Insufficient permissons to run AssaultCube." - echo "Please change (chmod) the AssaultCube server in the bin_unix folder to be readable/executable." + exec "${BINARYPATH}" ${CUBE_OPTIONS} ${CUBE_OPTIONFILE} "$@" else echo "Your platform does not have a pre-compiled AssaultCube server." echo "Please follow the following steps to build a native client:" echo "1) Ensure you have the following DEVELOPMENT libraries installed:" - echo " SDL, zlib, libcurl" + echo " zlib" echo "2) Ensure clang++ and any other required build tools are installed." echo "3) Change directory to ./source/src/ and type \"make server_install\"." echo "4) If the compile succeeds, return to this directory and re-run this script." diff --git a/source/dev_tools/generate_md5_checksums.sh b/source/dev_tools/generate_md5_checksums.sh new file mode 100644 index 00000000..891d79d7 --- /dev/null +++ b/source/dev_tools/generate_md5_checksums.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# +# update packages/misc/checksums_md5.txt +# +# (this script needs to be in source/dev_tools + +cd $(dirname "$(readlink -f "${0}")") +cd ../.. # get to the base dir of the installation + +echo Generating checksums... +find [A-z]* -type f -print0 | xargs -0 md5sum | fgrep -v checksums_md5 | fgrep -v " source/" | fgrep -v "gitignore" > packages/misc/checksums_md5.txt +echo Done. + + diff --git a/source/package_assaultcube.sh b/source/package_assaultcube.sh index e4c3e981..d81e8f9a 100644 --- a/source/package_assaultcube.sh +++ b/source/package_assaultcube.sh @@ -183,6 +183,9 @@ find ./packages/maps/official/*.cgz | \ xargs -i echo -e "securemap" {} | \ sort -u >> ./config/securemaps.cfg +# update checksum file +$PATHTOACDIR/source/dev_tools/generate_md5_checksums.sh + # Create the linux tarball: echo -e "\n... Creating the Linux tarball..." cd .. && mv $ACDIRFOLDERNAME AssaultCube_v$NEWACVERSION