deploy.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env bash
  2. set -u
  3. usage() {
  4. printf 'Usage: %s install|uninstall|reload|reset all|namlv2|lsp|dragonfly-reverb|pipewire|mod-host-ports|mod-host|mod-ui|reconcile|midi-bridge|sooperlooper|slweb [--force-reference (install mod-ui only)]\n' "$0" >&2
  5. exit 2
  6. }
  7. force_args=()
  8. if [[ $# -eq 3 && "$3" == "--force-reference" && "$1" == "install" && "$2" == "mod-ui" ]]; then
  9. force_args=(--force-reference)
  10. elif [[ $# -ne 2 ]]; then
  11. usage
  12. fi
  13. action=$1
  14. target=$2
  15. case "$action" in
  16. install|uninstall|reload|reset) ;;
  17. *) usage ;;
  18. esac
  19. case "$target" in
  20. all) targets=(pipewire namlv2 lsp dragonfly-reverb) ;;
  21. namlv2|lsp|dragonfly-reverb|pipewire|mod-host-ports|mod-host|mod-ui|reconcile|midi-bridge|sooperlooper|slweb) targets=("$target") ;;
  22. *) usage ;;
  23. esac
  24. if [[ "$action" == reset && "$target" != mod-ui ]]; then
  25. usage
  26. fi
  27. script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
  28. status=0
  29. for component in "${targets[@]}"; do
  30. printf '%s\n' "== $action $component =="
  31. if ! python3 "$script_dir/deploy.py" "$action" "$component" "${force_args[@]}"; then
  32. status=1
  33. fi
  34. done
  35. exit "$status"