Add Linux TGS scripts

This commit is contained in:
Jordan Dominion
2023-12-27 11:25:08 -05:00
parent ec0acf3064
commit 23a7f65f2d
5 changed files with 85 additions and 5 deletions

View File

@@ -17,10 +17,10 @@ static_files:
- name: data
# String dictionary. The value is the location of the file in the repo to upload to TGS. The key is the name of the file to upload to "<instance_path>/Configuration/EventScripts/"
# This one is for Linux hosted servers
#linux_scripts:
# PreCompile.sh: tools/tgs_scripts/PreCompile.sh
# WatchdogLaunch.sh: tools/tgs_scripts/WatchdogLaunch.sh
# InstallDeps.sh: tools/tgs_scripts/InstallDeps.sh
linux_scripts:
PreCompile.sh: tools/tgs_scripts/PreCompile.sh
WatchdogLaunch.sh: tools/tgs_scripts/WatchdogLaunch.sh
InstallDeps.sh: tools/tgs_scripts/InstallDeps.sh
# Same as above for Windows hosted servers
windows_scripts:
PreCompile.bat: tools/tgs_scripts/PreCompile.bat

View File

@@ -3,7 +3,7 @@
#Project dependencies file
#TODO: Make the Github Actions CI workflow actually use these and
#uncomment the entries as they become needed/used.
#Currently, this is only used by build.cmd
#Currently, this is only used by build.cmd and TGS quick setup
# byond version
#export BYOND_MAJOR=514
@@ -18,3 +18,6 @@ export NODE_VERSION_PRECISE=16.13.1
# Python version for mapmerge and other tools
#export PYTHON_VERSION=3.6.8
#rust_g git tag
export RUST_G_VERSION=3.0.0

View File

@@ -0,0 +1,33 @@
#!/bin/bash
#find out what we have (+e is important for this)
set +e
has_git="$(command -v git)"
has_curl="$(command -v curl)"
has_cargo="$(command -v ~/.cargo/bin/cargo)"
has_sudo="$(command -v sudo)"
has_youtubedl="$(command -v youtube-dl)"
has_pip3="$(command -v pip3)"
set -e
set -x
# apt packages, libssl needed by rust-g but not included in TGS barebones install
if ! ( [ -x "$has_git" ] && [ -x "$has_curl" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] ); then
echo "Installing apt dependencies..."
if ! [ -x "$has_sudo" ]; then
dpkg --add-architecture i386
apt-get update
apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl
else
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl
fi
fi
# install cargo if needed
if ! [ -x "$has_cargo" ]; then
echo "Installing rust..."
curl https://sh.rustup.rs -sSf | sh -s -- -y
. ~/.profile
fi

View File

@@ -0,0 +1,38 @@
#!/bin/bash
./InstallDeps.sh
set -e
set -x
#load dep exports
#need to switch to game dir for Dockerfile weirdness
original_dir=$PWD
cd "$1"
. dependencies.sh
cd "$original_dir"
# update rust-g
if [ ! -d "rust-g" ]; then
echo "Cloning rust-g..."
git clone https://github.com/tgstation/rust-g
cd rust-g
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
else
echo "Fetching rust-g..."
cd rust-g
git fetch
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
fi
echo "Deploying rust-g..."
git checkout "$RUST_G_VERSION"
env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-unknown-linux-gnu
mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so"
cd ..
# compile tgui
echo "Compiling tgui..."
cd "$1"
env TG_BOOTSTRAP_CACHE="$original_dir" TG_BOOTSTRAP_NODE_LINUX=1 CBT_BUILD_MODE="TGS" tools/bootstrap/node tools/build/build.js

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Special file to ensure all dependencies still exist between server launches.
# Mainly for use by people who abuse docker by modifying the container's system.
./InstallDeps.sh