|
2 | 2 |
|
3 | 3 | set -eu |
4 | 4 |
|
5 | | -XP_CHANNEL=${XP_CHANNEL:-stable} |
6 | | -XP_VERSION=${XP_VERSION:-current} |
| 5 | +# Use "latest" if not specified, otherwise accept explicit tag like v0.3.1 |
| 6 | +VERSION=${VERSION:-latest} |
7 | 7 |
|
8 | 8 | os=$(uname -s) |
9 | 9 | arch=$(uname -m) |
10 | 10 | OS=${OS:-"${os}"} |
11 | 11 | ARCH=${ARCH:-"${arch}"} |
12 | 12 | OS_ARCH="" |
13 | | - |
14 | | -BIN=${BIN:-crank} |
| 13 | +BIN="crossplane-diff" |
15 | 14 |
|
16 | 15 | unsupported_arch() { |
17 | 16 | local os=$1 |
18 | 17 | local arch=$2 |
19 | | - echo "Crossplane does not support $os / $arch at this time." |
| 18 | + echo "❌ crossplane-diff does not support $os / $arch at this time." |
20 | 19 | exit 1 |
21 | 20 | } |
22 | 21 |
|
| 22 | +# Detect OS/Architecture |
23 | 23 | case $OS in |
24 | 24 | CYGWIN* | MINGW64* | Windows*) |
25 | | - if [ $ARCH = "x86_64" ] |
26 | | - then |
27 | | - OS_ARCH=windows_amd64 |
28 | | - BIN=crank.exe |
| 25 | + if [ "$ARCH" = "x86_64" ]; then |
| 26 | + OS_ARCH="windows_amd64.exe" |
| 27 | + BIN="crossplane-diff.exe" |
29 | 28 | else |
30 | | - unsupported_arch $OS $ARCH |
| 29 | + unsupported_arch "$OS" "$ARCH" |
31 | 30 | fi |
32 | 31 | ;; |
33 | 32 | Darwin) |
34 | 33 | case $ARCH in |
35 | 34 | x86_64|amd64) |
36 | | - OS_ARCH=darwin_amd64 |
| 35 | + OS_ARCH="darwin_amd64" |
37 | 36 | ;; |
38 | 37 | arm64) |
39 | | - OS_ARCH=darwin_arm64 |
| 38 | + OS_ARCH="darwin_arm64" |
40 | 39 | ;; |
41 | 40 | *) |
42 | | - unsupported_arch $OS $ARCH |
| 41 | + unsupported_arch "$OS" "$ARCH" |
43 | 42 | ;; |
44 | 43 | esac |
45 | 44 | ;; |
46 | 45 | Linux) |
47 | 46 | case $ARCH in |
48 | 47 | x86_64|amd64) |
49 | | - OS_ARCH=linux_amd64 |
| 48 | + OS_ARCH="linux_amd64" |
50 | 49 | ;; |
51 | 50 | arm64|aarch64) |
52 | | - OS_ARCH=linux_arm64 |
| 51 | + OS_ARCH="linux_arm64" |
| 52 | + ;; |
| 53 | + arm) |
| 54 | + OS_ARCH="linux_arm" |
| 55 | + ;; |
| 56 | + ppc64le) |
| 57 | + OS_ARCH="linux_ppc64le" |
53 | 58 | ;; |
54 | 59 | *) |
55 | | - unsupported_arch $OS $ARCH |
| 60 | + unsupported_arch "$OS" "$ARCH" |
56 | 61 | ;; |
57 | 62 | esac |
58 | 63 | ;; |
59 | 64 | *) |
60 | | - unsupported_arch $OS $ARCH |
| 65 | + unsupported_arch "$OS" "$ARCH" |
61 | 66 | ;; |
62 | 67 | esac |
63 | 68 |
|
64 | | -url="https://releases.crossplane.io/${XP_CHANNEL}/${XP_VERSION}/bin/${OS_ARCH}/${BIN}" |
65 | | -if ! curl -sfLo crossplane "${url}"; then |
66 | | - echo "Failed to download Crossplane CLI. Please make sure version ${XP_VERSION} exists on channel ${XP_CHANNEL}." |
| 69 | +# Choose correct URL pattern |
| 70 | +if [ "$VERSION" = "latest" ]; then |
| 71 | + url="https://github.com/crossplane-contrib/crossplane-diff/releases/latest/download/crossplane-diff_${OS_ARCH}" |
| 72 | +else |
| 73 | + url="https://github.com/crossplane-contrib/crossplane-diff/releases/download/${VERSION}/crossplane-diff_${OS_ARCH}" |
| 74 | +fi |
| 75 | + |
| 76 | +echo "📦 Downloading crossplane-diff (${VERSION}) for ${OS_ARCH}..." |
| 77 | +echo "➡️ ${url}" |
| 78 | +echo |
| 79 | + |
| 80 | +# Download the binary |
| 81 | +if ! curl -sfLo "${BIN}" "${url}"; then |
| 82 | + echo "❌ Failed to download crossplane-diff version '${VERSION}'." |
| 83 | + echo "Please check available versions at:" |
| 84 | + echo " https://github.com/crossplane-contrib/crossplane-diff/releases" |
67 | 85 | exit 1 |
68 | 86 | fi |
69 | 87 |
|
70 | | -chmod +x crossplane |
| 88 | +chmod +x "${BIN}" |
71 | 89 |
|
72 | | -echo "crossplane CLI downloaded successfully! Run the following commands to finish installing it:" |
73 | | -echo |
74 | | -echo sudo mv crossplane /usr/local/bin |
75 | | -echo crossplane --help |
76 | 90 | echo |
77 | | -echo "Visit https://crossplane.io to get started. 🚀" |
78 | | -echo "Have a nice day! 👋\n" |
| 91 | +echo "✅ crossplane-diff downloaded successfully!" |
| 92 | +echo |
| 93 | +echo "To finish installation, run:" |
| 94 | +echo " sudo mv ${BIN} /usr/local/bin/" |
| 95 | +echo " crossplane-diff --help" |
| 96 | +echo |
| 97 | +echo "Visit https://github.com/crossplane-contrib/crossplane-diff for more info 🚀" |
0 commit comments