Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated and Improved install scripts. #3006

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 11 additions & 28 deletions build/alpine/install-packages.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
#!/bin/sh

set -e
set -o pipefail
keepittechie marked this conversation as resolved.
Show resolved Hide resolved

# Install necessary packages
apk add --no-cache -U \
openssl \
imagemagick \
file \
lsof \
su-exec \
coreutils \
findutils \
procps \
shadow \
bash \
curl iputils \
git \
jq \
mysql-client \
tzdata \
rsync \
nano \
sudo \
tar \
zstd \
nfs-utils \
libpcap \
libwebp \
libcap
openssl imagemagick file lsof su-exec coreutils findutils procps shadow bash \
curl iputils git jq mysql-client tzdata rsync nano sudo tar zstd nfs-utils \
libpcap libwebp libcap
keepittechie marked this conversation as resolved.
Show resolved Hide resolved

# 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 <<EOF >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF
30 changes: 20 additions & 10 deletions build/ol/install-gosu.sh
Original file line number Diff line number Diff line change
@@ -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
58 changes: 24 additions & 34 deletions build/ol/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,46 @@ 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<<EOF

# Add EPEL repository
tee /etc/yum.repos.d/ol8-epel.repo <<EOF
[ol8_developer_EPEL]
name= Oracle Linux \$releasever EPEL (\$basearch)
name=Oracle Linux \$releasever EPEL (\$basearch)
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/\$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
EOF
dnf update -y

dnf install -y \
ImageMagick \
file \
sudo \
net-tools \
iputils \
curl \
git \
git-lfs \
jq \
dos2unix \
mysql \
procps-ng \
tzdata \
rsync \
nano \
unzip \
zstd \
lbzip2 \
libpcap \
libwebp \
findutils \
which

# Update and install necessary packages
dnf update -y && dnf install -y \
keepittechie marked this conversation as resolved.
Show resolved Hide resolved
ImageMagick file sudo net-tools iputils curl git jq dos2unix mysql \
procps-ng tzdata rsync nano unzip zstd lbzip2 libpcap libwebp \
findutils which
keepittechie marked this conversation as resolved.
Show resolved Hide resolved

# Install Git LFS
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
dnf update -y
keepittechie marked this conversation as resolved.
Show resolved Hide resolved
keepittechie marked this conversation as resolved.
Show resolved Hide resolved
dnf install -y \
git-lfs
dnf install -y git-lfs

# Clean up DNF when done
dnf clean all

# Install gosu (assuming the script /build/ol/install-gosu.sh exists and is executable)
bash /build/ol/install-gosu.sh

# 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

# Set git credentials
echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
# Set git credentials globally
cat <<EOF >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF
14 changes: 12 additions & 2 deletions build/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

set -e

distro=$(cat /etc/os-release | grep -E "^ID=" | cut -d= -f2 | sed -e 's/"//g')
# Determine the distribution ID
distro=$(grep -E "^ID=" /etc/os-release | cut -d= -f2 | tr -d '"')

"$(dirname "$0")/${distro}/$1".sh
# Construct the script path
script_path="$(dirname "$0")/${distro}/$1.sh"

# Check if the script exists and execute it, or exit with an error
if [ -x "$script_path" ]; then
"$script_path"
else
echo "Error: Script $script_path not found or not executable."
exit 1
fi
keepittechie marked this conversation as resolved.
Show resolved Hide resolved
42 changes: 14 additions & 28 deletions build/ubuntu/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,30 @@ export TARGET

set -euo pipefail

# Update and install packages
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
imagemagick file gosu sudo net-tools iputils-ping curl git jq dos2unix \
mysql-client tzdata rsync nano unzip zstd lbzip2 nfs-common libpcap0.8 webp

DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
imagemagick \
file \
gosu \
sudo \
net-tools \
iputils-ping \
curl \
git \
jq \
dos2unix \
mysql-client \
tzdata \
rsync \
nano \
unzip \
zstd \
lbzip2 \
nfs-common \
libpcap0.8 \
webp

keepittechie marked this conversation as resolved.
Show resolved Hide resolved
# 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 <<EOF >> /etc/gitconfig
[user]
name = Minecraft Server on Docker
email = server@example.com
EOF