Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Dec 2012 15:33:27 +0000 (UTC)
From:      Chris Rees <crees@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r308476 - in head/net-p2p: transmission-cli transmission-cli/files transmission-daemon
Message-ID:  <201212081533.qB8FXRYp066388@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: crees
Date: Sat Dec  8 15:33:27 2012
New Revision: 308476
URL: http://svnweb.freebsd.org/changeset/ports/308476

Log:
  Various rc fixes;
  - Add transmission_web_home to use customised web interface
  
  Requested by:	Hanson Wong
  
  - transmission should use a pidfile
  - Style fixes (mostly quoting)
  - Empty value in _user is clobbered with default, so remove warning
  
  Use USERS and GROUPS, and move home directory handling to rc script where
  it belongs; now users can be changed on the fly without issue
  
  Feature safe:	yes

Deleted:
  head/net-p2p/transmission-daemon/pkg-install
Modified:
  head/net-p2p/transmission-cli/Makefile
  head/net-p2p/transmission-cli/files/transmission.in
  head/net-p2p/transmission-daemon/Makefile
  head/net-p2p/transmission-daemon/pkg-plist

Modified: head/net-p2p/transmission-cli/Makefile
==============================================================================
--- head/net-p2p/transmission-cli/Makefile	Sat Dec  8 11:55:27 2012	(r308475)
+++ head/net-p2p/transmission-cli/Makefile	Sat Dec  8 15:33:27 2012	(r308476)
@@ -82,7 +82,7 @@ general-patch:
 post-patch: general-patch
 
 general-install:
-.ifndef (NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 	@${MKDIR} ${DOCSDIR}
 .for i in ${DOCS}
 	@${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}

Modified: head/net-p2p/transmission-cli/files/transmission.in
==============================================================================
--- head/net-p2p/transmission-cli/files/transmission.in	Sat Dec  8 11:55:27 2012	(r308475)
+++ head/net-p2p/transmission-cli/files/transmission.in	Sat Dec  8 15:33:27 2012	(r308476)
@@ -4,6 +4,7 @@
 #
 # PROVIDE: transmission
 # REQUIRE: DAEMON 
+# KEYWORD: shutdown
 #
 # Add the following lines to /etc/rc.conf to enable this service:
 #
@@ -18,28 +19,47 @@
 #			     Default: %%PREFIX%%/etc/transmission/home/Downloads
 # transmission_user:	     The user account transmission daemon runs as what
 #			     you want it to be. It uses 'transmission' user by
-#			     default. Do not sets it as empty or it will run
-#			     as root.
+#			     default.
+# transmission_web_home:     Use alternative directory for the web interface
+#			     files, such as javascript, html and graphics.
 #
 
 . /etc/rc.subr
 
-name="transmission"
+name=transmission
 rcvar=transmission_enable
 
-command=%%PREFIX%%/bin/transmission-daemon
+load_rc_config $name
 
-load_rc_config ${name}
+: ${transmission_enable:=NO}
+: ${transmission_conf_dir=%%PREFIX%%/etc/transmission/home}
+: ${transmission_download_dir=%%PREFIX%%/etc/transmission/home/Downloads}
+: ${transmission_user:=transmission}
+transmission_group=${transmission_group:-$transmission_user}
 
-: ${transmission_enable:="NO"}
-: ${transmission_user:="transmission"}
-: ${transmission_conf_dir="%%PREFIX%%/etc/transmission/home"}
-: ${transmission_download_dir="%%PREFIX%%/etc/transmission/home/Downloads"}
+command=%%PREFIX%%/bin/transmission-daemon
+pidfile=/var/run/transmission/damon.pid
+start_precmd=transmission_prestart
 
 transmission_flags=" \
 	${transmission_watch_dir:+-c ${transmission_watch_dir}} \
 	${transmission_conf_dir:+-g ${transmission_conf_dir}} \
 	${transmission_download_dir:+-w ${transmission_download_dir}} \
+	${pidfile:+-x $pidfile} \
 	${transmission_flags}"
 
-run_rc_command "$1"
+transmission_prestart()
+{
+	install -d -o $transmission_user ${pidfile%/*}
+	mkdir -p $transmission_conf_dir $transmission_download_dir
+	chown $transmission_user:$transmission_group $transmission_download_dir
+	chown -R $transmission_user:$transmission_group $transmission_conf_dir/*
+	chgrp $transmission_group $transmission_conf_dir
+	chmod 1770 $transmission_conf_dir
+	if [ -n "$transmission_web_home" ]; then
+		TRANSMISSION_WEB_HOME=$transmission_web_home
+		export TRANSMISSION_WEB_HOME
+	fi
+}
+
+run_rc_command $1

Modified: head/net-p2p/transmission-daemon/Makefile
==============================================================================
--- head/net-p2p/transmission-daemon/Makefile	Sat Dec  8 11:55:27 2012	(r308475)
+++ head/net-p2p/transmission-daemon/Makefile	Sat Dec  8 15:33:27 2012	(r308476)
@@ -5,7 +5,7 @@
 # $FreeBSD$
 #
 
-PORTREVISION=	0
+PORTREVISION=	1
 PKGNAMESUFFIX=	-daemon
 
 MAINTAINER=	crees@FreeBSD.org
@@ -16,10 +16,11 @@ RUN_DEPENDS=	${GEN_RUN_DEPENDS}
 DESCR=		${.CURDIR}/pkg-descr
 MASTERDIR=	${.CURDIR}/../transmission-cli
 PLIST=		${.CURDIR}/pkg-plist
-PKGINSTALL=	${.CURDIR}/pkg-install
 SLAVEPORT=	daemon
 
 USE_RC_SUBR=	transmission
+USERS=		transmission
+GROUPS=		transmission
 
 EXTRA_CONF_ARGS=--disable-cli \
 		--enable-daemon \
@@ -29,10 +30,4 @@ EXTRA_CONF_ARGS=--disable-cli \
 
 MAN1=		transmission-daemon.1 transmission-remote.1
 
-post-install: general-install
-.if !defined(PACKAGE_BUILDING)
-	@${SETENV} PKG_PREFIX=${PREFIX} \
-		${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-.endif
-
 .include "${MASTERDIR}/Makefile"

Modified: head/net-p2p/transmission-daemon/pkg-plist
==============================================================================
--- head/net-p2p/transmission-daemon/pkg-plist	Sat Dec  8 11:55:27 2012	(r308475)
+++ head/net-p2p/transmission-daemon/pkg-plist	Sat Dec  8 15:33:27 2012	(r308476)
@@ -5,6 +5,5 @@ bin/transmission-remote
 %%PORTDOCS%%%%DOCSDIR%%/NEWS
 %%PORTDOCS%%%%DOCSDIR%%/README
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
-@dirrmtry etc/transmission/home/Downloads
-@dirrmtry etc/transmission/home
-@dirrmtry etc/transmission
+@dirrmtry %%ETCDIR%%/home
+@dirrmtry %%ETCDIR%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212081533.qB8FXRYp066388>