diff options
author | Ivan Rozhuk <rozhuk.im@gmail.com> | 2025-06-12 18:56:03 +0100 |
---|---|---|
committer | Nuno Teixeira <eduardo@FreeBSD.org> | 2025-06-12 18:57:21 +0100 |
commit | 7d8f99aae161bbd82ee329a229410d4568894482 (patch) | |
tree | d006b0cd9052af843a0b195360c0bef0058c7880 | |
parent | net/haproxy: update to version 3.0.11 (diff) |
net-p2p/rtorrent: drop EXAMPLES, add rc.d script
PR: 256694
-rw-r--r-- | GIDs | 2 | ||||
-rw-r--r-- | UIDs | 2 | ||||
-rw-r--r-- | net-p2p/rtorrent/Makefile | 20 | ||||
-rw-r--r-- | net-p2p/rtorrent/files/rtorrent.in | 82 |
4 files changed, 97 insertions, 9 deletions
@@ -337,7 +337,7 @@ ldap:*:389: # free: 394 # free: 395 # free: 396 -# free: 397 +rtorrent:*:397: tiarra:*:398: # free: 399 # free: 400 @@ -343,7 +343,7 @@ ldap:*:389:389::0:0:OpenLDAP Server:/nonexistent:/usr/sbin/nologin # free: 394 # free: 395 # free: 396 -# free: 397 +rtorrent:*:397:397::0:0:rtorrent Daemon User:/nonexistent:/usr/sbin/nologin tiarra:*:398:398::0:0:Tiarra IRC Proxy:/nonexistent:/usr/sbin/nologin # free: 399 # free: 400 diff --git a/net-p2p/rtorrent/Makefile b/net-p2p/rtorrent/Makefile index fe1829c9370e..eca3fa740e74 100644 --- a/net-p2p/rtorrent/Makefile +++ b/net-p2p/rtorrent/Makefile @@ -1,5 +1,6 @@ PORTNAME= rtorrent DISTVERSION= 0.15.4 +PORTREVISION= 1 CATEGORIES= net-p2p MASTER_SITES= https://github.com/rakshasa/rtorrent/releases/download/v${DISTVERSION}/ @@ -15,17 +16,21 @@ LIB_DEPENDS= libcurl.so:ftp/curl \ libtorrent.so:net-p2p/libtorrent USES= compiler:c++17-lang ncurses pkgconfig +USE_RC_SUBR= rtorrent GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-debug LDFLAGS+= -lexecinfo -pthread SUB_FILES= pkg-message -PLIST_FILES= bin/rtorrent +USERS= rtorrent +GROUPS= rtorrent + +PLIST_FILES= bin/rtorrent \ + "@sample ${ETCDIR}/rtorrent.conf.sample" PORTDOCS= README -PORTEXAMPLES= rtorrent.rc -OPTIONS_DEFINE= DOCS EXAMPLES IPV6 +OPTIONS_DEFINE= DOCS IPV6 OPTIONS_DEFAULT= TINYXML OPTIONS_RADIO= XML OPTIONS_RADIO_XML= TINYXML XMLRPC @@ -36,12 +41,13 @@ TINYXML_CONFIGURE_ON= --with-xmlrpc-tinyxml2 XMLRPC_LIB_DEPENDS= libxmlrpc.so:net/xmlrpc-c XMLRPC_CONFIGURE_ON= --with-xmlrpc-c +post-install: + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKSRC}/doc/rtorrent.rc \ + ${STAGEDIR}${ETCDIR}/rtorrent.conf.sample + post-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR}/ ${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${STAGEDIR}${DOCSDIR}/ -post-install-EXAMPLES-on: - @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}/ - ${INSTALL_DATA} ${WRKSRC}/doc/rtorrent.rc ${STAGEDIR}${EXAMPLESDIR}/ - .include <bsd.port.mk> diff --git a/net-p2p/rtorrent/files/rtorrent.in b/net-p2p/rtorrent/files/rtorrent.in new file mode 100644 index 000000000000..fc54085b4c0e --- /dev/null +++ b/net-p2p/rtorrent/files/rtorrent.in @@ -0,0 +1,82 @@ +#!/bin/sh + +# PROVIDE: rtorrent +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name="rtorrent" +rcvar=rtorrent_enable + +load_rc_config $name + +: ${rtorrent_enable='NO'} +: ${rtorrent_run_dir="/var/run/${name}"} +: ${rtorrent_pidfile="${rtorrent_run_dir}/${name}.pid"} +: ${rtorrent_user='rtorrent'} +: ${rtorrent_group='rtorrent'} +: ${rtorrent_args=''} +: ${rtorrent_bindaddr=''} # Bind listening socket and outgoing connections to this network interface address. +: ${rtorrent_bindport=''} # Try to open a listening port in the range a up to and including b +: ${rtorrent_download_dir=''} # Set the default download directory. +: ${rtorrent_session_dir="/var/db/${name}"} # Session management will be enabled and the torrent files for all open downloads will be stored in this directory. +: ${rtorrent_config="%%PREFIX%%/etc/${name}/${name}.conf"} # .rtorrent.rc config file name. +: ${rtorrent_rpc_bindaddr=''} # tcp (ip:port) socket for scgi/rpc connect. +: ${rtorrent_rpc_bindsocket="${rtorrent_run_dir}/${name}-rpc.sock"} # Unix domain socket for scgi/rpc connect. + + +command='/usr/sbin/daemon' +procname='%%PREFIX%%/bin/rtorrent' +command_args='-n' + +if [ -n "${rtorrent_bindaddr}" ]; then + command_args="${command_args} -b ${rtorrent_bindaddr}" +fi +if [ -n "${rtorrent_bindport}" ]; then + command_args="${command_args} -p ${rtorrent_bindport}" +fi +if [ -n "${rtorrent_download_dir}" ]; then + command_args="${command_args} -d ${rtorrent_download_dir}" +fi +if [ -n "${rtorrent_session_dir}" ]; then + command_args="${command_args} -s ${rtorrent_session_dir}" +fi +if [ -n "${rtorrent_config}" ]; then + command_args="${command_args} -o import=${rtorrent_config}" +fi +if [ -n "${rtorrent_rpc_bindsocket}" ]; then + command_args="${command_args} -o scgi_local=${rtorrent_rpc_bindsocket}" +fi +if [ -n "${rtorrent_rpc_bindaddr}" ]; then + command_args="${command_args} -o network.scgi.open_port=${rtorrent_rpc_bindaddr}" +fi +command_args="-p ${rtorrent_pidfile} -S -T ${name} ${procname} ${command_args} -o session.path.set=${rtorrent_session_dir} -o system.daemon.set=yes ${rtorrent_args}" + + +pidfile="${rtorrent_pidfile}" +required_dirs="${rtorrent_download_dir}" +required_files="${command} ${procname}" + +start_precmd="${name}_start_precmd" + +rtorrent_start_precmd() +{ + # create the file pid, and directory, with correct permissions + if [ ! -d ${rtorrent_run_dir} ]; then + install -d -o ${rtorrent_user} -g ${rtorrent_group} ${rtorrent_run_dir} + fi + if [ ! -d ${rtorrent_session_dir} ]; then + install -d -o ${rtorrent_user} -g ${rtorrent_group} ${rtorrent_session_dir} + fi + if [ -n "${rtorrent_session_dir}" ]; then + rm -f "${rtorrent_session_dir}/rtorrent.lock" + fi + if [ -e "${rtorrent_rpc_bindsocket}" ]; then + rm -f "${rtorrent_rpc_bindsocket}" + fi +} + + +run_rc_command "$1" + |