-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpalette-agent-install.sh.tmpl
45 lines (38 loc) · 1.08 KB
/
palette-agent-install.sh.tmpl
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
#!/bin/bash
set -e
# set -x
function check_dependency() {
if ! command -v $1 &>/dev/null; then
echo "$1 is not installed. Please install it and try again."
exit 1
fi
}
# Get the platform architecture
ARCH=$(uname -m)
VERSION=${PE_VERSION}
# Check the architecture and print the appropriate message
if [ "$ARCH" == "x86_64" ]; then
ARCH=amd64
elif [ "$ARCH" == "aarch64" ] || [ "$ARCH" == "arm64" ]; then
ARCH=arm64
else
echo "Unsupported architecture: $ARCH"
fi
# Check if the required tools are installed
dependencies=(bash systemctl jq rsync zstd)
for dep in "${dependencies[@]}"; do
check_dependency $dep
done
IMAGE=${IMAGE:-${IMAGE_REPO}/stylus-agent-mode-linux-${ARCH}:${VERSION}}
URL=${URL:-${AGENT_URL_PREFIX}/${BIN_PREFIX}-linux-${ARCH}}
# Download palette-agent
curl -Ls $URL -o palette-agent
chmod +x palette-agent
# Install with palette-agent
if [ -z "$USERDATA" ]; then
# Install without user data
./palette-agent install --source $IMAGE
else
# Install with user data
./palette-agent install --source $IMAGE --config "$USERDATA"
fi