From 4981c603890a2a32664e91020e34109281addd17 Mon Sep 17 00:00:00 2001 From: maziggy Date: Thu, 5 Mar 2026 11:01:06 +0100 Subject: [PATCH] Add --branch support to install script with validation The install script hardcoded origin/main, so beta testers told to install from a dev branch silently got the stable release instead. Add a --branch CLI option and interactive prompt (defaults to main). Invalid branch names are validated via git ls-remote before any work is done, showing available branches on failure. --- CHANGELOG.md | 2 +- install/install.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1181631b8..2594fc2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes to Bambuddy will be documented in this file. - **AMS Info Card & Custom Labels** ([#570](https://github.com/maziggy/bambuddy/pull/570)) — Hovering an AMS label (e.g. "AMS-A") on the Printers page now shows a popover with serial number, firmware version, and an editable friendly name. Custom labels are stored by AMS serial number so they persist when the unit is moved to a different printer. Slot numbers are now displayed inside each filament color circle with auto-inverted contrast for readability. Labels also appear in the Inventory page's location column. Contributed by @cadtoolbox. ### Improved -- **Install Script: Branch Selection** — The native install script (`install.sh`) now supports a `--branch` option and an interactive branch prompt (defaults to `main`). Previously the script hardcoded `origin/main`, so beta testers told to install from a beta branch would silently get the stable release instead. Fresh installs use `git clone --branch`, existing installs checkout and reset to the selected branch. The install summary highlights non-main branches in yellow with a "(beta)" label. +- **Install Script: Branch Selection** — The native install script (`install.sh`) now supports a `--branch` option and an interactive branch prompt (defaults to `main`). Previously the script hardcoded `origin/main`, so beta testers told to install from a beta branch would silently get the stable release instead. Fresh installs use `git clone --branch`, existing installs checkout and reset to the selected branch. The install summary highlights non-main branches in yellow with a "(beta)" label. Invalid branch names are caught early with an error message listing available branches. - **Print Queue Scheduler Diagnostics** ([#616](https://github.com/maziggy/bambuddy/issues/616)) — Added diagnostic logging to the print queue scheduler to help diagnose why queued prints aren't starting. After each queue check, the scheduler now logs a skip summary (how many items were skipped due to manual_start, scheduled_time, etc.) and for each busy printer, logs the exact state preventing it from being considered idle (connected status, printer state, plate_cleared flag). Previously the scheduler only logged "found N pending items" with no visibility into why items were skipped. ### Fixed diff --git a/install/install.sh b/install/install.sh index fb9e879f6..fc578f730 100755 --- a/install/install.sh +++ b/install/install.sh @@ -335,6 +335,14 @@ create_user() { download_bambuddy() { log_info "Downloading BamBuddy..." + # Validate branch exists on remote before proceeding + if ! git ls-remote --exit-code --heads https://github.com/maziggy/bambuddy.git "$BRANCH" &>/dev/null; then + log_error "Branch '$BRANCH' not found in the BamBuddy repository." + log_info "Available branches:" + git ls-remote --heads https://github.com/maziggy/bambuddy.git | sed 's|.*refs/heads/| - |' + exit 1 + fi + if [[ -d "$INSTALL_PATH/.git" ]]; then log_info "Existing installation found, updating..." # Add safe.directory to avoid "dubious ownership" error when running as root