diff --git a/ansible/roles/immich_sync/templates/immich-sync.sh.j2 b/ansible/roles/immich_sync/templates/immich-sync.sh.j2 index 3851d3d..ba835d7 100644 --- a/ansible/roles/immich_sync/templates/immich-sync.sh.j2 +++ b/ansible/roles/immich_sync/templates/immich-sync.sh.j2 @@ -11,6 +11,10 @@ set -euo pipefail +# Explicit paths for LaunchAgent context (no PATH inheritance) +MISE=/opt/homebrew/opt/mise/bin/mise +DOCKER=/usr/local/bin/docker + EXPORT_DIR="{{ immich_sync_export_dir }}" IMMICH_URL="{{ immich_sync_url }}" API_KEY_FILE="$HOME/.immich-api-key" @@ -25,19 +29,13 @@ error() { } # Check prerequisites -if ! command -v osxphotos &>/dev/null; then - # Try via mise - if command -v mise &>/dev/null; then - eval "$(mise activate bash)" - fi - if ! command -v osxphotos &>/dev/null; then - error "osxphotos not found. Install via: mise install pipx:osxphotos" - exit 1 - fi +if [[ ! -x "$MISE" ]]; then + error "mise not found at $MISE" + exit 1 fi -if ! command -v docker &>/dev/null; then - error "Docker not found" +if [[ ! -x "$DOCKER" ]]; then + error "Docker not found at $DOCKER" exit 1 fi @@ -76,8 +74,8 @@ OSXPHOTOS_ARGS=( {% endif %} ) -log "Running: osxphotos ${OSXPHOTOS_ARGS[*]}" -if ! osxphotos "${OSXPHOTOS_ARGS[@]}"; then +log "Running: mise x -- osxphotos ${OSXPHOTOS_ARGS[*]}" +if ! "$MISE" x -- osxphotos "${OSXPHOTOS_ARGS[@]}"; then error "osxphotos export failed" exit 1 fi @@ -100,7 +98,7 @@ IMMICH_CLI_ARGS=( ) log "Running: docker run immich-cli ${IMMICH_CLI_ARGS[*]}" -if ! docker run --rm \ +if ! "$DOCKER" run --rm \ -v "$EXPORT_DIR:/import:ro" \ -e IMMICH_INSTANCE_URL="$IMMICH_URL" \ -e IMMICH_API_KEY="$IMMICH_API_KEY" \