Files
Roxy af3c75e27f Move unzip install to InstallDeps.sh (#91785)
## About The Pull Request

Move the line to install `unzip` from `PreCompile.sh` to
`InstallDeps.sh` so it only runs if you're actually missing unzip, and
gives a warning that you'll need to install it manually if it fails to
passwordless sudo install it

## Why It's Good For The Game

![image](https://github.com/user-attachments/assets/22feeb16-17d2-4343-956b-859034568975)
Deployments are now failing if your TGS system user isn't root because
it's trying to install this every time with no sudo, `InstallDeps.sh` is
a more appropriate place for it

## Changelog
🆑
server: TGS deployments should no longer fail to install unzip
/🆑

(cherry picked from commit c9cece85c2)
2025-06-26 19:54:06 -04:00

53 lines
2.4 KiB
Bash
Executable File

#!/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_ytdlp="$(command -v yt-dlp)"
has_pip3="$(command -v pip3)"
has_unzip="$(command -v unzip)"
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" ] && [ -x "$has_pip3" ] && [ -x "$has_unzip" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] ); then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! HEY YOU THERE, READING THE TGS LOGS READ THIS!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "We are about to try installing native dependencies, we will use 'sudo' if possible for this, but it may fail because the tgstation-server user doesn't have passwordless sudo."
echo "WE DO NOT RECOMMEND GRANTING PASSWORDLESS SUDO!!! Instead, install all the dependencies yourself with the following command:"
echo ".................................................................................................................................................."
echo "sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl libclang-dev g++-multilib python3 python3-pip unzip"
echo ".................................................................................................................................................."
echo "Attempting to install 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 libclang-dev g++-multilib python3 python3-pip unzip
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 libclang-dev g++-multilib python3 python3-pip unzip
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
# install or update yt-dlp when not present, or if it is present with pip3,
# which we assume was used to install it
if ! [ -x "$has_ytdlp" ]; then
echo "Installing yt-dlp with pip3..."
pip3 install yt-dlp --break-system-packages
else
echo "Ensuring yt-dlp is up-to-date with pip3..."
pip3 install yt-dlp -U --break-system-packages
fi