fix(photoprism): Add readonly mode for HFS+ read-only volumes
- Add PHOTOPRISM_READONLY=true to prevent writes to originals - Add PHOTOPRISM_SIDECAR_PATH and PHOTOPRISM_CACHE_PATH to writable storage - Create run_photoprism_cmd helper to pass environment to lxc-attach - Fixes indexing on read-only Apple Photos library mounts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
363e2af9d6
commit
62962751d5
@ -174,7 +174,10 @@ export PHOTOPRISM_DATABASE_DRIVER=sqlite
|
|||||||
export PHOTOPRISM_DATABASE_DSN=/opt/photoprism/storage/photoprism.db
|
export PHOTOPRISM_DATABASE_DSN=/opt/photoprism/storage/photoprism.db
|
||||||
export PHOTOPRISM_ORIGINALS_PATH=/opt/photoprism/originals
|
export PHOTOPRISM_ORIGINALS_PATH=/opt/photoprism/originals
|
||||||
export PHOTOPRISM_STORAGE_PATH=/opt/photoprism/storage
|
export PHOTOPRISM_STORAGE_PATH=/opt/photoprism/storage
|
||||||
|
export PHOTOPRISM_READONLY=true
|
||||||
export PHOTOPRISM_IMPORT_PATH=/opt/photoprism/import
|
export PHOTOPRISM_IMPORT_PATH=/opt/photoprism/import
|
||||||
|
export PHOTOPRISM_SIDECAR_PATH=/opt/photoprism/storage/sidecar
|
||||||
|
export PHOTOPRISM_CACHE_PATH=/opt/photoprism/storage/cache
|
||||||
export PHOTOPRISM_HTTP_HOST=0.0.0.0
|
export PHOTOPRISM_HTTP_HOST=0.0.0.0
|
||||||
export PHOTOPRISM_HTTP_PORT=2342
|
export PHOTOPRISM_HTTP_PORT=2342
|
||||||
export PHOTOPRISM_ADMIN_USER=admin
|
export PHOTOPRISM_ADMIN_USER=admin
|
||||||
@ -474,6 +477,23 @@ cmd_shell() {
|
|||||||
lxc-attach -n "$LXC_NAME" -- /bin/bash
|
lxc-attach -n "$LXC_NAME" -- /bin/bash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run photoprism command with proper environment
|
||||||
|
run_photoprism_cmd() {
|
||||||
|
local cmd="$1"
|
||||||
|
shift
|
||||||
|
lxc-attach -n "$LXC_NAME" -- bash -c "
|
||||||
|
export PHOTOPRISM_CONFIG_PATH=/opt/photoprism
|
||||||
|
export PHOTOPRISM_DATABASE_DRIVER=sqlite
|
||||||
|
export PHOTOPRISM_DATABASE_DSN=/opt/photoprism/storage/photoprism.db
|
||||||
|
export PHOTOPRISM_ORIGINALS_PATH=/opt/photoprism/originals
|
||||||
|
export PHOTOPRISM_STORAGE_PATH=/opt/photoprism/storage
|
||||||
|
export PHOTOPRISM_SIDECAR_PATH=/opt/photoprism/storage/sidecar
|
||||||
|
export PHOTOPRISM_CACHE_PATH=/opt/photoprism/storage/cache
|
||||||
|
export PHOTOPRISM_READONLY=true
|
||||||
|
cd /opt/photoprism && ./bin/photoprism $cmd $*
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
# Trigger indexing
|
# Trigger indexing
|
||||||
cmd_index() {
|
cmd_index() {
|
||||||
defaults
|
defaults
|
||||||
@ -484,7 +504,7 @@ cmd_index() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log "Starting photo indexing..."
|
log "Starting photo indexing..."
|
||||||
lxc-attach -n "$LXC_NAME" -- /opt/photoprism/bin/photoprism index
|
run_photoprism_cmd index
|
||||||
log "Indexing complete"
|
log "Indexing complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +521,7 @@ cmd_import() {
|
|||||||
[ "$(uci_get import.delete_after_import 0)" = "1" ] && delete_opt="--move"
|
[ "$(uci_get import.delete_after_import 0)" = "1" ] && delete_opt="--move"
|
||||||
|
|
||||||
log "Importing photos from ${DATA_PATH}/import..."
|
log "Importing photos from ${DATA_PATH}/import..."
|
||||||
lxc-attach -n "$LXC_NAME" -- /opt/photoprism/bin/photoprism import $delete_opt
|
run_photoprism_cmd import $delete_opt
|
||||||
log "Import complete"
|
log "Import complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user