Add a * marker next to the checkbox for already-installed services

The [installed] text label (previous commit) confirmed working from a
screenshot, but the checkbox itself stays unchecked for installed items by
design — checking it means "install/reinstall this on <Ok>", so
pre-checking every already-installed service would risk a mass reinstall
from just hitting Ok without manually unchecking each one.

Add a second, more immediate cue right next to the checkbox instead:
prefix the item's own tag with "*" when installed (whiptail's checklist
tag is the first column, directly after the checkbox). The "*" is
display-only — stripped back off the selected values before they reach
run_service, so dispatch is unaffected.
This commit is contained in:
Claude
2026-08-10 16:03:19 +00:00
parent 753cc58016
commit c7f9e5caa1
+15 -3
View File
@@ -402,6 +402,7 @@ while true; do
svc_items=()
for name in "${SVCS[@]}"; do
tag="${SERVICE_DESC[$name]}"
svc_tag="$name"
# Marker goes at the FRONT, not appended after the description.
# whiptail hard-truncates each row to the dialog's fixed width
# (78 here) with no ellipsis or other sign it happened —
@@ -412,13 +413,24 @@ while true; do
# anything was cut. A long description can still lose its own
# tail this way, but that's harmless — the install status is
# what actually matters and now always survives.
is_installed "$name" && tag="[installed] $tag"
svc_items+=("$name" "$tag" "OFF")
# Also prefix the name itself with "*" — the checkbox's own
# [ ]/[*] state is reserved for "install this now", so an
# already-installed item stays unchecked by design (checking it
# would reinstall on <Ok>); this "*" sits right next to the
# checkbox as a second, harder-to-miss cue distinct from that
# selection state. Stripped back off below before dispatch.
if is_installed "$name"; then
tag="[installed] $tag"
svc_tag="*$name"
fi
svc_items+=("$svc_tag" "$tag" "OFF")
done
CHOICE=$(whiptail --title "${CHOSEN_CAT^^}" --checklist \
"Space to select, Enter to install. Already-installed are marked:" "$_box_h" 78 "$_list_h" \
"Space to select, Enter to install. Already-installed are marked with *:" "$_box_h" 78 "$_list_h" \
"${svc_items[@]}" 3>&1 1>&2 2>&3 </dev/tty) || continue
eval "SELECTED=($CHOICE)"
# Undo the display-only "*" prefix before these reach run_service.
for i in "${!SELECTED[@]}"; do SELECTED[$i]="${SELECTED[$i]#\*}"; done
else
echo ""; echo "${CHOSEN_CAT^^}:"
for name in "${SVCS[@]}"; do