#!/usr/bin/env bash set -u usage() { printf 'Usage: %s install|uninstall|reload|reset all|namlv2|lsp|dragonfly-reverb|pipewire|mod-host-ports|mod-host|mod-ui|reconcile|midi-bridge|sooperlooper\n' "$0" >&2 exit 2 } [[ $# -eq 2 ]] || usage action=$1 target=$2 case "$action" in install|uninstall|reload|reset) ;; *) usage ;; esac case "$target" in all) targets=(pipewire namlv2 lsp dragonfly-reverb) ;; namlv2|lsp|dragonfly-reverb|pipewire|mod-host-ports|mod-host|mod-ui|reconcile|midi-bridge|sooperlooper) targets=("$target") ;; *) usage ;; esac if [[ "$action" == reset && "$target" != mod-ui ]]; then usage fi script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) status=0 for component in "${targets[@]}"; do printf '%s\n' "== $action $component ==" if ! python3 "$script_dir/deploy.py" "$action" "$component"; then status=1 fi done exit "$status"