#!/bin/bash # Known roles used by the update scripts. UPDATE_KNOWN_ROLES=( MUSIC LAB BT GAME VR DESKTOP_BASE DESKTOP_WORK CODE NVIDIA_GPU NVIDIA_1080_GPU TERMINAL HYPERLAND ) # Map hostnames to the roles they should enable. declare -A ROLES_BY_HOST=( [CMBOX]="DESKTOP_BASE DESKTOP_WORK CODE TERMINAL HYPERLAND MUSIC" [STEAMBOX]="GAME VR DESKTOP_BASE NVIDIA_GPU TERMINAL HYPERLAND" [LABBOX]="DESKTOP_BASE CODE TERMINAL HYPERLAND LAB BT" [SIMONBOX]="GAME VR DESKTOP_BASE NVIDIA_1080_GPU TERMINAL HYPERLAND BT" ) # Resolve the enabled roles for the provided host. Populates the global ROLES array. roles::load() { local host="$1" declare -gA ROLES for role in "${UPDATE_KNOWN_ROLES[@]}"; do ROLES["$role"]="no" done local enabled_roles="${ROLES_BY_HOST[$host]}" if [[ -n "$enabled_roles" ]]; then for role in $enabled_roles; do ROLES["$role"]="yes" done fi } # Helper to check if a role is enabled. roles::enabled() { local role="$1" [[ "${ROLES[$role]:-no}" == "yes" ]] } # Render a short summary of the enabled roles. roles::print_summary() { printf -- ' \033[37m' for role in "${!ROLES[@]}"; do if roles::enabled "$role"; then printf '%s, ' "$role" fi done printf -- '\n\n\033[37m' }