gate env.lat summary steps on ENVLAT env var

Only add the 2 bootstrap steps (prerequisites, chezmoi install) to
the summary block when running via env.lat. Direct chezmoi apply
keeps original step counts and starts from step 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Anton Volnuhin 2026-03-03 23:08:36 +03:00
parent 4f49ec9f80
commit 7509fa4440

View File

@ -20,20 +20,24 @@
# Signal env.lat to stop padding and let us handle our own formatting
echo "##ENVLAT_END##"
#Config step counts include 2 env.lat bootstrap steps
#Config
{{ if eq .chezmoi.os "darwin" -}}
STEPS=11
STEPS=9
{{ else if eq .chezmoi.os "freebsd" -}}
STEPS=11
STEPS=9
{{ else if eq .chezmoi.os "openbsd" -}}
STEPS=10
STEPS=8
{{ else if eq .chezmoi.osRelease.id "ubuntu" -}}
STEPS=16
{{ else if eq .chezmoi.osRelease.id "debian" -}}
STEPS=15
{{ else -}}
STEPS=14
{{ else if eq .chezmoi.osRelease.id "debian" -}}
STEPS=13
{{ else -}}
STEPS=12
{{ end -}}
# Add env.lat bootstrap steps if running from env.lat
if [ -n "$ENVLAT" ]; then
STEPS=$(($STEPS + 2))
fi
PAD_LEN=4
BASE_PACKAGES="gnupg curl wget git"
@ -98,7 +102,11 @@ cd
#Setup
USER=$(whoami)
if [ -n "$ENVLAT" ]; then
STEP=3 # env.lat already completed steps 1-2
else
STEP=1
fi
if [ "$NON_INTERACTIVE" -eq 1 ]; then
# Simple output for non-interactive mode (Vagrant, CI, etc.)
@ -178,6 +186,7 @@ if [ "$NON_INTERACTIVE" -eq 0 ]; then
LINES=$(tput lines)
print_block
# Pre-fill env.lat bootstrap steps as already completed
if [ -n "$ENVLAT" ]; then
tput csr 0 $LINES
tput cup $(($LINES - $STEPS - 2 + 1)) 0
echo -e "==> "$Green"Installing prerequisites"$NC
@ -185,6 +194,7 @@ if [ "$NON_INTERACTIVE" -eq 0 ]; then
echo -e "==> "$Green"Installing dotfiles via chezmoi"$NC
tput csr 0 $(($LINES - $STEPS - 3))
fi
fi
new_line "Update caches and upgrade packages"
{{ if eq .chezmoi.os "freebsd" -}}