From de1d7f422c2493e1f082a7c8d89f087810ac6a0f Mon Sep 17 00:00:00 2001 From: Josh <49377875+keepittechie@users.noreply.github.com> Date: Sun, 21 Jul 2024 13:40:59 -0700 Subject: [PATCH] Updated and Improved install scripts. (#3006) --- build/alpine/install-packages.sh | 14 ++++++++++---- build/ol/install-gosu.sh | 30 ++++++++++++++++++++---------- build/ol/install-packages.sh | 30 +++++++++++++++++++++--------- build/ubuntu/install-packages.sh | 17 +++++++++++------ 4 files changed, 62 insertions(+), 29 deletions(-) diff --git a/build/alpine/install-packages.sh b/build/alpine/install-packages.sh index ebafe041..d045b302 100755 --- a/build/alpine/install-packages.sh +++ b/build/alpine/install-packages.sh @@ -3,6 +3,7 @@ set -e set -o pipefail +# Install necessary packages apk add --no-cache -U \ openssl \ imagemagick \ @@ -14,7 +15,8 @@ apk add --no-cache -U \ procps \ shadow \ bash \ - curl iputils \ + curl \ + iputils \ git \ jq \ mysql-client \ @@ -29,11 +31,15 @@ apk add --no-cache -U \ libwebp \ libcap -# Patched knockd +# Download and install patched knockd curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz ln -s /usr/local/sbin/knockd /usr/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd -# Set git credentials -echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig +# Set Git credentials globally +cat <> /etc/gitconfig +[user] + name = Minecraft Server on Docker + email = server@example.com +EOF \ No newline at end of file diff --git a/build/ol/install-gosu.sh b/build/ol/install-gosu.sh index e2d24826..f01aec3d 100755 --- a/build/ol/install-gosu.sh +++ b/build/ol/install-gosu.sh @@ -1,12 +1,22 @@ #!/bin/bash -if [[ $(uname -m) == "aarch64" ]]; then - curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-arm64 - chmod +x /bin/gosu -elif [[ $(uname -m) == "x86_64" ]]; then - curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-amd64 - chmod +x /bin/gosu -else - echo "Not supported!" - exit 1 -fi +set -euo pipefail + +GOSU_VERSION="1.16" +GOSU_BASE_URL="https://github.com/tianon/gosu/releases/download/$GOSU_VERSION" + +case $(uname -m) in + "aarch64") + GOSU_ARCH="gosu-arm64" + ;; + "x86_64") + GOSU_ARCH="gosu-amd64" + ;; + *) + echo "Architecture not supported!" + exit 1 + ;; +esac + +curl -sL -o /bin/gosu "${GOSU_BASE_URL}/${GOSU_ARCH}" +chmod +x /bin/gosu diff --git a/build/ol/install-packages.sh b/build/ol/install-packages.sh index 019232bc..d7dca7f1 100755 --- a/build/ol/install-packages.sh +++ b/build/ol/install-packages.sh @@ -4,20 +4,25 @@ export TARGET set -euo pipefail +# Install and configure dnf microdnf install dnf -y - dnf install 'dnf-command(config-manager)' -y dnf config-manager --set-enabled ol8_codeready_builder -tee /etc/yum.repos.d/ol8-epel.repo<> /etc/gitconfig +# Set git credentials globally +cat <> /etc/gitconfig +[user] + name = Minecraft Server on Docker + email = server@example.com +EOF diff --git a/build/ubuntu/install-packages.sh b/build/ubuntu/install-packages.sh index 626d63d5..b1e2a5b3 100755 --- a/build/ubuntu/install-packages.sh +++ b/build/ubuntu/install-packages.sh @@ -4,8 +4,8 @@ export TARGET set -euo pipefail +# Update and install packages apt-get update - DEBIAN_FRONTEND=noninteractive \ apt-get install -y \ imagemagick \ @@ -29,19 +29,24 @@ apt-get install -y \ libpcap0.8 \ webp +# Install Git LFS curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash apt-get update -apt-get install -y \ - git-lfs +apt-get install -y git-lfs +# Clean up APT when done apt-get clean -# Patched knockd +# Download and install patched knockd curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz ln -s /usr/local/sbin/knockd /usr/sbin/knockd setcap cap_net_raw=ep /usr/local/sbin/knockd find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \; -# Set git credentials -echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig +# Set git credentials globally +cat <> /etc/gitconfig +[user] + name = Minecraft Server on Docker + email = server@example.com +EOF