26 lines
1014 B
Bash
26 lines
1014 B
Bash
#!/bin/sh
|
|
# Install root-owned; caller cannot choose container, executable, input or env.
|
|
set -eu
|
|
case "${1:-}" in
|
|
dry-run) mode=dry-run ;;
|
|
apply) mode=apply ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
[ "$#" -eq 1 ] || exit 1
|
|
if [ "$mode" = apply ]; then
|
|
exec /usr/bin/docker exec --user 65534:65534 \
|
|
-e PGSERVICEFILE=/opt/miem-import/pg_service.conf \
|
|
-e PGSERVICE=miem_publication_import \
|
|
-e PGPASSFILE=/opt/miem-import/pgpass \
|
|
-e PYTHONNOUSERSITE=1 \
|
|
miem_workers-api-1 python -I /opt/miem-import/import_publications.py \
|
|
/opt/miem-import/articles.csv --apply --report /tmp/miem-import/apply.json
|
|
fi
|
|
exec /usr/bin/docker exec --user 65534:65534 \
|
|
-e PGSERVICEFILE=/opt/miem-import/pg_service.conf \
|
|
-e PGSERVICE=miem_publication_import \
|
|
-e PGPASSFILE=/opt/miem-import/pgpass \
|
|
-e PYTHONNOUSERSITE=1 \
|
|
miem_workers-api-1 python -I /opt/miem-import/import_publications.py \
|
|
/opt/miem-import/articles.csv --report /tmp/miem-import/dry-run.json
|