git: 91e5f354f579 - main - www/caddy: Allow setting the path to the caddy binary
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Sep 2022 15:02:06 UTC
The branch main has been updated by adamw: URL: https://cgit.FreeBSD.org/ports/commit/?id=91e5f354f57911097e3548501f959ab09d829804 commit 91e5f354f57911097e3548501f959ab09d829804 Author: Adam Weinberger <adamw@FreeBSD.org> AuthorDate: 2022-09-29 15:00:43 +0000 Commit: Adam Weinberger <adamw@FreeBSD.org> CommitDate: 2022-09-29 15:02:02 +0000 www/caddy: Allow setting the path to the caddy binary This will make the rc(8) script more usable for users who build caddy with xcaddy (www/xcaddy). --- www/caddy/Makefile | 2 +- www/caddy/files/caddy.in | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/www/caddy/Makefile b/www/caddy/Makefile index 58338dfa1f1d..14629b7b0cbf 100644 --- a/www/caddy/Makefile +++ b/www/caddy/Makefile @@ -1,7 +1,7 @@ PORTNAME= caddy DISTVERSIONPREFIX= v DISTVERSION= 2.6.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www DIST_SUBDIR= caddy diff --git a/www/caddy/files/caddy.in b/www/caddy/files/caddy.in index 300a0ff23575..45c6b83dafb8 100644 --- a/www/caddy/files/caddy.in +++ b/www/caddy/files/caddy.in @@ -8,6 +8,7 @@ # /etc/rc.conf.local # Optional settings: +# caddy_command (string): Full path to the caddy binary # caddy_config (string): Full path to caddy config file # (%%ETCDIR%%/Caddyfile) # caddy_adapter (string): Config adapter type (caddyfile) @@ -38,7 +39,8 @@ load_rc_config $name # Defaults : ${caddy_enable:=NO} : ${caddy_adapter:=caddyfile} -: ${caddy_config:=%%ETCDIR%%/Caddyfile} +: ${caddy_config:="%%ETCDIR%%/Caddyfile"} +: ${caddy_command:="%%PREFIX%%/bin/${name}"} : ${caddy_directory:=/var/db/caddy} : ${caddy_extra_flags:=""} : ${caddy_logdir:="/var/log/${name}"} @@ -51,11 +53,10 @@ load_rc_config $name : ${XDG_DATA_HOME:="${caddy_directory}/data"} export XDG_CONFIG_HOME XDG_DATA_HOME -command="%%PREFIX%%/bin/${name}" caddy_flags="--config ${caddy_config} --adapter ${caddy_adapter}" pidfile="/var/run/${name}/${name}.pid" -required_files="${caddy_config} ${command}" +required_files="${caddy_config} ${caddy_command}" start_precmd="caddy_precmd" start_cmd="caddy_start" @@ -63,12 +64,12 @@ stop_precmd="caddy_prestop" # Extra Commands extra_commands="configtest reload" -configtest_cmd="caddy_command validate ${caddy_flags}" -reload_cmd="caddy_command reload ${caddy_flags}" +configtest_cmd="caddy_execute validate ${caddy_flags}" +reload_cmd="caddy_execute reload ${caddy_flags}" -caddy_command() +caddy_execute() { - /usr/bin/su -m "${caddy_user}" -c "${command} $*" + /usr/bin/su -m "${caddy_user}" -c "${caddy_command} $*" } caddy_precmd() @@ -90,7 +91,7 @@ caddy_precmd() caddy_start() { echo -n "Starting caddy... " - /usr/bin/su -m ${caddy_user} -c "${command} start ${caddy_flags} \ + /usr/bin/su -m ${caddy_user} -c "${caddy_command} start ${caddy_flags} \ ${caddy_extra_flags} --pidfile ${pidfile}" >> ${caddy_logfile} 2>&1 if [ $? -eq 0 ] && ps -ax -o pid | grep -q "$(cat ${pidfile})"; then echo "done" @@ -107,7 +108,7 @@ caddy_prestop() echo -n "Stopping caddy... " - result="$(caddy_command stop 2>&1)" + result="$(caddy_execute stop 2>&1)" if [ ${?} -eq 0 ]; then echo "done" exit 0