mirror of
https://github.com/pollen-robotics/microduck.git
synced 2026-12-03 02:47:45 +08:00
The duckctl builds move into dev.yml and publish onto `daemon-dev-<branch>`, rather than a `duckctl-dev-<branch>` of their own. Separate workflows could not share a release, because dev.yml deletes and recreates it. One workflow can: the daemon job now hands its signed dist to a publish job that waits for both. Only the daemon is required there, so a failed duckctl build leaves its file out and never holds back what boards install. The updater fetches assets by exact name, so these files sit beside the board's without being seen. duckctl.yml and the prune case for `duckctl-dev-` go. Assisted-by: Claude:claude-opus-5-5
48 lines
1.6 KiB
Bash
Executable File
48 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Install the `duckctl` a branch last built, on Linux or macOS, with no Rust toolchain.
|
|
#
|
|
# curl -fsSL https://raw.githubusercontent.com/pollen-robotics/microduck/main/scripts/install-duckctl.sh | sh
|
|
# curl -fsSL .../install-duckctl.sh | sh -s -- udp-pad
|
|
#
|
|
# The binary comes from the `daemon-dev-<branch>` prerelease that `.github/workflows/dev.yml`
|
|
# replaces on every push; the branch defaults to `main`. It goes to `$DUCKCTL_DIR`, by default
|
|
# `~/.local/bin`, which needs no sudo.
|
|
set -eu
|
|
|
|
REPO=pollen-robotics/microduck
|
|
branch="${1:-main}"
|
|
dir="${DUCKCTL_DIR:-$HOME/.local/bin}"
|
|
|
|
case "$(uname -s)" in
|
|
Linux) os=linux ;;
|
|
Darwin) os=macos ;;
|
|
*) echo "install-duckctl: $(uname -s) is not covered here; Windows takes the .zip" >&2; exit 1 ;;
|
|
esac
|
|
case "$(uname -m)" in
|
|
x86_64 | amd64) arch=x86_64 ;;
|
|
arm64 | aarch64)
|
|
if [ "$os" = macos ]; then arch=arm64; else arch=aarch64; fi ;;
|
|
*) echo "install-duckctl: no build for $(uname -m)" >&2; exit 1 ;;
|
|
esac
|
|
|
|
url="https://github.com/${REPO}/releases/download/daemon-dev-${branch}/duckctl-${os}-${arch}.tar.gz"
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
echo "duckctl from ${branch}: ${url}"
|
|
if ! curl -fsSL "$url" -o "$tmp/duckctl.tar.gz"; then
|
|
echo "install-duckctl: no build of '${branch}' — has the branch been pushed since dev.yml" >&2
|
|
echo "built duckctl, and has that run finished?" >&2
|
|
exit 1
|
|
fi
|
|
tar -xzf "$tmp/duckctl.tar.gz" -C "$tmp"
|
|
mkdir -p "$dir"
|
|
mv "$tmp/duckctl" "$dir/duckctl"
|
|
chmod +x "$dir/duckctl"
|
|
echo "installed $dir/duckctl"
|
|
|
|
case ":${PATH}:" in
|
|
*":${dir}:"*) ;;
|
|
*) echo "$dir is not on your PATH — add it, or run $dir/duckctl" ;;
|
|
esac
|