From 85af0847727f6d3da0f66d0b0dfcf6790229a867 Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Fri, 26 Jan 2024 16:05:11 -0500 Subject: [PATCH 1/2] fix: Install script not working as intended --- README.md | 2 +- install.sh | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5bb4d460..39f82d73 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/install.sh b/install.sh index 8fe7ed73..45b87b0f 100755 --- a/install.sh +++ b/install.sh @@ -2,29 +2,35 @@ 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 + rm -f bb } -podman pull ghcr.io/blue-build/cli:latest-installer +trap cleanup SIGINT + +sudo podman pull ghcr.io/blue-build/cli:latest-installer -podman run -d --rm --name blue-build-installer ghcr.io/blue-build/cli:latest-installer tail -f /dev/null +sudo podman run --replace -d --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 From 34142c8b987356a7b65d07febd883a56be71af4c Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Fri, 26 Jan 2024 16:07:00 -0500 Subject: [PATCH 2/2] Further clean up script --- install.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 45b87b0f..b1ca3c56 100755 --- a/install.sh +++ b/install.sh @@ -9,14 +9,18 @@ function cleanup() { sudo podman stop -i -t 0 blue-build-installer sleep 2 sudo podman image rm ghcr.io/blue-build/cli:latest-installer - rm -f bb } trap cleanup SIGINT -sudo podman pull ghcr.io/blue-build/cli:latest-installer - -sudo podman run --replace -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 sudo podman cp blue-build-installer:/out/bb /usr/local/bin/bb