fix: Install script not working as intended (#15)

Related to https://github.com/blue-build/github-action/issues/5
This commit is contained in:
Gerald Pinder 2024-01-26 16:12:45 -05:00 committed by GitHub
parent 922dd5efb2
commit d7a9b8115f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 9 deletions

View file

@ -35,7 +35,7 @@ cargo install --locked blue-build
This will install the binary on your system in `/usr/local/bin`. This is only a `linux-gnu` version.
```bash
podman run --rm ghcr.io/blue-build/cli:latest-installer | sudo bash
podman run --rm ghcr.io/blue-build/cli:latest-installer | bash
```
## How to use

View file

@ -2,29 +2,39 @@
set -euo pipefail
# We use sudo for podman so that we can copy directly into /usr/local/bin
function cleanup() {
echo "Cleaning up image"
podman stop -i -t 0 blue-build-installer
sudo podman stop -i -t 0 blue-build-installer
sleep 2
podman image rm ghcr.io/blue-build/cli:latest-installer
sudo podman image rm ghcr.io/blue-build/cli:latest-installer
}
podman pull ghcr.io/blue-build/cli:latest-installer
trap cleanup SIGINT
podman run -d --rm --name blue-build-installer ghcr.io/blue-build/cli:latest-installer tail -f /dev/null
sudo podman run \
--pull always \
--replace \
--detach \
--rm \
--name blue-build-installer \
ghcr.io/blue-build/cli:latest-installer \
tail -f /dev/null
set +e
podman cp blue-build-installer:/out/bb /usr/local/bin/bb
sudo podman cp blue-build-installer:/out/bb /usr/local/bin/bb
RETVAL=$?
set -e
if [ -n $RETVAL ]; then
if [ $RETVAL != 0 ]; then
cleanup
echo "Failed to copy file, try:"
printf "\tpodman run --rm ghcr.io/blue-build/cli:latest-installer | sudo bash\n"
echo "Failed to copy file"
exit 1
else
# sudo mv bb /usr/local/bin/
echo "Finished! BlueBuild has been installed at /usr/local/bin/bb"
cleanup
fi