diff --git a/README.md b/README.md index 215c4b7..37bf7e0 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ Self-hosted media automation, set up in minutes, not a weekend. - **Docker-native stack:** One Compose project, overlays for VPN vs direct access, optional services via `compose/custom.yaml` — no host package installs for the *arr suite. - **Guided install, multi-platform:** Interactive wizard (or express defaults) for Linux, WSL2, and Windows (PowerShell → WSL). Fail-fast VPN check before the rest of setup when VPN is enabled. -- **Auto-wired services:** Post-install configure connects Radarr, Sonarr, Prowlarr, qBittorrent, Seerr, Recyclarr, and Jellyfin (libraries, auth, root folders, download clients) instead of a manual weekend of clicking. +- **Auto-wired services:** Post-install wiring connects Radarr, Sonarr, Prowlarr, qBittorrent, Seerr, Recyclarr, and Jellyfin (libraries, auth, root folders, download clients) instead of a manual weekend of clicking. - **Quality profiles that ship ready:** Recyclarr syncs assemblrr-named HD and UHD (and TV) profiles from TRaSH Guides; setup only picks Seerr’s default. Both resolutions stay available for overrides. - **Request → library path:** Seerr in front of Radarr/Sonarr for a simple request UX, with hardlinks-friendly media layout for Jellyfin/Emby/Plex. - **VPN-first downloads:** Gluetun integration, download client traffic forced through the VPN context, `check-vpn` / start-time verification, and a vpn-watchdog for stalled routing. -- **Operator CLI:** `start` / `stop` / `restart` / `status` / `health` / `logs`, `configure` / `reconfigure`, `backup` / `restore`, `update-containers` / `update-cli`, and a careful `uninstall` that preserves media unless you opt in. +- **Operator CLI:** `start` / `stop` / `restart` / `status` / `health` / `logs`, `config` (show / edit / sync), `backup` / `restore`, `update-containers` / `update-cli`, and a careful `uninstall` that preserves media unless you opt in. - **Fail-safe backups:** CLI snapshots of configuration before risky updates so you can roll back without rebuilding from scratch. - **Secrets outside `.env`:** Service login and VPN credentials live under `secrets/`; runtime settings stay in `.assemblrr-config` and `.env`. - **Optional extras:** Lidarr, SABnzbd, Bazarr, Watchtower via custom compose — deployed, not auto-configured. @@ -66,9 +66,10 @@ After install, the CLI is on your `PATH` as `assemblrr`. Run `assemblrr /dev/null; then + log_error "Failed to clone ${APP_REPO_URL}. Check your internet connection and repository access." + fi + setup_script="$tmp_dir/assemblrr/bin/setup.sh" + fi + + bash "$setup_script" +} + +# Re-wire service APIs only (post-install automation) +config_sync() { + if [ -f "$INSTALL_DIR/config.sh" ]; then + bash "$INSTALL_DIR/config.sh" + elif [ -f "$INSTALL_DIR/configure.sh" ]; then + # Legacy install name + bash "$INSTALL_DIR/configure.sh" + else + log_error "config.sh not found in $INSTALL_DIR" + fi +} + +config_cmd() { + local sub=${1:-} + case "$sub" in + "") + show_config_help + ;; + show) + show_config + ;; + edit) + config_edit + ;; + sync) + config_sync + ;; + --help|-h|help) + show_config_help + ;; + *) + log_error "Unknown config subcommand: $sub\nRun '${APP_CLI_NAME} config' for usage" + ;; + esac +} + restore_app() { local backup_file="$1" @@ -594,27 +667,6 @@ update_cli() { [ -n "$tmp_dir" ] && rm -rf "$tmp_dir" } -reconfigure_app() { - echo "Re-running ${APP_DISPLAY_NAME} setup wizard..." - echo "Current configuration will be used as defaults." - echo - - # Find the setup script — could be in install dir or need to be cloned - local setup_script - if [ -f "$INSTALL_DIR/setup.sh" ]; then - setup_script="$INSTALL_DIR/setup.sh" - else - local tmp_dir - tmp_dir=$(mktemp -d) - if ! git clone --depth=1 "${APP_REPO_URL}" "$tmp_dir/assemblrr" 2>/dev/null; then - log_error "Failed to clone ${APP_REPO_URL}. Check your internet connection and repository access." - fi - setup_script="$tmp_dir/assemblrr/bin/setup.sh" - fi - - bash "$setup_script" -} - main() { local command=${1:-"--help"} local destination=${2:-.} @@ -661,9 +713,6 @@ main() { update-cli) update_cli ;; - reconfigure) - reconfigure_app - ;; logs) show_logs "$@" ;; @@ -671,14 +720,16 @@ main() { check_health ;; config) - show_config + config_cmd "${2:-}" + ;; + # Deprecated aliases (hidden from help) + reconfigure) + log_warning "'reconfigure' is deprecated — use: ${APP_CLI_NAME} config edit" + config_edit ;; configure) - if [ -f "$INSTALL_DIR/configure.sh" ]; then - bash "$INSTALL_DIR/configure.sh" - else - log_error "configure.sh not found in $INSTALL_DIR" - fi + log_warning "'configure' is deprecated — use: ${APP_CLI_NAME} config sync" + config_sync ;; *) log_error "Unknown command: $command\nRun '${APP_CLI_NAME} --help' for usage information" diff --git a/bin/configure.sh b/bin/config.sh similarity index 98% rename from bin/configure.sh rename to bin/config.sh index ecd5a30..2ff366d 100644 --- a/bin/configure.sh +++ b/bin/config.sh @@ -1,9 +1,9 @@ #!/bin/bash set -euo pipefail -# assemblrr Service Auto-Configuration -# Configures Radarr, Prowlarr, and related services after initial deployment -# Called by setup.sh after containers start, or via: assemblrr configure +# assemblrr service wiring (config sync) +# Wires Radarr, Prowlarr, and related services after initial deployment +# Called by setup.sh after containers start, or via: assemblrr config sync # Uses jq for JSON parsing # --- Config discovery --- diff --git a/bin/setup.sh b/bin/setup.sh index 33840b8..fa0f0fc 100644 --- a/bin/setup.sh +++ b/bin/setup.sh @@ -248,7 +248,7 @@ copy_configuration_files() { ["templates/recyclarr/includes/sonarr-soft-cfs.yml"]="templates/recyclarr/includes/sonarr-soft-cfs.yml" ["branding.conf"]="branding.conf" ["bin/cli.sh"]="cli.sh" - ["bin/configure.sh"]="configure.sh" + ["bin/config.sh"]="config.sh" ["bin/setup.sh"]="setup.sh" ["bin/docker-install.sh"]="docker-install.sh" ["scripts/jellyfin-refresh.sh"]="scripts/jellyfin-refresh.sh" @@ -660,12 +660,14 @@ if ! run_docker compose "${COMPOSE_ARGS[@]}" --profile "$media_service" up -d; t log_error "Failed to start ${APP_DISPLAY_NAME} services" fi -# Auto-configure services (Radarr, Prowlarr, etc.) -if [ -f "$install_directory/configure.sh" ]; then - if ! bash "$install_directory/configure.sh"; then - log_warning "Auto-configuration had issues. You can re-run: $APP_CLI_NAME configure" +# Wire services (Radarr, Prowlarr, etc.) +if [ -f "$install_directory/config.sh" ]; then + if ! bash "$install_directory/config.sh"; then + log_warning "Auto-configuration had issues. You can re-run: $APP_CLI_NAME config sync" fi fi +# Drop legacy name if an older install left it behind +rm -f "$install_directory/configure.sh" 2>/dev/null || true # Install CLI and set permissions echo diff --git a/lib/api.sh b/lib/api.sh index f38d3ad..a5be783 100644 --- a/lib/api.sh +++ b/lib/api.sh @@ -1,5 +1,5 @@ #!/bin/bash -# assemblrr API helpers — sourced by configure.sh +# assemblrr API helpers — sourced by config.sh # Provides: jq helpers, API request wrappers, API key discovery, wait_for_api # Requires: lib/core.sh already sourced (for logging), API_HOST and INSTALL_DIR set diff --git a/lib/arr.sh b/lib/arr.sh index bde03d4..335fdbb 100644 --- a/lib/arr.sh +++ b/lib/arr.sh @@ -1,9 +1,9 @@ #!/bin/bash -# assemblrr *arr service configuration — sourced by configure.sh +# assemblrr *arr service configuration — sourced by config.sh # Provides: set_arr_auth, qbit helpers, configure_arr_service, profile lookups, # configure_radarr, configure_sonarr, configure_prowlarr # Requires: lib/core.sh (logging), lib/api.sh (api_get/post/put/delete helpers), -# configure.sh (_cfg_log_info, log_step, log_step_fail, AUTH_USERNAME, etc.) +# config.sh (_cfg_log_info, log_step, log_step_fail, AUTH_USERNAME, etc.) set -euo pipefail diff --git a/lib/jellyfin.sh b/lib/jellyfin.sh index 1002edf..d36b9b1 100644 --- a/lib/jellyfin.sh +++ b/lib/jellyfin.sh @@ -1,9 +1,9 @@ #!/bin/bash -# assemblrr Jellyfin configuration — sourced by configure.sh +# assemblrr Jellyfin configuration — sourced by config.sh # Provides: configure_jellyfin, configure_jellyfin_xml_fallback, # configure_jellyfin_libraries, configure_jellyfin_notifications # Requires: lib/core.sh (logging), lib/api.sh (api_get/post helpers), -# configure.sh (_cfg_log_info, log_step, log_step_fail, AUTH_USERNAME, etc.) +# config.sh (_cfg_log_info, log_step, log_step_fail, AUTH_USERNAME, etc.) set -euo pipefail diff --git a/lib/seerr.sh b/lib/seerr.sh index ec73676..0d607dd 100644 --- a/lib/seerr.sh +++ b/lib/seerr.sh @@ -1,9 +1,9 @@ #!/bin/bash -# assemblrr Seerr & Recyclarr configuration — sourced by configure.sh +# assemblrr Seerr & Recyclarr configuration — sourced by config.sh # Provides: configure_seerr, configure_recyclarr # Requires: lib/core.sh (logging), lib/api.sh (api_get/post helpers), # lib/arr.sh (lookup_radarr_profile, lookup_sonarr_profile), -# configure.sh (_cfg_log_info, log_step, log_step_fail, etc.) +# config.sh (_cfg_log_info, log_step, log_step_fail, etc.) set -euo pipefail diff --git a/platform/windows/bootstrap-dev.ps1 b/platform/windows/bootstrap-dev.ps1 index 7493827..139d773 100644 --- a/platform/windows/bootstrap-dev.ps1 +++ b/platform/windows/bootstrap-dev.ps1 @@ -84,7 +84,7 @@ function Copy-ProjectToWSL2 { $wslSourcePath = "/mnt/$driveLetter" + ($ProjectDir.Substring(2) -replace '\\', '/') wsl -d $Distro -- bash -c "cp -r $wslSourcePath/* /tmp/$AppName/ && cp -r $wslSourcePath/.env.example $wslSourcePath/.gitignore /tmp/$AppName/ 2>/dev/null; true" - wsl -d $Distro -- bash -c "chmod +x /tmp/$AppName/bin/setup.sh /tmp/$AppName/bin/cli.sh /tmp/$AppName/bin/docker-install.sh /tmp/$AppName/bin/configure.sh /tmp/$AppName/lib/*.sh /tmp/$AppName/scripts/*.sh 2>/dev/null" + wsl -d $Distro -- bash -c "chmod +x /tmp/$AppName/bin/setup.sh /tmp/$AppName/bin/cli.sh /tmp/$AppName/bin/docker-install.sh /tmp/$AppName/bin/config.sh /tmp/$AppName/lib/*.sh /tmp/$AppName/scripts/*.sh 2>/dev/null" # Convert CRLF to LF on shell scripts (Windows line endings break bash) wsl -d $Distro -- bash -c "sed -i 's/\r$//' /tmp/$AppName/bin/*.sh /tmp/$AppName/lib/*.sh /tmp/$AppName/branding.conf /tmp/$AppName/compose/*.yaml /tmp/$AppName/compose/examples/*.yaml /tmp/$AppName/templates/*.env /tmp/$AppName/templates/*.yml /tmp/$AppName/scripts/*.sh 2>/dev/null; true" @@ -243,7 +243,8 @@ if [ -z "`$INSTALL_DIR" ]; then exit 1 fi echo "Install directory: `$INSTALL_DIR" -cp /tmp/$AppName/bin/cli.sh /tmp/$AppName/bin/setup.sh /tmp/$AppName/bin/docker-install.sh /tmp/$AppName/bin/configure.sh /tmp/$AppName/branding.conf "`$INSTALL_DIR/" +cp /tmp/$AppName/bin/cli.sh /tmp/$AppName/bin/setup.sh /tmp/$AppName/bin/docker-install.sh /tmp/$AppName/bin/config.sh /tmp/$AppName/branding.conf "`$INSTALL_DIR/" +rm -f "`$INSTALL_DIR/configure.sh" 2>/dev/null || true mkdir -p "`$INSTALL_DIR/lib" cp /tmp/$AppName/lib/*.sh "`$INSTALL_DIR/lib/" cp /tmp/$AppName/compose/base.yaml /tmp/$AppName/compose/vpn.yaml /tmp/$AppName/compose/direct-access.yaml "`$INSTALL_DIR/compose/"