-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
executable file
·52 lines (41 loc) · 963 Bytes
/
install.sh
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
#!/usr/bin/env bash
set -euo pipefail
VERSION=v0.9.0
# Container runtime
function cr() {
if command -v podman > /dev/null; then
podman $@
elif command -v docker > /dev/null; then
docker $@
else
echo "Need docker or podman to install!!"
exit 1
fi
}
# We use sudo for podman so that we can copy directly into /usr/local/bin
function cleanup() {
echo "Cleaning up image"
cr rm blue-build-installer
sleep 2
cr image rm ghcr.io/blue-build/cli:${VERSION}-installer
}
trap cleanup SIGINT
cr create \
--pull always \
--replace \
--name blue-build-installer \
ghcr.io/blue-build/cli:${VERSION}-installer
set +e
cr cp blue-build-installer:/out/bluebuild /tmp/
sudo mv /tmp/bluebuild /usr/local/bin/
RETVAL=$?
set -e
if [ $RETVAL != 0 ]; then
cleanup
echo "Failed to copy file"
exit 1
else
# sudo mv bluebuild /usr/local/bin/
echo "Finished! BlueBuild has been installed at /usr/local/bin/bluebuild"
cleanup
fi