|
1 | 1 | #!/bin/bash
|
2 |
| -CAPSULE_VERSION="0.1.7" |
3 | 2 |
|
| 3 | +LAST_CAPSULE_VERSION="0.1.8" |
| 4 | +echo "System: ${OSTYPE} $(uname -m)" |
4 | 5 |
|
5 |
| -if [[ "$OSTYPE" == "linux-gnu"* ]]; then |
6 |
| - CAPSULE_OS="linux" |
7 |
| -elif [[ "$OSTYPE" == "darwin"* ]]; then |
8 |
| - CAPSULE_OS="darwin" |
9 |
| -else |
10 |
| - CAPSULE_OS="linux" |
| 6 | +if [[ $1 = "help" ]] |
| 7 | +then |
| 8 | + echo "usage: $0" |
| 9 | + echo "The script will detect the OS & ARCH and use the last version of capsule (${LAST_CAPSULE_VERSION})" |
| 10 | + echo "You can force the values by setting these environment variables:" |
| 11 | + echo "- CAPSULE_OS (linux, darwin)" |
| 12 | + echo "- CAPSULE_ARCH (amd64, arm64)" |
| 13 | + echo "- CAPSULE_VERSION" |
| 14 | + exit 0 |
11 | 15 | fi
|
12 | 16 |
|
13 |
| -if [[ "$(uname -m)" == "x86_64" ]]; then |
14 |
| - CAPSULE_ARCH="amd64" |
15 |
| -elif [[ "$OSTYPE" == "arm64" ]]; then |
16 |
| - CAPSULE_ARCH="arm64" |
17 |
| -else |
18 |
| - CAPSULE_ARCH="amd64" |
| 17 | +if [ -z "$CAPSULE_VERSION" ] |
| 18 | +then |
| 19 | + CAPSULE_VERSION=$LAST_CAPSULE_VERSION |
19 | 20 | fi
|
20 | 21 |
|
21 |
| -CAPSULE_ARCH=$(uname -m) |
| 22 | +if [ -z "$CAPSULE_OS" ] |
| 23 | +then |
| 24 | + if [[ "$OSTYPE" == "linux-gnu"* ]]; then |
| 25 | + CAPSULE_OS="linux" |
| 26 | + elif [[ "$OSTYPE" == "darwin"* ]]; then |
| 27 | + CAPSULE_OS="darwin" |
| 28 | + else |
| 29 | + CAPSULE_OS="linux" |
| 30 | + fi |
| 31 | +fi |
| 32 | + |
| 33 | +if [ -z "$CAPSULE_ARCH" ] |
| 34 | +then |
| 35 | + if [[ "$(uname -m)" == "x86_64" ]]; then |
| 36 | + CAPSULE_ARCH="amd64" |
| 37 | + elif [[ "$(uname -m)" == "arm64" ]]; then |
| 38 | + CAPSULE_ARCH="arm64" |
| 39 | + elif [[ $(uname -m) == "aarch64" ]]; then |
| 40 | + CAPSULE_ARCH="arm64" |
| 41 | + else |
| 42 | + CAPSULE_ARCH="amd64" |
| 43 | + fi |
| 44 | +fi |
| 45 | + |
| 46 | + |
| 47 | +echo "Installing capsule elements [${CAPSULE_VERSION}] ${CAPSULE_OS} ${CAPSULE_ARCH}" |
22 | 48 |
|
23 | 49 | CAPSULE_MODULE="caps"
|
24 |
| -echo "💊 Installing ${CAPSULE_MODULE}..." |
| 50 | +echo "Installing ${CAPSULE_MODULE}..." |
25 | 51 | wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
26 | 52 | sudo tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory /usr/local/bin
|
27 | 53 | rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
28 | 54 |
|
29 | 55 | CAPSULE_MODULE="capsule"
|
30 |
| -echo "💊 Installing ${CAPSULE_MODULE}..." |
| 56 | +echo "Installing ${CAPSULE_MODULE}..." |
31 | 57 | wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
32 | 58 | sudo tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory /usr/local/bin
|
33 | 59 | rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
34 | 60 |
|
35 | 61 | CAPSULE_MODULE="capsule-registry"
|
36 |
| -echo "💊 Installing ${CAPSULE_MODULE}..." |
| 62 | +echo "Installing ${CAPSULE_MODULE}..." |
37 | 63 | wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
38 | 64 | sudo tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory /usr/local/bin
|
39 | 65 | rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
40 | 66 |
|
41 | 67 | CAPSULE_MODULE="capsule-reverse-proxy"
|
42 |
| -echo "💊 Installing ${CAPSULE_MODULE}..." |
| 68 | +echo "Installing ${CAPSULE_MODULE}..." |
43 | 69 | wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
44 | 70 | sudo tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory /usr/local/bin
|
45 | 71 | rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
46 | 72 |
|
47 | 73 | CAPSULE_MODULE="capsule-worker"
|
48 |
| -echo "💊 Installing ${CAPSULE_MODULE}..." |
| 74 | +echo "Installing ${CAPSULE_MODULE}..." |
49 | 75 | wget https://github.com/bots-garden/capsule/releases/download/${CAPSULE_VERSION}/${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
50 | 76 | sudo tar -zxf ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz --directory /usr/local/bin
|
51 | 77 | rm ${CAPSULE_MODULE}-${CAPSULE_VERSION}-${CAPSULE_OS}-${CAPSULE_ARCH}.tar.gz
|
0 commit comments