added option to update or install

This commit is contained in:
Marcus 2022-08-26 01:14:27 +02:00
parent 026e56293a
commit 6451e28758
2 changed files with 81 additions and 58 deletions

View file

@ -1,9 +0,0 @@
MIT License
Copyright 2022 DeltaLima
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -9,6 +9,19 @@ 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" 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" jk_botti_url="http://koti.kapsi.fi/jukivili/web/jk_botti/jk_botti-$jk_botti_version-release.tar.xz"
showhelp() {
echo "Usage: ./$0 [server|client] [install|update]"
echo ""
echo "Description: Script to install an Xash3D-FWGS client or Xash3D dedicated server with game data from steamcmd"
echo "Server tested on Debian 11 ; Client tested on Ubuntu 20.04"
echo "Origin: https://git.la10cy.net/DeltaLima/xash3ds-installscript"
echo ""
echo "Resources we are using:"
echo $steamcmd_url
echo $hlds_url
echo https://github.com/FWGS/xash3d-fwgs
exit 1
}
case $1 in case $1 in
"client") "client")
@ -25,47 +38,65 @@ CLIENT=false
WAF_OPTION="-d" WAF_OPTION="-d"
;; ;;
*) *)
echo "Usage: ./$0 [server|client]" showhelp
echo "" ;;
echo "Description: Script to install an Xash3D-FWGS client or Xash3D dedicated server with game data from steamcmd" esac
echo "Server tested on Debian 11 ; Client tested on Ubuntu 20.04"
echo "Origin: https://git.la10cy.net/DeltaLima/xash3ds-installscript" case $2 in
echo "" "update")
echo "Resources we are using:" ;;
echo $steamcmd_url
echo $hlds_url "install")
echo https://github.com/FWGS/xash3d-fwgs ;;
exit 1
*)
showhelp
;; ;;
esac esac
echo "= Creating directories =" echo "= Creating directories ="
XASH3D_BASEDIR=$(pwd)/build XASH3D_BASEDIR=$(pwd)/build
mkdir -p $XASH3D_BASEDIR/result XASH3D_RESULTDIR=$XASH3D_BASEDIR/result
test -d $XASH3D_RESULTDIR || mkdir -p $XASH3D_RESULTDIR
if [ "$2" == "install"]
then
echo "= Performing apt install =" echo "= Performing apt install ="
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
sudo apt update sudo apt update
sudo apt-get install -y --no-install-recommends $PACKAGES sudo apt-get install -y --no-install-recommends $PACKAGES
fi
echo "= Compiling xash3d-fwgs =" echo "= Compiling xash3d-fwgs ="
## compile xash3ds ## compile xash3ds
# go to build directory # go to build directory
cd $XASH3D_BASEDIR cd $XASH3D_BASEDIR
case $2 in
"install")
git clone --recursive https://github.com/FWGS/xash3d-fwgs git clone --recursive https://github.com/FWGS/xash3d-fwgs
mkdir -p xash3d-fwgs/bin/ mkdir -p xash3d-fwgs/bin/
cd xash3d-fwgs cd xash3d-fwgs
;;
"update")
cd xash3d-fwgs
rm bin/*
git pull
;;
*)
exit 1
;;
esac
## old if you use deprecated xash3d ## old if you use deprecated xash3d
## cmake -DXASH_DEDICATED=ON -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" ../ ## cmake -DXASH_DEDICATED=ON -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" ../
## make ## make
./waf configure -T release $WAF_OPTION ./waf configure -T release $WAF_OPTION
./waf build ./waf build
./waf install --destdir=bin/ ./waf install --destdir=bin/
## here we fetch half-life from steam server ## here we fetch half-life from steam server
if [ "$2" == "install" ]
then
mkdir -p $XASH3D_BASEDIR/steam mkdir -p $XASH3D_BASEDIR/steam
cd $XASH3D_BASEDIR/steam cd $XASH3D_BASEDIR/steam
## an steamcmd automation ## an steamcmd automation
@ -91,18 +122,19 @@ then
## this is just another source you can use instead of steamcmd. ## this is just another source you can use instead of steamcmd.
curl -LJO "$hlds_url" curl -LJO "$hlds_url"
unzip "hlds_build_$hlds_build.zip" -d "hlds_build_$hlds_build" unzip "hlds_build_$hlds_build.zip" -d "hlds_build_$hlds_build"
cp -R "hlds_build_$hlds_build/hlds_build_$hlds_build"/* $XASH3D_BASEDIR/result/ cp -R "hlds_build_$hlds_build/hlds_build_$hlds_build"/* $XASH3D_RESULTDIR
fi
fi fi
## copy xash3d binaries to result ## copy xash3d binaries to result
## place Xash3D binaries in result and overwrite all ## place Xash3D binaries in result and overwrite all
echo "= copy xash3d binaries to build/result" echo "= copy xash3d binaries to build/result"
cp -R $XASH3D_BASEDIR/xash3d-fwgs/bin/* $XASH3D_BASEDIR/result/ cp -R $XASH3D_BASEDIR/xash3d-fwgs/bin/* $XASH3D_RESULTDIR
touch $XASH3D_BASEDIR/result/valve/listip.cfg touch $XASH3D_BASEDIR/result/valve/listip.cfg
touch $XASH3D_BASEDIR/result/valve/banned.cfg touch $XASH3D_BASEDIR/result/valve/banned.cfg
# it seems that the build actually (21.08.2022) is buggy and does not exec server.cfg by its own # it seems that the build actually (21.08.2022) is buggy and does not exec server.cfg by its own
if [ "$1" == "server" ] if [ "$1" == "server" ] && [ "$2" == "install" ]
then then
echo "= Creating start.sh script for dedicated server in build/result =" 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 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