Skip to content

feat(iso): terminal UX, download/write progress, GPG verification, install PATH - #3

Merged
bartrosa merged 10 commits into
mainfrom
feat/terminal-output
Jul 15, 2026
Merged

bartrosa merged 10 commits into
mainfrom
feat/terminal-output

Conversation

@bartrosa

Copy link
Copy Markdown
Owner

Summary

Improves the ISO provisioning workflow (downloaddiskswrite) with readable terminal output, real progress reporting, correct GPG verification, and a much simpler USB burn UX. Also auto-configures PATH in install.sh.

Target release: v0.1.1 (post–v0.1.0 polish).

Changes

Terminal output (internal/ui)

  • Theme-adaptive colors via lipgloss.AdaptiveColor (light/dark terminals)
  • Bold + underlined table headers for lab iso list, lab iso disks, lab iso images
  • Structured lab version output (KeyValue layout)
  • Unified warnings: yellow ! prefix via ui.Warn / ui.WarnLine (no emoji)
  • High-visibility ui.SecurityWarning banner on GPG verification failure
  • --no-color falls back to plain bold text

lab iso download

  • Progress bar with speed and ETA (internal/ui/download.go)
  • Spinner while connecting to the mirror (before first bytes)
  • Spinner during SHA256 and GPG verification
  • Human-readable sizes (MiB/GiB) instead of raw bytes
  • GPG fix: import upstream signing keys before verify
    • Ubuntu: detached SHA256SUMS.gpg + keys from keyserver.ubuntu.com
    • Fedora Silverblue: clearsigned CHECKSUM + fedoraproject.org/fedora.gpg
  • Locale-aware GPG result parsing (--status-file, PL/EN messages)
  • Security banner when GPG fails; command exits with error (ISO not marked verified)

lab iso disks

  • Fix: empty device list caused by missing TYPE in lsblk -J output
  • Use lsblk -d -J -o …,TYPE,VENDOR
  • Handle null JSON fields for model / tran
  • Warning when no block devices are found

lab iso write

  • New: lab iso write — interactive ISO + USB picker
  • New: lab iso write <distro> — resolve cached image by distro id (e.g. ubuntu-desktop, fedora-silverblue)
  • New: lab iso images — list cached ISOs
  • New: --usb — auto-select the only USB drive
  • New: --device as alias for --to; accept sda or /dev/sda
  • Fix: lsblk requires /dev/sda, not bare sda
  • Fix: parse locale sizes (58,6G) for capacity checks
  • Auto-unmount mounted partitions (mount path + /dev/partition) before burn
  • Auto sudo for dd and sync
  • USB burn progress bar:
    • Polls /sys/block/*/stat every 250ms (smooth updates)
    • Parses dd status=progress on stderr (\r, PL/EN) as fallback
    • Clears terminal line (\033[2K\r) to avoid duplicate/garbled output

Install script

  • install.sh: append idempotent # homelab-cli: PATH block to ~/.bashrc / ~/.zshrc / ~/.profile
  • --no-path to opt out
  • uninstall.sh: remove PATH block on uninstall

New / updated commands

lab iso images
lab iso write                          # interactive
lab iso write ubuntu-desktop --usb
lab iso write fedora-silverblue --to sda
lab iso write ubuntu-desktop --device /dev/sda

Files touched (high level)

Area Key files
UI internal/ui/ui.go, internal/ui/download.go
ISO core internal/iso/download.go, verify.go, cache.go, dd_linux.go, block_linux.go, write.go, disks_linux.go, lsblk.go
CLI internal/cli/commands/iso.go, iso_prompt.go, version.go
Install scripts/install.sh, scripts/uninstall.sh
Docs CHANGELOG.md, README.md

~31 files, +1800 / −254 lines vs main.

Commits on branch

fix: auto-configure PATH in install.sh
feat: add interactive prompt functions for ISO selection and input handling
feat: implement ISO management functions for Linux
feat: add download progress reporting and formatting utilities
feat: enhance ISO management and terminal output features

Test plan

  • make ci / go test ./... passes
  • lab version — formatted key/value output
  • lab iso list — table with headers, dimmed planned entries
  • lab iso download ubuntu-desktop — spinner, progress bar, speed, ETA, GPG OK
  • lab iso download fedora-silverblue — GPG clearsigned CHECKSUM verifies
  • GPG failure shows yellow security banner and non-zero exit
  • lab iso disks — lists USB + SYSTEM disks (not empty)
  • lab iso images — shows cached ISOs
  • lab iso write — interactive picker works
  • lab iso write ubuntu-desktop --usb — sudo prompt, smooth progress bar, successful burn
  • lab iso write … --to sda — works with short device name
  • Polish locale: sizes 58,6G, dd messages skopiowane … bajtów
  • curl … \| sh install adds PATH to shell rc; lab works in new shell
  • --no-color — no ANSI colors, readable plain output

Breaking changes

None for existing flags. Additive UX:

  • lab iso write no longer requires a full ISO path (distro name or interactive mode)
  • --device added as alias for --to

bartrosa and others added 10 commits July 15, 2026 10:07
Append install bin directory to shell rc when not already on PATH.
Add --no-path opt-out; uninstall removes the marked PATH block.
Update README and CHANGELOG.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ndling

Introduced new functions in iso_prompt.go to facilitate interactive user prompts for selecting ISO images and entering text inputs. Enhanced the iso.go file with a new command for listing cached ISO images and improved the ISO writing command to support interactive selection of images and devices. Updated command descriptions for clarity and usability.
Added new functionalities for managing ISO files on Linux, including block device path handling, writing ISO images to USB drives with progress reporting, and verifying downloads with GPG signatures. Introduced tests for these features to ensure reliability. Enhanced existing functions for listing cached images and resolving ISO references, improving overall usability and functionality of the ISO management system.
Introduced a new DownloadReporter for rendering HTTP download progress, including a progress bar, speed, and estimated time of arrival (ETA). Implemented utility functions for formatting byte sizes and ETA durations. Added comprehensive unit tests to ensure functionality and reliability of the new features.
Improved terminal output with theme-adaptive colors and structured layouts. Enhanced `lab iso download` with a progress bar, speed, ETA, and GPG key import for verification. Fixed issues in `lab iso disks` and added interactive features to `lab iso write`, including device selection and progress reporting. Updated CHANGELOG to reflect these changes.
Eliminated the promptLine function, which was previously responsible for handling user input prompts. This cleanup improves code maintainability by removing redundant code that is no longer utilized.
Implemented a check in the blockWriteBytes function to prevent sector count overflow, enhancing error handling for device writes. Removed unused collectPartNames function from lsblk.go to improve code clarity. Updated unitKey assignment in ParseSizeBytes for better readability. Reformatted the resolveUbuntuDesktop function for consistent styling.
Updated the NewStyles function to use an underscore for the unused writer parameter, enhancing clarity. Minor formatting adjustments made in download.go for consistency.
Introduced a new NoColor field in the WriteOptions struct to allow users to disable colored output during ISO writing operations, enhancing customization and usability.
Added new linters G122 and G703 to the golangci-lint configuration. Updated golangci-lint version to v2.12.2 in Makefile and CI workflows, along with upgrading actions/checkout and actions/setup-go to their latest versions for improved compatibility and performance.
@bartrosa
bartrosa merged commit 9cc2238 into main Jul 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant