diff --git a/net/nbdkit/Makefile b/net/nbdkit/Makefile index 725b7b62230b..d6fe1b73312f 100644 --- a/net/nbdkit/Makefile +++ b/net/nbdkit/Makefile @@ -1,73 +1,74 @@ PORTNAME= nbdkit -PORTVERSION= 1.44.3 +PORTVERSION= 1.44.4 CATEGORIES= net # XXX Although nbdkit uses github for its homepage, the release tarballs served # by github haven't been through autoconf. So we must download the sources # from libguestfs.org instead. MASTER_SITES= http://download.libguestfs.org/${PORTNAME}/${PORTVERSION:R}-stable/ -MAINTAINER= asomers@FreeBSD.org +MAINTAINER= dtxdf@FreeBSD.org COMMENT= Network Block Device server toolkit with stable ABI and permissive license WWW= https://gitlab.com/nbdkit/nbdkit LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= bash-completion>0:shells/bash-completion \ bash:shells/bash USES= compiler:c11 cpe gmake libtool pkgconfig CPE_VENDOR= nbdkit_project USE_LDCONFIG= yes +USE_RC_SUBR= ${PORTNAME} GNU_CONFIGURE= yes GNU_CONFIGURE_MANPREFIX= ${PREFIX}/share # Rust consumers will download the Rust plugin from crates.io CONFIGURE_ARGS+= --disable-rust # These libraries does not exist on ports CONFIGURE_ARGS+= --without-libguestfs \ --without-libnbd # We could theoretically build these other plugins, if anybody cares to. CONFIGURE_ARGS+= --disable-golang \ --disable-linuxdisk \ --disable-lua \ --disable-ocaml \ --disable-tcl \ --disable-vddk \ --without-ext2 \ --without-iso INSTALL_TARGET= install-strip TEST_TARGET= check OPTIONS_DEFINE= CURL GNUTLS LIBVIRT LZMA MANPAGES PERL PYTHON RUBY SSH ZLIB \ ZSTD OPTIONS_DEFAULT= GNUTLS MANPAGES OPTIONS_SUB= yes CURL_BUILD_DEPENDS+= curl:ftp/curl CURL_RUN_DEPENDS+= curl:ftp/curl CURL_CONFIGURE_WITH= curl GNUTLS_BUILD_DEPENDS= gnutls>0:security/gnutls GNUTLS_RUN_DEPENDS= gnutls>0:security/gnutls LIBVIRT_LIB_DEPENDS= libvirt.so:devel/libvirt LIBVIRT_CONFIGURE_WITH= libvirt LZMA_LIB_DEPENDS= liblzma.so:archivers/lzmalib LZMA_CONFIGURE_WITH= liblzma MANPAGES_USES+= perl5 MANPAGES_USE+= PERL5=build PERL_USE+= perl5 PERL_CONFIGURE_ENABLE= perl PYTHON_USES+= python PYTHON_CONFIGURE_ENABLE= python RUBY_USE+= ruby RUBY_CONFIGURE_ENABLE= ruby SSH_LIB_DEPENDS= libssh.so:security/libssh SSH_CONFIGURE_WITH= ssh ZLIB_CONFIGURE_WITH= zlib ZSTD_LIB_DEPENDS= libzstd.so:archivers/zstd ZSTD_CONFIGURE_WITH= libzstd .include diff --git a/net/nbdkit/distinfo b/net/nbdkit/distinfo index 54e107bf8e51..bfeb3cec6b8c 100644 --- a/net/nbdkit/distinfo +++ b/net/nbdkit/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1760898952 -SHA256 (nbdkit-1.44.3.tar.gz) = 7c6fdd41e93652a03b619fb6ee22b06f6962cddfa075ba97640b977ee3cc0cf1 -SIZE (nbdkit-1.44.3.tar.gz) = 2656054 +TIMESTAMP = 1761865788 +SHA256 (nbdkit-1.44.4.tar.gz) = 281d83daf954e04c739a5f29d10e5440de69e9009654a2935aee7cbf3aebca91 +SIZE (nbdkit-1.44.4.tar.gz) = 2659658 diff --git a/net/nbdkit/files/nbdkit.in b/net/nbdkit/files/nbdkit.in new file mode 100644 index 000000000000..3adcbb0e772f --- /dev/null +++ b/net/nbdkit/files/nbdkit.in @@ -0,0 +1,136 @@ +#!/bin/sh + +# PROVIDE: nbdkit +# REQUIRE: NETWORKING +# +# Configuration settings for nbdkit in /etc/rc.conf: +# +# nbdkit_enable (bool): Enable nbdkit. (default=NO) +# nbdkit_flags (str): Arguments used by all profiles. +# nbdkit_profiles (list): Profiles. +# nbdkit__flags (str): Per profile arguments. + +. /etc/rc.subr + +name="nbdkit" +desc="Network Block Device server toolkit with stable ABI and permissive license" +rcvar="${name}_enable" +start_precmd="nbdkit_prestart" +start_cmd="nbdkit_start" +stop_cmd="nbdkit_stop" +restart_cmd="nbdkit_restart" +status_cmd="nbdkit_status" +nbdkit_bin="%%PREFIX%%/sbin/${name}" +sig_stop=SIGTERM +pid_directory="/var/run/${name}" + +load_rc_config $name + +: ${nbdkit_enable:="NO"} + +nbdkit_check_pidfile() +{ + local profile + profile="$1" + + local pidfile + pidfile="${pid_directory}/${profile}.pid" + + local rc_pid + rc_pid=$(check_pidfile "${pidfile}" "${nbdkit_bin}") + + echo "${rc_pid}" +} + +nbdkit_prestart() +{ + if [ ! -d "${pid_directory}" ]; then + mkdir -p -- "${pid_directory}" + fi +} + +nbdkit_start() +{ + local profile + profile="$1" + + local rc_pid + rc_pid=$(nbdkit_check_pidfile "${profile}") + + if [ -n "${rc_pid}" ]; then + echo 1>&2 "nbdkit profile '${profile}' already running? (pid=${rc_pid})" + return 1 + fi + + startmsg "Starting nbdkit profile '${profile}'." + + local flags + + eval flags="\${nbdkit_${profile}_flags}" + + local pidfile + pidfile="${pid_directory}/${profile}.pid" + + eval "${nbdkit_bin}" --pidfile "${pidfile}" ${nbdkit_flags} ${flags} +} + +nbdkit_stop() +{ + local profile + profile="$1" + + local rc_pid + rc_pid=$(nbdkit_check_pidfile "${profile}") + + local pidfile + pidfile="${pid_directory}/${profile}.pid" + + if [ -z "${rc_pid}" ]; then + echo 1>&2 "nbdkit profile '${profile}' not running? (check ${pidfile})" + return 1 + fi + + echo "Stopping nbdkit profile '${profile}'." + + kill -${sig_stop} "${rc_pid}" + wait_for_pids "${rc_pid}" +} + +nbdkit_restart() +{ + nbdkit_stop "$1" + nbdkit_start "$1" +} + +nbdkit_status() +{ + local profile + profile="$1" + + local rc_pid + rc_pid=$(nbdkit_check_pidfile "${profile}") + + if [ -n "${rc_pid}" ]; then + echo "nbdkit profile '${profile}' is running as pid ${rc_pid}" + else + echo "nbdkit profile '${profile}' is not running." + fi +} + +cmd="$1" + +if [ $# -gt 0 ]; then + shift +fi + +if [ -n "$1" ]; then + nbdkit_profiles="$1" +fi + +if [ -z "${nbdkit_profiles}" ]; then + warn "No profiles are configured, configure one to make this rc script useful!" +fi + +for profile in ${nbdkit_profiles}; do + run_rc_command "${cmd}" "${profile}" +done