git: 4a55093e8e33 - main - www/immich: Add a working immich-admin
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Sep 2026 19:15:42 UTC
The branch main has been updated by joneum:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4a55093e8e338bf5c0859aa96f3a979b22001d3c
commit 4a55093e8e338bf5c0859aa96f3a979b22001d3c
Author: Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-09-22 19:14:44 +0000
Commit: Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-09-22 19:15:12 +0000
www/immich: Add a working immich-admin
Immich ships bin/immich-admin as a stub that calls start.sh from PATH
and needs bash, which only holds inside its container image. The new
wrapper reads immich.env and starts the admin entry point directly; the
stub forwards to it.
Reported by: mfechner
Sponsored by: Netzkommune GmbH
---
www/immich/Makefile | 7 +++++--
www/immich/files/immich-admin.in | 34 ++++++++++++++++++++++++++++++++++
www/immich/pkg-plist | 1 +
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/www/immich/Makefile b/www/immich/Makefile
index d1a625c386fa..0781e68bafe9 100644
--- a/www/immich/Makefile
+++ b/www/immich/Makefile
@@ -1,7 +1,7 @@
PORTNAME= immich
DISTVERSIONPREFIX= v
DISTVERSION= 3.2.2
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= www
MASTER_SITES= https://github.com/joneum/FreeBSD-Immich/releases/download/v${DISTVERSION}/:buildkit
DISTFILES= immich-freebsd-buildkit-${DISTVERSION}${EXTRACT_SUFX}:buildkit
@@ -58,7 +58,7 @@ MAKE_ENV= CI=1 \
PYTHON=${PYTHON_CMD} \
SHARP_FORCE_GLOBAL_LIBVIPS=1
-SUB_FILES= pkg-message
+SUB_FILES= immich-admin pkg-message
SUB_LIST= NODE=${LOCALBASE}/bin/node
USERS= immich
@@ -91,6 +91,7 @@ do-build:
${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/node install/build.js
do-install:
+ ${INSTALL_SCRIPT} ${WRKDIR}/immich-admin ${STAGEDIR}${PREFIX}/bin/
${INSTALL_DATA} ${FILESDIR}/immich.env.sample ${STAGEDIR}${PREFIX}/etc/
@${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
${INSTALL_DATA} ${FILESDIR}/newsyslog-immich.conf \
@@ -119,5 +120,7 @@ post-install:
\( -name test -o -name tests -o -name __tests__ \
-o -name coverage \) -exec ${RM} -r {} + 2>/dev/null || ${TRUE}
@${FIND} ${STAGEDIR}${WWWDIR}/server -type d -empty -delete
+ @${PRINTF} '#!/bin/sh\nexec ${PREFIX}/bin/immich-admin "$$@"\n' \
+ > ${STAGEDIR}${WWWDIR}/server/bin/immich-admin
.include <bsd.port.mk>
diff --git a/www/immich/files/immich-admin.in b/www/immich/files/immich-admin.in
new file mode 100644
index 000000000000..fbf57042bbc4
--- /dev/null
+++ b/www/immich/files/immich-admin.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Immich ships bin/immich-admin as a two-line stub that calls start.sh from
+# PATH and needs bash. Both assumptions hold inside its container image only,
+# so run the server's admin entry point directly instead.
+
+MAIN=%%WWWDIR%%/server/dist/main.js
+ENV_FILE=%%PREFIX%%/etc/immich.env
+
+if [ ! -f "${MAIN}" ]; then
+ echo "${MAIN} not found, is www/immich installed?" >&2
+ exit 1
+fi
+
+if [ ! -r "${ENV_FILE}" ]; then
+ echo "cannot read ${ENV_FILE}" >&2
+ exit 1
+fi
+
+set -a
+. "${ENV_FILE}"
+set +a
+
+: ${IMMICH_MEDIA_LOCATION:=/var/db/immich}
+export IMMICH_MEDIA_LOCATION
+export IMMICH_BUILD_DATA=%%WWWDIR%%/build-data
+export NODE_ENV=production
+
+if [ "$(id -u)" = "0" ]; then
+ exec su -m immich -c 'exec %%LOCALBASE%%/bin/node --no-warnings "$0" immich-admin "$@"' \
+ "${MAIN}" "$@"
+fi
+
+exec %%LOCALBASE%%/bin/node --no-warnings "${MAIN}" immich-admin "$@"
diff --git a/www/immich/pkg-plist b/www/immich/pkg-plist
index 2413bb8beea0..6f3b597fd5f2 100644
--- a/www/immich/pkg-plist
+++ b/www/immich/pkg-plist
@@ -1,3 +1,4 @@
+bin/immich-admin
@sample(root,wheel,0600) etc/immich.env.sample
etc/newsyslog.conf.d/immich.conf
%%WWWDIR%%/build-data/geodata/admin1CodesASCII.txt