Skip to content

Commit de1d7f4

Browse files
authored
Updated and Improved install scripts. (#3006)
1 parent b393b22 commit de1d7f4

File tree

4 files changed

+62
-29
lines changed

4 files changed

+62
-29
lines changed

build/alpine/install-packages.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -e
44
set -o pipefail
55

6+
# Install necessary packages
67
apk add --no-cache -U \
78
openssl \
89
imagemagick \
@@ -14,7 +15,8 @@ apk add --no-cache -U \
1415
procps \
1516
shadow \
1617
bash \
17-
curl iputils \
18+
curl \
19+
iputils \
1820
git \
1921
jq \
2022
mysql-client \
@@ -29,11 +31,15 @@ apk add --no-cache -U \
2931
libwebp \
3032
libcap
3133

32-
# Patched knockd
34+
# Download and install patched knockd
3335
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
3436
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
3537
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
3638
setcap cap_net_raw=ep /usr/local/sbin/knockd
3739

38-
# Set git credentials
39-
echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
40+
# Set Git credentials globally
41+
cat <<EOF >> /etc/gitconfig
42+
[user]
43+
name = Minecraft Server on Docker
44+
email = server@example.com
45+
EOF

build/ol/install-gosu.sh

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
#!/bin/bash
22

3-
if [[ $(uname -m) == "aarch64" ]]; then
4-
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-arm64
5-
chmod +x /bin/gosu
6-
elif [[ $(uname -m) == "x86_64" ]]; then
7-
curl -sL -o /bin/gosu https://github.com/tianon/gosu/releases/download/1.16/gosu-amd64
8-
chmod +x /bin/gosu
9-
else
10-
echo "Not supported!"
11-
exit 1
12-
fi
3+
set -euo pipefail
4+
5+
GOSU_VERSION="1.16"
6+
GOSU_BASE_URL="https://github.com/tianon/gosu/releases/download/$GOSU_VERSION"
7+
8+
case $(uname -m) in
9+
"aarch64")
10+
GOSU_ARCH="gosu-arm64"
11+
;;
12+
"x86_64")
13+
GOSU_ARCH="gosu-amd64"
14+
;;
15+
*)
16+
echo "Architecture not supported!"
17+
exit 1
18+
;;
19+
esac
20+
21+
curl -sL -o /bin/gosu "${GOSU_BASE_URL}/${GOSU_ARCH}"
22+
chmod +x /bin/gosu

build/ol/install-packages.sh

+21-9
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@ export TARGET
44

55
set -euo pipefail
66

7+
# Install and configure dnf
78
microdnf install dnf -y
8-
99
dnf install 'dnf-command(config-manager)' -y
1010
dnf config-manager --set-enabled ol8_codeready_builder
11-
tee /etc/yum.repos.d/ol8-epel.repo<<EOF
11+
12+
# Add EPEL repository
13+
tee /etc/yum.repos.d/ol8-epel.repo <<EOF
1214
[ol8_developer_EPEL]
13-
name= Oracle Linux \$releasever EPEL (\$basearch)
15+
name=Oracle Linux \$releasever EPEL (\$basearch)
1416
baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/\$basearch/
1517
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
1618
gpgcheck=1
1719
enabled=1
1820
EOF
21+
22+
# Update system
1923
dnf update -y
2024

25+
# Install necessary packages
2126
dnf install -y \
2227
ImageMagick \
2328
file \
@@ -26,7 +31,6 @@ dnf install -y \
2631
iputils \
2732
curl \
2833
git \
29-
git-lfs \
3034
jq \
3135
dos2unix \
3236
mysql \
@@ -42,18 +46,26 @@ dnf install -y \
4246
findutils \
4347
which
4448

49+
# Install Git LFS
4550
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
4651
dnf update -y
47-
dnf install -y \
48-
git-lfs
52+
dnf install -y git-lfs
53+
54+
# Clean up DNF when done
55+
dnf clean all
4956

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

52-
# Patched knockd
60+
# Download and install patched knockd
5361
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
5462
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
5563
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
5664
setcap cap_net_raw=ep /usr/local/sbin/knockd
5765

58-
# Set git credentials
59-
echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
66+
# Set git credentials globally
67+
cat <<EOF >> /etc/gitconfig
68+
[user]
69+
name = Minecraft Server on Docker
70+
email = server@example.com
71+
EOF

build/ubuntu/install-packages.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export TARGET
44

55
set -euo pipefail
66

7+
# Update and install packages
78
apt-get update
8-
99
DEBIAN_FRONTEND=noninteractive \
1010
apt-get install -y \
1111
imagemagick \
@@ -29,19 +29,24 @@ apt-get install -y \
2929
libpcap0.8 \
3030
webp
3131

32+
# Install Git LFS
3233
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
3334
apt-get update
34-
apt-get install -y \
35-
git-lfs
35+
apt-get install -y git-lfs
3636

37+
# Clean up APT when done
3738
apt-get clean
3839

39-
# Patched knockd
40+
# Download and install patched knockd
4041
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
4142
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
4243
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
4344
setcap cap_net_raw=ep /usr/local/sbin/knockd
4445
find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \;
4546

46-
# Set git credentials
47-
echo -e "[user]\n name = Minecraft Server on Docker\n email = server@example.com" >> /etc/gitconfig
47+
# Set git credentials globally
48+
cat <<EOF >> /etc/gitconfig
49+
[user]
50+
name = Minecraft Server on Docker
51+
email = server@example.com
52+
EOF

0 commit comments

Comments
 (0)