2022-08-21 23:57:56 +02:00
|
|
|
#!/bin/bash
|
2022-08-21 15:06:00 +02:00
|
|
|
|
2022-08-23 11:48:26 +02:00
|
|
|
hlds_build=8684
|
2022-08-21 15:06:00 +02:00
|
|
|
amxmod_version=1.8.2
|
|
|
|
jk_botti_version=1.43
|
|
|
|
steamcmd_url="https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz"
|
|
|
|
hlds_url="https://github.com/DevilBoy-eXe/hlds/releases/download/$hlds_build/hlds_build_$hlds_build.zip"
|
|
|
|
metamod_url="https://github.com/mittorn/metamod-p/releases/download/1/metamod.so"
|
|
|
|
amxmod_url="http://www.amxmodx.org/release/amxmodx-$amxmod_version-base-linux.tar.gz"
|
|
|
|
jk_botti_url="http://koti.kapsi.fi/jukivili/web/jk_botti/jk_botti-$jk_botti_version-release.tar.xz"
|
|
|
|
|
2022-08-26 01:14:27 +02:00
|
|
|
showhelp() {
|
|
|
|
echo "Usage: ./$0 [server|client] [install|update]"
|
2022-08-23 12:19:44 +02:00
|
|
|
echo ""
|
|
|
|
echo "Description: Script to install an Xash3D-FWGS client or Xash3D dedicated server with game data from steamcmd"
|
2022-08-23 11:48:26 +02:00
|
|
|
echo "Server tested on Debian 11 ; Client tested on Ubuntu 20.04"
|
2022-08-23 12:40:07 +02:00
|
|
|
echo "Origin: https://git.la10cy.net/DeltaLima/xash3ds-installscript"
|
2022-08-23 11:48:26 +02:00
|
|
|
echo ""
|
|
|
|
echo "Resources we are using:"
|
|
|
|
echo $steamcmd_url
|
|
|
|
echo $hlds_url
|
|
|
|
echo https://github.com/FWGS/xash3d-fwgs
|
|
|
|
exit 1
|
2022-08-26 01:14:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
"client")
|
|
|
|
CLIENT=true
|
|
|
|
PACKAGES="git curl build-essential gcc-multilib g++-multilib python python2 libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386"
|
|
|
|
WAF_OPTION="--enable-utils --enable-stb"
|
|
|
|
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
|
|
|
;;
|
|
|
|
"server")
|
|
|
|
CLIENT=false
|
|
|
|
XASHDS_PORT=27015
|
|
|
|
CLIENT=false
|
|
|
|
PACKAGES="build-essential ca-certificates cmake curl git gnupg2 g++-multilib lib32gcc1-s1 libstdc++6:i386 python unzip xz-utils zip"
|
|
|
|
WAF_OPTION="-d"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
showhelp
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $2 in
|
|
|
|
"update")
|
|
|
|
;;
|
|
|
|
|
|
|
|
"install")
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
showhelp
|
|
|
|
;;
|
2022-08-23 11:50:45 +02:00
|
|
|
esac
|
2022-08-21 23:35:06 +02:00
|
|
|
|
2022-08-23 11:59:12 +02:00
|
|
|
echo "= Creating directories ="
|
2022-08-21 15:28:03 +02:00
|
|
|
XASH3D_BASEDIR=$(pwd)/build
|
2022-08-26 01:14:27 +02:00
|
|
|
XASH3D_RESULTDIR=$XASH3D_BASEDIR/result
|
|
|
|
test -d $XASH3D_RESULTDIR || mkdir -p $XASH3D_RESULTDIR
|
2022-08-21 15:06:00 +02:00
|
|
|
|
2022-08-26 01:14:27 +02:00
|
|
|
if [ "$2" == "install"]
|
|
|
|
then
|
|
|
|
echo "= Performing apt install ="
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt update
|
|
|
|
sudo apt-get install -y --no-install-recommends $PACKAGES
|
|
|
|
fi
|
2022-08-21 15:28:03 +02:00
|
|
|
|
2022-08-23 11:59:12 +02:00
|
|
|
echo "= Compiling xash3d-fwgs ="
|
2022-08-21 15:28:03 +02:00
|
|
|
## compile xash3ds
|
|
|
|
# go to build directory
|
|
|
|
cd $XASH3D_BASEDIR
|
2022-08-26 01:14:27 +02:00
|
|
|
case $2 in
|
|
|
|
"install")
|
|
|
|
git clone --recursive https://github.com/FWGS/xash3d-fwgs
|
|
|
|
mkdir -p xash3d-fwgs/bin/
|
|
|
|
cd xash3d-fwgs
|
|
|
|
;;
|
|
|
|
"update")
|
|
|
|
cd xash3d-fwgs
|
|
|
|
rm bin/*
|
|
|
|
git pull
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2022-08-21 23:16:09 +02:00
|
|
|
## old if you use deprecated xash3d
|
|
|
|
## cmake -DXASH_DEDICATED=ON -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" ../
|
|
|
|
## make
|
2022-08-21 23:35:06 +02:00
|
|
|
./waf configure -T release $WAF_OPTION
|
2022-08-22 00:09:02 +02:00
|
|
|
./waf build
|
2022-08-21 23:16:09 +02:00
|
|
|
./waf install --destdir=bin/
|
2022-08-21 23:22:25 +02:00
|
|
|
|
2022-08-21 15:06:00 +02:00
|
|
|
|
2022-08-21 23:16:09 +02:00
|
|
|
## here we fetch half-life from steam server
|
2022-08-26 01:14:27 +02:00
|
|
|
if [ "$2" == "install" ]
|
|
|
|
then
|
|
|
|
mkdir -p $XASH3D_BASEDIR/steam
|
|
|
|
cd $XASH3D_BASEDIR/steam
|
|
|
|
## an steamcmd automation
|
|
|
|
echo "login anonymous
|
2022-08-21 15:45:21 +02:00
|
|
|
force_install_dir $XASH3D_BASEDIR/result
|
2022-08-21 15:06:00 +02:00
|
|
|
app_set_config 90 mod valve
|
|
|
|
app_update 90
|
|
|
|
app_update 90
|
|
|
|
app_update 90 validate
|
|
|
|
app_update 90 validate
|
2022-08-21 15:28:03 +02:00
|
|
|
quit" > $XASH3D_BASEDIR/steam/hlds.install
|
2022-08-21 15:06:00 +02:00
|
|
|
|
2022-08-26 01:14:27 +02:00
|
|
|
echo "= fetching hlds with steamcmd ="
|
|
|
|
## fetch steamcmd
|
|
|
|
curl -L "$steamcmd_url" | tar xzvf -
|
|
|
|
## run half-life download from steam server with steamcmd
|
|
|
|
## If grep find Error then fetch the hlds zip from github
|
|
|
|
echo "= This can take a while depending ony your connection ="
|
|
|
|
if ./steamcmd.sh +runscript hlds.install | grep Error
|
|
|
|
then
|
|
|
|
echo "= !! There was an error fetching hlds with steamcmd. Fetching it from github !! ="
|
|
|
|
echo $hlds_url
|
|
|
|
## this is just another source you can use instead of steamcmd.
|
|
|
|
curl -LJO "$hlds_url"
|
|
|
|
unzip "hlds_build_$hlds_build.zip" -d "hlds_build_$hlds_build"
|
|
|
|
cp -R "hlds_build_$hlds_build/hlds_build_$hlds_build"/* $XASH3D_RESULTDIR
|
|
|
|
fi
|
2022-08-23 11:48:26 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
## copy xash3d binaries to result
|
2022-08-21 23:22:25 +02:00
|
|
|
## place Xash3D binaries in result and overwrite all
|
2022-08-23 11:59:12 +02:00
|
|
|
echo "= copy xash3d binaries to build/result"
|
2022-08-26 01:14:27 +02:00
|
|
|
cp -R $XASH3D_BASEDIR/xash3d-fwgs/bin/* $XASH3D_RESULTDIR
|
2022-08-21 15:06:00 +02:00
|
|
|
|
2022-08-21 15:28:03 +02:00
|
|
|
touch $XASH3D_BASEDIR/result/valve/listip.cfg
|
|
|
|
touch $XASH3D_BASEDIR/result/valve/banned.cfg
|
2022-08-22 01:32:13 +02:00
|
|
|
# it seems that the build actually (21.08.2022) is buggy and does not exec server.cfg by its own
|
2022-08-26 01:14:27 +02:00
|
|
|
if [ "$1" == "server" ] && [ "$2" == "install" ]
|
2022-08-23 11:59:12 +02:00
|
|
|
then
|
|
|
|
echo "= Creating start.sh script for dedicated server in build/result ="
|
|
|
|
echo "./xash +ip 0.0.0.0 -port $XASHDS_PORT -pingboost 1 -timeout 3 +map boot_camp +exec server.cfg" > $XASH3D_BASEDIR/result/start.sh
|
|
|
|
chmod +x $XASH3D_BASEDIR/result/start.sh
|
2022-08-23 12:17:49 +02:00
|
|
|
echo "= If you need an example config for a public server, have a look into https://github.com/FWGS/xashds-docker/tree/master/valve ="
|
2022-08-23 11:59:12 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "= DONE! If everything went well an no errors occured you can just run your game/server from $XASH3D_BASEDIR/result/ ="
|
2022-08-26 01:14:27 +02:00
|
|
|
echo "= starting server: ./start.sh ; starting game client ./xash3d ="
|