diff --git a/.github/workflows/install-test.yml b/.github/workflows/install-test.yml index 534b84789..8749e1bdd 100644 --- a/.github/workflows/install-test.yml +++ b/.github/workflows/install-test.yml @@ -20,21 +20,21 @@ on: # By hand, the ISO can be built from another package channel: rc builds a # release candidate the way omarchy-release does (omarchy-iso-make --rc), to # test a fresh install of it, on both architectures, and stable the release - # the same way. A pull request builds x86_64 from stable and aarch64 from - # edge. + # the same way. A pull request or a merge builds both from edge: this branch + # is built against omarchy's quattro, which the edge packages track. workflow_dispatch: inputs: channel: - description: "Package channel the ISO is built from (a pull request: stable on x86_64, edge on aarch64)" + description: "Package channel the ISO is built from (a pull request or merge: edge)" type: choice options: [stable, rc, edge] - default: stable + default: edge permissions: contents: read concurrency: - group: install-test-${{ github.event.pull_request.number || github.ref }}-${{ inputs.channel || 'stable' }} + group: install-test-${{ github.event.pull_request.number || github.ref }}-${{ inputs.channel || 'edge' }} cancel-in-progress: true jobs: @@ -110,13 +110,14 @@ jobs: - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 if: env.ARCH == 'x86_64' - # A pull request's aarch64 ISO installs what the edge channel serves, as - # the nightly does, on linux-omarchy: the one kernel for every aarch64 - # board. A run by hand builds both from the channel it names. Every - # package comes from the package repositories, none is built here. + # A pull request's or merge's ISO installs what the edge channel serves, + # built from omarchy's quattro, as the nightly does; on aarch64 that runs + # linux-omarchy, the one kernel for every aarch64 board. A run by hand + # builds both from the channel it names. Every package comes from the + # package repositories, none is built here. - name: Build the ISO env: - CHANNEL: ${{ inputs.channel || (env.ARCH == 'aarch64' && 'edge' || 'stable') }} + CHANNEL: ${{ inputs.channel || 'edge' }} run: | start=$(date +%s) case $CHANNEL in @@ -388,7 +389,7 @@ jobs: { echo "## Install test: x86_64, ${{ matrix.variant }}" echo - echo "Channel: \`${{ inputs.channel || 'stable' }}\`" + echo "Channel: \`${{ inputs.channel || 'edge' }}\`" echo if [ -f "$base/omarchy-install-timing.json" ]; then jq -r '"**Install:** \((.finished_at - .started_at) * 10 | round / 10) s across \(.phases | length) phases"' "$base/omarchy-install-timing.json" diff --git a/builder/build-iso.sh b/builder/build-iso.sh index 4af611fde..5c6cadc4f 100755 --- a/builder/build-iso.sh +++ b/builder/build-iso.sh @@ -385,6 +385,7 @@ sed -i -E '/^(linux|broadcom-wl)$/d' "$live_packages_file" if [[ -d /omarchy-source ]]; then base_pkg_lists=(/omarchy-source/install/omarchy-base.packages /omarchy-source/install/omarchy-other.packages) setup_form=/omarchy-source/install/provisioning/setup-form.sh + progress_icon=/omarchy-source/install/provisioning/progress-icon.sh mise_work=/omarchy-source/install/user/mise-work.sh else # Pull the same package lists out of the freshly-downloaded Omarchy runtime @@ -407,6 +408,8 @@ else # actionable error below. bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists usr/share/omarchy/install/provisioning/setup-form.sh 2>/dev/null || true setup_form=/tmp/omarchy-pkglists/usr/share/omarchy/install/provisioning/setup-form.sh + bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists usr/share/omarchy/install/provisioning/progress-icon.sh 2>/dev/null || true + progress_icon=/tmp/omarchy-pkglists/usr/share/omarchy/install/provisioning/progress-icon.sh bsdtar -xf "$omarchy_pkg" -C /tmp/omarchy-pkglists usr/share/omarchy/install/user/mise-work.sh 2>/dev/null || true mise_work=/tmp/omarchy-pkglists/usr/share/omarchy/install/user/mise-work.sh # The aarch64 list, each platform's own and the x86_64-only one. Runtimes @@ -532,6 +535,25 @@ if [[ ! -f $setup_form ]]; then fi cp "$setup_form" "$build_cache_dir/airootfs/usr/share/omarchy-iso/setup-form.sh" +# The install progress screen comes from the same runtime, so the install and +# the first-boot setup that finishes a deferred install draw the same screen. A +# runtime predating the split ships no such file, which would leave the install +# dashboard with nothing to draw. +if [[ ! -f $progress_icon ]]; then + if [[ -d /omarchy-source ]]; then + echo "ERROR: the --local-source checkout ships no install/provisioning/progress-icon.sh" >&2 + remedy="Update the checkout to a revision carrying the shared progress screen." + else + echo "ERROR: $OMARCHY_RUNTIME_PACKAGE does not ship install/provisioning/progress-icon.sh" >&2 + remedy="Publish a runtime carrying the shared progress screen, or build with --local-source against a checkout that has it." + fi + echo " The install dashboard draws its progress with that file, so this ISO" >&2 + echo " would boot into an installer that cannot show the install." >&2 + echo " $remedy" >&2 + exit 1 +fi +cp "$progress_icon" "$build_cache_dir/airootfs/usr/share/omarchy-iso/progress-icon.sh" + # Omarchy installs Node lazily through mise since omacom/omarchy#15876. A # runtime from before it unpacks a bundled Node tarball during setup and stops # the install without one, so it still gets the build for its architecture. diff --git a/configs/airootfs/usr/local/bin/omarchy-install-dashboard b/configs/airootfs/usr/local/bin/omarchy-install-dashboard index 1009ffa1c..7cc1fea59 100755 --- a/configs/airootfs/usr/local/bin/omarchy-install-dashboard +++ b/configs/airootfs/usr/local/bin/omarchy-install-dashboard @@ -32,6 +32,19 @@ source "$INSTALLER_I18N" i18n_load "${OMARCHY_ISO_LANGUAGE:-en}" i18n_console_font "$TTY_PATH" +# The traced-icon progress screen is vendored from the runtime package this ISO +# bundles, as setup-form.sh is, because first-boot setup (omarchy-provision-owner) +# draws the same screen and the two must never drift apart. On the ISO that +# vendored copy is what loads; a dry run outside the ISO falls back to the +# omarchy checkout OMARCHY_PATH points at. +PROGRESS_ICON="${PROGRESS_ICON:-/usr/share/omarchy-iso/progress-icon.sh}" +[[ -r $PROGRESS_ICON ]] || PROGRESS_ICON="${OMARCHY_PATH:-/usr/share/omarchy}/install/provisioning/progress-icon.sh" +if [[ ! -r $PROGRESS_ICON ]]; then + echo "ERROR: shared progress screen not found at $PROGRESS_ICON" >&2 + exit 1 +fi +source "$PROGRESS_ICON" + # Autoinstall has no one at the keyboard, and every prompt this dashboard owns # reads from the TTY, so each would hang forever. Suppress them here rather than # in the scripts they live in: this process is the only owner of the visible UI. @@ -121,60 +134,6 @@ trap 'interrupt 143' TERM term_size() { stty size 2>/dev/null <"$TTY_PATH" || printf '24 80\n'; } term_cols() { local size; size="$(term_size)"; printf '%s\n' "${size#* }"; } -# Read the actual character dimensions instead of assuming an 8 x 16 font. -# Linux VTs expose the font through KDFONTOP; desktop terminals may expose -# pixels in their window size or answer the standard cell-size query. -term_cell_size() { - python3 - "$TTY_PATH" <<'PY' -import fcntl -import os -import re -import select -import struct -import sys -import termios -import time -import tty - -with open(sys.argv[1], "r+b", buffering=0) as terminal: - fd = terminal.fileno() - rows, cols, width, height = struct.unpack( - "HHHH", fcntl.ioctl(fd, termios.TIOCGWINSZ, bytes(8))) - if rows and cols and width and height: - print(round(width / cols), round(height / rows)) - sys.exit() - try: - font = bytearray(struct.pack("@5IP", 1, 0, 0, 0, 0, 0)) - fcntl.ioctl(fd, 0x4B72, font) # KDFONTOP / KD_FONT_OP_GET, no glyph data - _, _, width, height, _ = struct.unpack_from("@5I", font) - if width and height: - print(width, height) - sys.exit() - except OSError: - pass - - settings = termios.tcgetattr(fd) - try: - tty.setcbreak(fd, termios.TCSANOW) - os.write(fd, b"\x1b[16t") - response = b"" - deadline = time.monotonic() + 0.15 - while select.select([fd], [], [], max(0, deadline - time.monotonic()))[0]: - response += os.read(fd, 64) - match = re.search(rb"\x1b\[6;(\d+);(\d+)t", response) - if match: - height, width = map(int, match.groups()) - if width and height: - print(width, height) - sys.exit() - if time.monotonic() >= deadline: - break - finally: - termios.tcsetattr(fd, termios.TCSANOW, settings) - print(8, 16) # Conventional console font when dimensions aren't available. -PY -} - logo_width() { if [[ -f $LOGO_PATH ]]; then # The logo is drawn in box-drawing glyphs, three bytes each in UTF-8, so @@ -205,8 +164,6 @@ LOGO_HEIGHT="$(logo_height)" (( LOGO_WIDTH > 0 )) || LOGO_WIDTH=81 (( LOGO_HEIGHT > 0 )) || LOGO_HEIGHT=1 CONTENT_WIDTH="$LOGO_WIDTH" -TOP_ROW=1 -LAST_SIZE="" LAST_PM=10 # Wordmark, blank, title, and the three rows gum confirm uses (upstream's +5), # plus two rows between title and button: a blank and the medium-removal note @@ -328,163 +285,6 @@ render_logo() { fi } -# The icon uses half-block glyphs, scaled to the terminal's actual cell aspect -# ratio so its square silhouette stays square. No graphics protocol is needed. -# Coordinates follow the 15 x 15 grid of Omarchy's icon.svg. Each segment -# paints the full stroke width, starting at the bottom middle of the outer ring. -ICON_WIDTH=30 -ICON_HEIGHT=15 -CELL_WIDTH=8 -CELL_HEIGHT=16 -ICON_LEFT=1 -ICON_STEPS=0 -ICON_DRAWN=0 -DISPLAY_PM=0 -ICON_FRAME="" -declare -a ICON_ORDER=() ICON_TRACE=() ICON_FILL=() - -icon_segment() { - local scale="$1" x1="$2" y1="$3" x2="$4" y2="$5" - local x y from to - if (( y1 == y2 )); then - from=$(( (x1 * ICON_WIDTH + 14) / 15 )) - to=$(( ((x2 + 1) * ICON_WIDTH + 14) / 15 )) - if (( x2 < x1 )); then - from=$(( ((x1 + 1) * ICON_WIDTH + 14) / 15 - 1 )) - to=$(( (x2 * ICON_WIDTH + 14) / 15 - 1 )) - fi - for ((x=from; x!=to; x+=(x2 >= x1 ? 1 : -1))); do - for ((y=y1 * scale; y<(y1 + 1) * scale; y++)); do - icon_pixel "$((y * ICON_WIDTH + x))" - done - done - else - from=$(( y1 * scale )) - to=$(( (y2 + 1) * scale )) - if (( y2 < y1 )); then - from=$(( (y1 + 1) * scale - 1 )) - to=$(( y2 * scale - 1 )) - fi - for ((y=from; y!=to; y+=(y2 >= y1 ? 1 : -1))); do - for ((x=(x1 * ICON_WIDTH + 14) / 15; x<((x1 + 1) * ICON_WIDTH + 14) / 15; x++)); do - icon_pixel "$((y * ICON_WIDTH + x))" - done - done - fi -} - -icon_pixel() { - local pixel="$1" - if [[ ! -v ICON_TRACE[pixel] ]]; then - ICON_ORDER+=("$pixel") - ICON_TRACE[pixel]=${#ICON_ORDER[@]} - fi -} - -build_icon() { - local scale="$1" x y row - local -a mask=( - 111111111111111 - 100000010000001 - 101111110001101 - 101000000000101 - 101000000000101 - 101000000000101 - 101000000000101 - 111000000000101 - 101000000000101 - 101000000000101 - 101000000000101 - 101000000000101 - 101111111111101 - 100000010000001 - 111111110111111 - ) - ICON_WIDTH=$(( (15 * scale * CELL_HEIGHT + CELL_WIDTH) / (2 * CELL_WIDTH) )) - ICON_HEIGHT=$(((15 * scale + 1) / 2)) - ICON_ORDER=() ICON_TRACE=() ICON_FILL=() - ICON_DRAWN=0 - # Start at the bottom middle, follow the outer left edge to the top cross, - # then descend into the inner shape. Fill its two bridges as we reach them. - icon_segment "$scale" 7 14 0 14 - icon_segment "$scale" 0 14 0 0 - icon_segment "$scale" 0 0 7 0 - icon_segment "$scale" 7 0 7 2 - icon_segment "$scale" 7 2 2 2 - icon_segment "$scale" 2 2 2 7 - icon_segment "$scale" 2 7 0 7 - icon_segment "$scale" 2 7 2 12 - icon_segment "$scale" 2 12 7 12 - icon_segment "$scale" 7 12 7 14 - icon_segment "$scale" 7 12 12 12 - icon_segment "$scale" 12 12 12 2 - icon_segment "$scale" 12 2 11 2 - # Finish from the top cross: right along the outside, down, then left. - icon_segment "$scale" 7 0 14 0 - icon_segment "$scale" 14 0 14 14 - icon_segment "$scale" 14 14 9 14 - ICON_STEPS=${#ICON_ORDER[@]} - for ((y=0; y<15 * scale; y++)); do - row=${mask[y / scale]} - for ((x=0; x 0 )) && upper=90 - (( step > 0 && step <= drawn )) && upper=32 - step=${ICON_TRACE[pixel + ICON_WIDTH]:-0} - (( step > 0 )) && lower=90 - (( step > 0 && step <= drawn )) && lower=32 - fi - if (( upper == 0 && lower == 0 )); then - ICON_FRAME+="${RESET} " - elif (( upper == lower )); then - ICON_FRAME+="${CSI}${upper};49m█" - elif (( lower == 0 )); then - ICON_FRAME+="${CSI}${upper};49m▀" - elif (( upper == 0 )); then - ICON_FRAME+="${CSI}${lower};49m▄" - else - ICON_FRAME+="${CSI}${upper};$((lower + 10))m▀" - fi -} - -render_icon() { - local pm="$1" full="${2:-0}" drawn i pixel row col - drawn=$((pm * ICON_STEPS / 1000)) - ICON_FRAME="" - if (( full || pm == 1000 )); then - for ((row=0; row/dev/null || printf '8 16\n') - (( rows >= 34 && cols >= 49 )) && scale=2 - (( rows >= 50 && cols >= 64 )) && scale=3 - while (( scale > 1 && (15 * scale * CELL_HEIGHT + CELL_WIDTH) / (2 * CELL_WIDTH) > cols - 4 )); do - scale=$((scale - 1)) - done - build_icon "$scale" - TOP_ROW="$(centered_top_row "$((ICON_HEIGHT + 5))")" - ICON_LEFT=$(( (cols - ICON_WIDTH) / 2 + 1 )) - (( ICON_LEFT < 1 )) && ICON_LEFT=1 - PROGRESS_TEXT_WIDTH=$((cols - 2)) - (( PROGRESS_TEXT_WIDTH > CONTENT_WIDTH )) && PROGRESS_TEXT_WIDTH=$CONTENT_WIDTH - return 0 -} - render_static() { - measure_progress_layout - printf '%s' "$CLEAR" - render_icon "$DISPLAY_PM" 1 + progress_icon_layout "$TTY_PATH" "$CONTENT_WIDTH" + progress_icon_static } update_progress() { @@ -685,31 +465,15 @@ update_progress() { LAST_PM=$pm } +# The status row shows the verify's honest percent while the pre-flight gate +# waits on the hash, and stays blank otherwise. +progress_status() { + (( VERIFY_PCT >= 0 )) && printf 'verifying the install medium: %d%%' "$VERIFY_PCT" + return 0 +} + render_dynamic() { - local step tip - # The framebuffer can settle late in VMs. Rebuild at the new size, preserving - # progress, instead of leaving the drawing at the old screen coordinates. - [[ "$(term_size)" == "$LAST_SIZE" ]] || render_static - # Ease phase jumps over several frames, with the percentage following the - # same position as the trace. The measured progress still never goes back. - step=$(( (LAST_PM - DISPLAY_PM + 3) / 4 )) - DISPLAY_PM=$((DISPLAY_PM + step)) - render_icon "$DISPLAY_PM" - - tip="$(truncate_for_width "$(t progress.tipLine "$(current_tip)")" "$PROGRESS_TEXT_WIDTH")" - printf '%s%d;1H' "$CSI" "$((TOP_ROW + ICON_HEIGHT + 1))" - center "${GREEN}$((DISPLAY_PM / 10))%${RESET}" "$PROGRESS_TEXT_WIDTH" - blank_line - # Same row either way, so the layout (icon + 6 rows) never changes height: - # blank normally, the verify's honest percent while the pre-flight gate - # waits on the hash. - if (( VERIFY_PCT >= 0 )); then - center "${DIM}verifying the install medium: ${VERIFY_PCT}%${RESET}" "$PROGRESS_TEXT_WIDTH" - else - blank_line - fi - center "${DIM}${tip}${RESET}" "$PROGRESS_TEXT_WIDTH" - printf '%s' "$CLEAR_TO_END" + progress_icon_frame "$LAST_PM" "$(progress_status)" "$(t progress.tipLine "$(current_tip)")" } install_duration() { @@ -1175,12 +939,7 @@ if (( status == 0 )); then # Finish the trace even when a short-lived child exits between state polls. LAST_PM=1000 PHASE_NAME="Installation complete" - while (( DISPLAY_PM < 999 )); do - render_dynamic >"$TTY_PATH" 2>/dev/null || true - sleep 0.05 - done - DISPLAY_PM=1000 - render_dynamic >"$TTY_PATH" 2>/dev/null || true + progress_icon_finish "" "$(t progress.tipLine "$(current_tip)")" >"$TTY_PATH" 2>/dev/null || true sleep 0.4 fi diff --git a/test/unit/dashboard-release-gate-test.sh b/test/unit/dashboard-release-gate-test.sh index 0b3805388..ede6acf35 100755 --- a/test/unit/dashboard-release-gate-test.sh +++ b/test/unit/dashboard-release-gate-test.sh @@ -111,6 +111,7 @@ scenario() { # function-to-call, release_rc -> sets TTY_OUT, LOG_OUT, CALLS # The definitions run from $BOX, so the catalog is not next to them. INSTALLER_I18N="$ROOT/configs/airootfs/usr/share/omarchy-iso/i18n.sh" \ OMARCHY_DASHBOARD_TTY="$BOX/tty.fifo" OMARCHY_PATH="$BOX/omarchy" \ + PROGRESS_ICON="$ROOT/test/unit/fixtures/progress-icon.sh" \ source "$BOX/dashboard-defs.sh" "$BOX/install.log" "$BOX/state.json" -- true release_target echo "$TARGET_RELEASED" >"$BOX/released" diff --git a/test/unit/fixtures/progress-icon.sh b/test/unit/fixtures/progress-icon.sh new file mode 100644 index 000000000..9b6c54504 --- /dev/null +++ b/test/unit/fixtures/progress-icon.sh @@ -0,0 +1,8 @@ +# Stands in for Omarchy's install/provisioning/progress-icon.sh, which +# build-iso.sh vendors into the ISO from the runtime package, so dashboard tests +# run without an Omarchy runtime. They cover the dashboard around the progress +# screen; the screen itself is tested where it lives, in the omarchy repo. +progress_icon_layout() { :; } +progress_icon_static() { :; } +progress_icon_frame() { :; } +progress_icon_finish() { :; } diff --git a/test/unit/install-media-diagnosis-test.sh b/test/unit/install-media-diagnosis-test.sh index 639f2c104..0358424fe 100755 --- a/test/unit/install-media-diagnosis-test.sh +++ b/test/unit/install-media-diagnosis-test.sh @@ -284,7 +284,7 @@ run_dashboard() { "error": "Pacstrap failed. See /var/log/archinstall.log"}]} STATE : >"$screen" - script -qefc "stty rows 40 cols 120; PATH='$stubs:$PATH' OMARCHY_PATH='$omarchy_share' OMARCHY_UI_INTERACTIVE=no OMARCHY_UI_FAILURE_ACTION=exit OMARCHY_FAILURE_TAIL_LOG='$install_log' '$DASHBOARD' '$install_log' '$state_file' -- bash -c 'exit 1'" \ + script -qefc "stty rows 40 cols 120; PATH='$stubs:$PATH' OMARCHY_PATH='$omarchy_share' PROGRESS_ICON='$ROOT/test/unit/fixtures/progress-icon.sh' OMARCHY_UI_INTERACTIVE=no OMARCHY_UI_FAILURE_ACTION=exit OMARCHY_FAILURE_TAIL_LOG='$install_log' '$DASHBOARD' '$install_log' '$state_file' -- bash -c 'exit 1'" \ "$screen" >/dev/null 2>&1 } diff --git a/test/unit/install-test-report-test.sh b/test/unit/install-test-report-test.sh index b86d917b9..e31827c96 100755 --- a/test/unit/install-test-report-test.sh +++ b/test/unit/install-test-report-test.sh @@ -23,7 +23,7 @@ step_script() { if ($0 !~ /^ *$/) { match($0, /^ */); if (RLENGTH <= indent) exit } print } - ' "$WORKFLOW" | sed -e 's/\${{ matrix\.variant }}/$VARIANT/g' -e "s/\${{ inputs\.channel || 'stable' }}/stable/g" + ' "$WORKFLOW" | sed -e 's/\${{ matrix\.variant }}/$VARIANT/g' -e "s/\${{ inputs\.channel || 'edge' }}/edge/g" } script=$(step_script)