Files
photoprism-freebsd-port/files/photoprism.in
2024-05-31 13:15:10 +02:00

35 lines
1.2 KiB
Bash

#!/bin/sh
#
# PROVIDE: photoprism
# REQUIRE: LOGIN
# You must add the following lines to /etc/rc.conf to enable photoprism:
# photoprism_enable="YES"
# photoprism_assetspath="%%PHOTOPRISM_DATA_DIR%%/assets"
# photoprism_storagepath="%%PHOTOPRISM_DATA_DIR%%/storage"
# and
# photoprism_args="<set as needed>"
. /etc/rc.subr
name="photoprism"
rcvar=photoprism_enable
load_rc_config $name
: ${photoprism_enable="NO"}
if [ "$photoprism_auth_mode" ]; then photoprism_args="${photoprism_args} --auth-mode=${photoprism_auth_mode}"; fi
if [ "$photoprism_defaultsyaml" ]; then photoprism_args="${photoprism_args} --defaults-yaml=${photoprism_defaultsyaml}"; fi
if [ "$photoprism_assetspath" ]; then photoprism_args="${photoprism_args} --assets-path=${photoprism_assetspath}"; fi
if [ "$photoprism_storagepath" ]; then
photoprism_args="${photoprism_args} --storage-path=${photoprism_storagepath} --originals-path=${photoprism_storagepath}/originals --import-path=${photoprism_storagepath}/import"
fi
pidfile="/var/run/photoprism.pid"
procname="/usr/local/bin/photoprism"
command="/usr/sbin/daemon"
command_args="-f -T photoprism -p ${pidfile} -u photoprism /usr/local/bin/photoprism ${photoprism_args} start"
run_rc_command "$1"