Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Install script not working as intended #15

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 18 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Loading