-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·40 lines (32 loc) · 937 Bytes
/
run
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
#!/bin/bash
set -Eeu -o pipefail
MITAMAE_PATH="/usr/bin/mitamae"
MITAMAE_VERSION="1.14.0"
MITAMAE_CHECKSUM="318968af9995c83929a5aedd3216e9c4ecb14db2e53340efaac4444ff5e18bde"
LOG_LEVEL="${LOG_LEVEL:-info}"
OVERRIDES="${OVERRIDES:-}"
NODE_ATTRIBUTES="--node-yaml vars.yml ${OVERRIDES}"
_cleanup() {
rm -f /tmp/mitamae
}
install_mitamae() {
trap _cleanup EXIT TERM
if [ -x "${MITAMAE_PATH}" ] ; then
if ${MITAMAE_PATH} version | grep -vq ${MITAMAE_VERSION} ; then
_run_install
fi
else
_run_install
fi
}
_run_install() {
wget -O /tmp/mitamae "https://github.com/itamae-kitchen/mitamae/releases/download/v${MITAMAE_VERSION}/mitamae-x86_64-linux" &&
echo "${MITAMAE_CHECKSUM} /tmp/mitamae" | sha256sum -c - &&
sudo install -m 0755 /tmp/mitamae "${MITAMAE_PATH}"
}
install_mitamae
(
cd mitamae/
# shellcheck disable=SC2086
sudo -E mitamae local -l "${LOG_LEVEL}" ${NODE_ATTRIBUTES} mitamae.rb
)