diff --git a/dns/blocky/Makefile b/dns/blocky/Makefile index 45cac4b303ea..b69d19541e74 100644 --- a/dns/blocky/Makefile +++ b/dns/blocky/Makefile @@ -1,32 +1,36 @@ PORTNAME= blocky DISTVERSIONPREFIX= v DISTVERSION= 0.23 +PORTREVISION= 1 CATEGORIES= dns MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/:gomod DISTFILES= go.mod:gomod MAINTAINER= eduardo@FreeBSD.org COMMENT= Fast and lightweight DNS proxy as ad-blocker WWW= https://0xerr0r.github.io/blocky/ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE USES= go:1.21,modules USE_GITHUB= yes GH_ACCOUNT= 0xERR0R USE_RC_SUBR= blocky GO_MODULE= github.com/${GH_ACCOUNT}/${GH_PROJECT} GO_TARGET= main.go:${PREFIX}/sbin/${PORTNAME} GO_BUILDFLAGS= -ldflags "-w -s \ -X github.com/0xERR0R/blocky/util.Version=${DISTVERSION} \ -X github.com/0xERR0R/blocky/util.BuildTime=`date '+%Y%m%d-%H%M%S'` \ -X github.com/0xERR0R/blocky/util.Architecture=${ARCH}" SUB_FILES= pkg-message +PLIST_FILES= "@sample etc/blocky-config.yml.sample" \ + sbin/blocky + post-install: ${INSTALL_DATA} ${FILESDIR}/blocky-config.yml.sample ${STAGEDIR}${PREFIX}/etc/blocky-config.yml.sample .include diff --git a/dns/blocky/files/blocky.in b/dns/blocky/files/blocky.in index 2b625f8be55d..13fb9fb0c13f 100644 --- a/dns/blocky/files/blocky.in +++ b/dns/blocky/files/blocky.in @@ -1,54 +1,55 @@ #!/bin/sh # PROVIDE: blocky # REQUIRE: DAEMON NETWORKING # KEYWORD: shutdown # # Add the following to /etc/rc.conf[.local] to enable this service # # blocky_enable (bool): Set to NO by default. # Set it to YES to enable blocky. # blocky_config (str): Set to /usr/local/etc/blocky-config.yml by default. # Set it to a path to use that config file. # blocky_user (str): Services run as root by default. Set to a user name # to run blocky as that user. Note: non-root users # might need permission to bind to ports. # blocky_group (str): Set to the user's primary group by default. # Set it to a group name for daemon file ownership. # blocky_flags (str): Enter extra flags to append to the blocky command. . /etc/rc.subr name=blocky rcvar=blocky_enable load_rc_config ${name} : ${blocky_enable:=NO} : ${blocky_config:="%%PREFIX%%/etc/blocky-config.yml"} : ${blocky_group:=} : ${blocky_flags:=} if [ -n "${blocky_user}" ] && [ -z "${blocky_group}" ]; then # Detect the daemon user's primary group blocky_group=$(id -gn "${blocky_user}") fi +logfile="/var/log/${name}.log" pidfile="/var/run/${name}.pid" blocky_path="%%PREFIX%%/sbin/blocky" command="/usr/sbin/daemon" procname="/usr/local/sbin/blocky" -command_args="-c -f -p ${pidfile} ${blocky_path} \ +command_args="-c -f -o ${logfile} -p ${pidfile} ${blocky_path} \ -c ${blocky_config} ${blocky_flags}" start_precmd="blocky_precmd" # Sets up a pidfile the daemon user can access blocky_precmd() { install -o "${blocky_user:-root}" -g "${blocky_group:-wheel}" \ -m 0600 /dev/null "${pidfile}" } run_rc_command "$1" diff --git a/dns/blocky/pkg-plist b/dns/blocky/pkg-plist deleted file mode 100644 index 55ea60866bc2..000000000000 --- a/dns/blocky/pkg-plist +++ /dev/null @@ -1,2 +0,0 @@ -@sample etc/blocky-config.yml.sample -sbin/blocky