From fece84bfdedca252a8ede9e94cbc8af8b225a601 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 17 Nov 2023 19:20:00 -0800 Subject: [PATCH] Synched gist at Fri Nov 17 19:20:00 PST 2023 --- freehlded-bootstrap.sh | 263 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100755 freehlded-bootstrap.sh diff --git a/freehlded-bootstrap.sh b/freehlded-bootstrap.sh new file mode 100755 index 0000000..52bdfdb --- /dev/null +++ b/freehlded-bootstrap.sh @@ -0,0 +1,263 @@ +#!/bin/sh + +# Quick rundown: +# +# This script bootstraps a FreeHL server complete +# with support for the following games: +# - Half-Life +# - Counter-Strike +# - Deathmatch Classic +# - Team Fortress +# - Half-Life: Opposing Force +# +# You need to place the three files (unmodified) into +# the same directory as this script: +# +# hlserver4110.exe +# csv15full.exe (optional) +# opfor1108.tar.bz2 (optional) +# +# Once you've done so, run this script and in the same +# directory the bootstrapping process will begin. +# +# You can run a server like this: +# +# ./fteqw-sv64 -halflife +sv_public 1 +set deathmatch 1 +set maxplayers 16 +map crossfire +# +# A mod server looks like this: +# +# ./fteqw-sv64 -halflife -game cstrike +sv_public 1 +set deathmatch 1 +set maxplayers 16 +map de_dust2 +# +# You'll probably want to specify other parameters, such as mp_timelimit etc. +# but you should probably put those into a server.cfg into their respective game +# directories. The server will execute files named `server.cfg` if present. +# +# This script should work on other operting systems, you only need to +# replace the fteqw-sv64 binary with one for your target platform/arch. +# The game-logic is entirely platform independent. +# +# Happy hosting! + +set -e + +fix_case() +{ + if [ "$1" = "-r" ] + then + recursive=1 + shift + else + recursive=0 + fi + + for i in "$@" + do + new=`echo $i | tr "[:upper:]" "[:lower:]"` + if [ "$new" != "$i" ] + then + echo $i "->" $new >&2 + mv "$i" "$new" + fi + if [ $recursive = 1 -a -d "$new" ] + then + fix_case -r "$new"/* + fi + done +} + +# dependencies: rewise +if [ ! -f ./rewise ] +then + # is this GNU? + if [ "$MAKEVER" = "GNU" ] + then + MAKETOOL="make" + else + # guess not, do we have gmake? + if [ -x "$(command -v gmake)" ] + then + MAKEVER=$(gmake --version | awk '{ print $1 }' | head -n 1) + if [ "$MAKEVER" = "GNU" ] + then + MAKETOOL="gmake" + else + echo "Please install GNU Make." + exit 2 + fi + fi + fi + + BINDIR="$(pwd)" + git clone https://vcs.vera-visions.com/eukara/REWise + cd REWise + $MAKETOOL CC=cc + mv -v rewise "$BINDIR/rewise" + cd "$BINDIR" +fi + +# get the FTE dedicated server binary set up +if [ -f ./fteqw-sv64 ] +then + rm ./fteqw-sv64 +fi + +wget "https://www.fteqw.org/dl/fteqw-sv_linux64.zip" +unzip "fteqw-sv_linux64.zip" +rm "fteqw-sv_linux64.zip" +rm readme.txt + +# remove the old FreeHL packages if they exist +if [ -f ./valve/package_valve.pk3 ] +then + rm ./valve/package_valve.pk3 +fi +if [ -f ./tfc/package_tfc.pk3 ] +then + rm ./tfc/package_tfc.pk3 +fi +if [ -f ./dmc/package_dmc.pk3 ] +then + rm ./dmc/package_dmc.pk3 +fi + +# get the new ones +wget "https://www.frag-net.com/pkgs/package_valve.pk3" -P ./valve/ +unzip -p ./valve/package_valve.pk3 progs.dat >valve/progs.dat +unzip -p ./valve/package_valve.pk3 csprogs.dat >valve/csprogs.dat + +wget "https://www.frag-net.com/pkgs/package_tfc.pk3" -P ./tfc/ +unzip -p ./tfc/package_tfc.pk3 progs.dat >tfc/progs.dat +unzip -p ./tfc/package_tfc.pk3 csprogs.dat >tfc/csprogs.dat + +wget "https://www.frag-net.com/pkgs/package_dmc.pk3" -P ./dmc/ +unzip -p ./dmc/package_dmc.pk3 progs.dat >dmc/progs.dat +unzip -p ./dmc/package_dmc.pk3 csprogs.dat >dmc/csprogs.dat + +#wget "https://www.frag-net.com/pkgs/package_ricochet.pk3" -P ./ricochet/ +#unzip -p ./ricochet/package_ricochet.pk3 progs.dat >ricochet/progs.dat +#unzip -p ./ricochet/package_ricochet.pk3 csprogs.dat >ricochet/csprogs.dat + +# We need at least hlserver4110.exe +if [ ! -f ./hlserver4110.exe ] +then + printf "You require hlserver4110.exe! Place it in %s and run it again, or provide your own content otherwise! Then run this command again.\n", $(pwd) + exit 1 +else + FOUND_HL=1 +fi + +# Check if we have Counter-Strike 1.5's installer +if [ -f ./csv15full.exe ] +then + FOUND_CS=1 +else + FOUND_CS=0 +fi + +# Check if we have Opposing Force's dedicated server files +if [ -f ./csv15full.exe ] +then + FOUND_OPFOR=1 +else + FOUND_OPFOR=0 +fi + +# extract the installer contents +if [ ! -f ./valve/halflife.wad ] +then + ./rewise -x ./ ./hlserver4110.exe + cp -a ./MAINDIR/valve/. ./valve/ + cp -a ./MAINDIR/dmc/. ./dmc/ + cp -a ./MAINDIR/tfc/. ./tfc/ + cp -a ./MAINDIR/ricochet/. ./ricochet/ + rm -rf ./MAINDIR + rm -rf ./TEMP + rm ./UNINSTALL_PATH + fix_case -r ./valve/ + fix_case -r ./dmc/ + fix_case -r ./tfc/ + fix_case -r ./ricochet/ +fi + +# if we have CS its installer detected, extract it +if [ "$FOUND_CS" = "1" ] +then + # don't bother extracting it, if contents exist + if [ ! -f ./cstrike/cstrike.wad ] + then + ./rewise -x ./ ./csv15full.exe + cp -a ./MAINDIR/cstrike/. ./cstrike/ + rm -rf ./MAINDIR + rm -rf ./TEMP + fix_case -r ./cstrike/ + fi +fi + +# if we have CS its installer detected, extract it +if [ "$FOUND_OPFOR" = "1" ] +then + # don't bother extracting it, if contents exist + if [ ! -f ./gearbox/opfor.wad ] + then + tar xjvf opfor1108.tar.bz2 + fi +fi + + +if [ -f ./cstrike/cstrike.wad ] +then + # remove the old FreeCS package + if [ -f ./cstrike/package_cstrike.pk3 ] + then + rm ./cstrike/package_cstrike.pk3 + fi + + # get the new FreeCS package + wget "https://www.frag-net.com/pkgs/package_cstrike.pk3" -P ./cstrike/ + unzip -p ./cstrike/package_cstrike.pk3 progs.dat >cstrike/progs.dat + unzip -p ./cstrike/package_cstrike.pk3 csprogs.dat >cstrike/csprogs.dat +fi + + +if [ -f ./gearbox/opfor.wad ] +then + # remove the old FreeCS package + if [ -f ./gearbox/package_gearbox.pk3 ] + then + rm ./gearbox/package_gearbox.pk3 + fi + + # get the new FreeOP4 package + wget "https://www.frag-net.com/pkgs/package_gearbox.pk3" -P ./gearbox/ + unzip -p ./gearbox/package_gearbox.pk3 progs.dat >gearbox/progs.dat + unzip -p ./gearbox/package_gearbox.pk3 csprogs.dat >gearbox/csprogs.dat +fi + +# Final evaluation + +printf "Install/upgrade successful. Detected games that you can host games for:\n" + +if [ -f ./valve/package_valve.pk3 ] +then + printf "\t- Half-Life\n" +fi +if [ -f ./cstrike/package_cstrike.pk3 ] +then + printf "\t- Counter-Strike\n" +fi +if [ -f ./tfc/package_tfc.pk3 ] +then + printf "\t- Team Fortress Classic\n" +fi +if [ -f ./dmc/package_dmc.pk3 ] +then + printf "\t- Deathmatch Classic\n" +fi +if [ -f ./ricochet/package_ricochet.pk3 ] +then + printf "\t- Ricochet\n" +fi +if [ -f ./gearbox/package_gearbox.pk3 ] +then + printf "\t- Half-Life: Opposing Force\n" +fi \ No newline at end of file