Add immich-sync ansible role for photo library sync #63
1 changed files with 12 additions and 14 deletions
Use explicit paths in immich-sync script for LaunchAgent
LaunchAgents don't inherit PATH, so use explicit paths: - /opt/homebrew/opt/mise/bin/mise x -- osxphotos (like borgmatic) - /usr/local/bin/docker for Docker commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
commit
dd80724b71
|
|
@ -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" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue