feat: steamify.sh --defaults --list: what --defaults can set up here, as JSON, for an installer page

This commit is contained in:
theupriser committed 2026-09-28 11:40:10 +02:00
1 parent c378b0ad63
commit 21a3251af5
2 files changed
+35 -1

No files matched your search

+25
View File
@@ -236,6 +236,31 @@ defaults_options() {
return 0 return 0
} }
defaults_list() {
# --defaults --list: what --defaults can set up on this PC, as one JSON
# array, for an installer page (the Steam Machine ISO builds its Steamify
# page from it, so new items show up without a new ISO). Per item: id,
# label, hint, kind (toggle, or choice for boot: on = desktop), parent,
# on (preselected like a first run) and selectable. Actions, retired
# items and items this PC can't use (e.g. no Steam account yet) are
# left out. Read-only: no sudo, no state.
local c kind on sel items=""
for c in "${COMPONENTS[@]}"; do
component_available "$c" || continue
is_action "$c" && continue
[[ "$c" == kpin || "$c" == hdmi ]] && continue
kind=toggle; [[ "$c" == boot ]] && kind=choice
sel=false; component_selectable "$c" && sel=true
on=false
[[ "$sel" == true && " ${NO_PRESELECT[*]} " != *" $c "* ]] && on=true
[[ "$c" == cec ]] && machine_available && on=true
items+="${items:+,}{\"id\":$(json_str "$c"),\"label\":$(json_str "${LABEL[$c]%%:*}")"
items+=",\"hint\":$(json_str "$( [[ "${LABEL[$c]}" == *:* ]] && echo "${LABEL[$c]#*: }")")"
items+=",\"kind\":\"$kind\",\"parent\":$(json_str "${PARENT[$c]:-}"),\"on\":$on,\"selectable\":$sel}"
done
printf '[%s]\n' "$items"
}
toggle_component() { toggle_component() {
local c="$1" local c="$1"
component_selectable "$c" || return 1 component_selectable "$c" || return 1
+10 -1
View File
@@ -33,12 +33,16 @@ BACKEND=false
# prompt (the Steam Machine ISO's first login runs this; sudo must not ask). # prompt (the Steam Machine ISO's first login runs this; sudo must not ask).
DEFAULTS=false DEFAULTS=false
[[ "${1:-}" == --defaults ]] && DEFAULTS=true [[ "${1:-}" == --defaults ]] && DEFAULTS=true
# --defaults --list: what --defaults can set up here, as JSON (an installer
# page is built from it); nothing else on stdout.
LIST=false
[[ "$DEFAULTS" == true && "${2:-}" == --list ]] && LIST=true
# --boot gamescope|desktop: only change where an installed conversion # --boot gamescope|desktop: only change where an installed conversion
# starts, everything else stays as it is (for scripts; no menu). # starts, everything else stays as it is (for scripts; no menu).
BOOT_ONLY=false BOOT_ONLY=false
[[ "${1:-}" == --boot ]] && BOOT_ONLY=true [[ "${1:-}" == --boot ]] && BOOT_ONLY=true
if [[ "$BACKEND" == false ]]; then if [[ "$BACKEND" == false && "$LIST" == false ]]; then
echo -e "${c_bold}Steamify CachyOS${c_reset} v$VERSION" echo -e "${c_bold}Steamify CachyOS${c_reset} v$VERSION"
echo "Turn the SteamOS-style parts on or off. The menu shows what is on now;" echo "Turn the SteamOS-style parts on or off. The menu shows what is on now;"
echo "anything you turn off is put back the way it was." echo "anything you turn off is put back the way it was."
@@ -128,6 +132,11 @@ if [[ "${1:-}" == --first-login ]]; then
exit 0 exit 0
fi fi
if [[ "$LIST" == true ]]; then
defaults_list
exit 0
fi
if [[ "$DEFAULTS" == true ]]; then if [[ "$DEFAULTS" == true ]]; then
RESTART_FOR_LOGIN=false RESTART_FOR_LOGIN=false
REAPPLY=false REAPPLY=false