diff options
author | crees <crees@FreeBSD.org> | 2012-12-08 23:33:27 +0800 |
---|---|---|
committer | crees <crees@FreeBSD.org> | 2012-12-08 23:33:27 +0800 |
commit | 35b0b721c9eb50cebde58c3ea72d78f67d14b4fc (patch) | |
tree | f3b9d453b49ede5b38088cac6c2ff5e3519743da | |
parent | 3b2d1f5328d0a4345729b6d98c3b3292f798adc3 (diff) | |
download | freebsd-ports-gnome-35b0b721c9eb50cebde58c3ea72d78f67d14b4fc.tar.gz freebsd-ports-gnome-35b0b721c9eb50cebde58c3ea72d78f67d14b4fc.tar.zst freebsd-ports-gnome-35b0b721c9eb50cebde58c3ea72d78f67d14b4fc.zip |
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
-rw-r--r-- | net-p2p/transmission-cli/Makefile | 2 | ||||
-rw-r--r-- | net-p2p/transmission-cli/files/transmission.in | 40 | ||||
-rw-r--r-- | net-p2p/transmission-daemon/Makefile | 11 | ||||
-rw-r--r-- | net-p2p/transmission-daemon/pkg-install | 46 | ||||
-rw-r--r-- | net-p2p/transmission-daemon/pkg-plist | 5 |
5 files changed, 36 insertions, 68 deletions
diff --git a/net-p2p/transmission-cli/Makefile b/net-p2p/transmission-cli/Makefile index 058da2ac8620..31e0c37151b4 100644 --- a/net-p2p/transmission-cli/Makefile +++ b/net-p2p/transmission-cli/Makefile @@ -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} diff --git a/net-p2p/transmission-cli/files/transmission.in b/net-p2p/transmission-cli/files/transmission.in index def430c8b88b..41a2d743d54a 100644 --- a/net-p2p/transmission-cli/files/transmission.in +++ b/net-p2p/transmission-cli/files/transmission.in @@ -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 diff --git a/net-p2p/transmission-daemon/Makefile b/net-p2p/transmission-daemon/Makefile index b3be3bbedcdc..bbc21109521a 100644 --- a/net-p2p/transmission-daemon/Makefile +++ b/net-p2p/transmission-daemon/Makefile @@ -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" diff --git a/net-p2p/transmission-daemon/pkg-install b/net-p2p/transmission-daemon/pkg-install deleted file mode 100644 index 7d6ee9b0a832..000000000000 --- a/net-p2p/transmission-daemon/pkg-install +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -case $2 in -POST-INSTALL) - USER=transmission - GROUP=${USER} - UID=921 - GID=${UID} - PW=/usr/sbin/pw - CHMOD=/bin/chmod - CHOWN=/usr/sbin/chown - MKDIR=/bin/mkdir - THOME=${PKG_PREFIX}/etc/${USER}/home - - if ${PW} group show "${GROUP}" 2>/dev/null; then - echo "You already have a group \"${GROUP}\", so I will use it." - else - if ${PW} groupadd ${GROUP} -g ${GID}; then - echo "Added group \"${GROUP}\"." - else - echo "Adding group \"${GROUP}\" failed..." - exit 1 - fi - fi - - if ${PW} user show "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." - else - if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "${THOME}" -s /usr/sbin/nologin -c "Transmission Daemon User" - then - echo "Added user \"${USER}\"." - else - echo "Adding user \"${USER}\" failed..." - exit 1 - fi - fi - - ${MKDIR} -p ${THOME}/Downloads - ${CHOWN} root:${GROUP} ${THOME} - ${CHOWN} ${USER}:${GROUP} ${THOME}/Downloads - ${CHMOD} 1770 ${THOME} - - exit 0 - ;; -esac diff --git a/net-p2p/transmission-daemon/pkg-plist b/net-p2p/transmission-daemon/pkg-plist index e7cb3d4f583f..79cc3a27a322 100644 --- a/net-p2p/transmission-daemon/pkg-plist +++ b/net-p2p/transmission-daemon/pkg-plist @@ -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%% |