-
Notifications
You must be signed in to change notification settings - Fork 628
Expand file tree
/
Copy pathprerequisites-mariner.sh
More file actions
executable file
·126 lines (113 loc) · 3.29 KB
/
prerequisites-mariner.sh
File metadata and controls
executable file
·126 lines (113 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -e
# Define usage function
usage() {
echo "Usage: $0 [OPTIONS]"
echo "Install prerequisites for Azure Linux toolkit"
echo ""
echo "Options:"
echo " --configure-docker Enable Docker service and add current user to docker group"
echo " --no-install-prereqs Skip installation of prerequisite packages"
echo " --use-msft-golang Use msft-golang-1.24.1 instead of golang-1.24.3"
echo " --help Display this help message"
exit 1
}
# Initialize option flags
CONFIGURE_DOCKER=false
INSTALL_PREREQS=true
USE_MSFT_GOLANG=false
# Parse command line arguments
while [ $# -gt 0 ]; do
case "$1" in
--configure-docker)
CONFIGURE_DOCKER=true
;;
--no-install-prereqs)
INSTALL_PREREQS=false
;;
--use-msft-golang)
USE_MSFT_GOLANG=true
;;
--help)
usage
;;
*)
echo "Unknown option: $1"
usage
;;
esac
shift
done
# Install prerequisites if not disabled
# golang version pinned for stability to avoid breaking changes. As of 11-Jun-2025 we are using the following golang versions:
# - msft-golang-1.24.1 for Mariner 2.0
# - golang-1.24.3 for Mariner 3.0
# When making a breaking change to the toolkit which requires a newer golang version, update this version.
if [ "$INSTALL_PREREQS" = true ]; then
echo "Installing required packages..."
# Determine which golang package to use based on the option
if [ "$USE_MSFT_GOLANG" = true ]; then
# golang will conflict with msft-golang, so we need to remove it if it exists
if rpm -q golang >/dev/null 2>&1; then
echo "Installed golang conflicts with required msft-golang. Removing existing golang package..."
tdnf -y remove golang
fi
GOLANG_PKG="msft-golang-1.24.1"
echo "Using Microsoft Go version: $GOLANG_PKG"
else
GOLANG_PKG="golang-1.24.3"
echo "Using standard Go version: $GOLANG_PKG"
fi
tdnf -y install \
acl \
binutils \
cdrkit \
curl \
diffutils \
dosfstools \
gawk \
genisoimage \
git \
glibc-devel \
$GOLANG_PKG \
jq \
kernel-headers \
make \
moby-cli \
moby-engine \
openssl \
parted \
pigz \
qemu-img \
rpm \
rpm-build \
sudo \
systemd \
tar \
wget \
xfsprogs \
zstd
else
echo "Skipping installation of prerequisite packages..."
fi
# Configure Docker if requested
if [ "$CONFIGURE_DOCKER" = true ]; then
echo "Enabling Docker service..."
systemctl enable --now docker.service
echo "Adding current user to 'docker' group..."
usermod -aG docker $USER
echo "*** NOTE: You will need to log out and log back in for user changes to take effect. ***"
fi
script_file=$(readlink -f "$0")
# md file is the same name as the script file, but with a .md extension
md_file="${script_file%.*}.md"
echo ""
echo "Install complete..."
echo ""
if [ "$CONFIGURE_DOCKER" = false ]; then
echo "**** Additional optional steps are available. Run with --help for more information. ****"
echo "**** Refer to ${md_file} for more details. ****"
fi
echo ""