-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·58 lines (45 loc) · 1.41 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·58 lines (45 loc) · 1.41 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
#!/bin/sh
set -e
# grab the version
readonly K3D_VERSION="${VERSION:-latest}"
# apt-get configuration
export DEBIAN_FRONTEND=noninteractive
preflight () {
if command -v wget > /dev/null; then
return
fi
if [ -e /etc/os-release ]; then
. /etc/os-release
fi
case "${ID}" in
'debian' | 'ubuntu')
apt-get update
apt-get install -y --no-install-recommends \
wget \
ca-certificates
;;
'fedora')
dnf -y install wget
;;
*) echo "The ${ID} distribution is not supported."; exit 1 ;;
esac
}
main () {
preflight
local ARCH="$(uname -m)"
case "${ARCH}" in
"aarch64") ARCH="arm64" ;;
"x86_64") ARCH="amd64" ;;
*) echo "The current architecture (${ARCH}) is not supported."; exit 1 ;;
esac
local K3D_URL="https://github.com/k3d-io/k3d/releases/latest/download/k3d-linux-${ARCH}"
if [ "${K3D_VERSION}" != "latest" ] ; then
K3D_URL="https://github.com/k3d-io/k3d/releases/download/v${K3D_VERSION#[vV]}/k3d-linux-${ARCH}"
fi
echo "Installing k3d ${K3D_VERSION} for ${ARCH} ..."
echo "Downloading ${K3D_URL} ..."
wget --no-verbose -O /usr/local/bin/k3d "${K3D_URL}"
chmod +x /usr/local/bin/k3d
echo "k3d ${K3D_VERSION} for ${ARCH} installed at $(command -v k3d) with checksum $(sha256sum $(command -v k3d))."
}
main "$@"