Better script for docker (#54501)

The linux one shot script is not a drop-in for the docker script. Let's separate the two.
This commit is contained in:
Jordan Brown
2020-10-21 15:14:30 -04:00
committed by GitHub
parent cfde84f320
commit 38cbbbf2df
4 changed files with 67 additions and 1 deletions
+2
View File
@@ -25,6 +25,8 @@
/code/modules/admin/verbs/adminhelp.dm @Cyberboss
/code/modules/admin/verbs/adminpm.dm @Cyberboss
/code/modules/mapping/ @Cyberboss
/tools/LinuxOneShot/ @Cyberboss
/tools/tgs4_scripts/ @Cyberboss
# Jared-Fogle
@@ -1,5 +1,7 @@
#!/bin/bash
# REPO MAINTAINERS: KEEP CHANGES TO THIS IN SYNC WITH /tools/tgs4_scripts/PreCompile.sh
set -e
set -x
@@ -26,7 +28,7 @@ if ! [ -x "$has_cargo" ]; then
. ~/.profile
fi
# apt packages
# apt packages, libssl needed by rust-g but not included in TGS barebones install
if ! { [ -x "$has_git" ] && [ -x "$has_grep" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] && [ -f "/usr/bin/mysql" ] && [ -d "/usr/include/mysql" ]; }; then
echo "Installing apt dependencies..."
if ! [ -x "$has_sudo" ]; then
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# REPO MAINTAINERS: KEEP CHANGES TO THIS IN SYNC WITH /tools/LinuxOneShot/SetupProgram/PreCompile.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"
#find out what we have (+e is important for this)
set +e
has_git="$(command -v git)"
has_cargo="$(command -v ~/.cargo/bin/cargo)"
has_sudo="$(command -v sudo)"
has_grep="$(command -v grep)"
set -e
# install cargo if needful
if ! [ -x "$has_cargo" ]; then
echo "Installing rust..."
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu
. ~/.profile
fi
# apt packages, libssl needed by rust-g but not included in TGS barebones install
if ! { [ -x "$has_git" ] && [ -x "$has_grep" ] && [ -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 git libssl-dev:i386
rm -rf /var/lib/apt/lists/*
else
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y git libssl-dev:i386
sudo rm -rf /var/lib/apt/lists/*
fi
fi
#update rust-g
if [ ! -d "rust-g" ]; then
echo "Cloning rust-g..."
git clone https://github.com/tgstation/rust-g
else
echo "Fetching rust-g..."
cd rust-g
git fetch
cd ..
fi
echo "Deploying rust-g..."
cd rust-g
git checkout "$RUST_G_VERSION"
~/.cargo/bin/cargo build --release
mv target/release/librust_g.so "$1/rust_g"
cd ..