diff options
author | jmmv <jmmv@pkgsrc.org> | 2006-08-10 11:35:26 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2006-08-10 11:35:26 +0000 |
commit | 4786a69bc507b67ac5b89a5d3d5084cb1ed0a956 (patch) | |
tree | 8e795d7a4357e459d77620f065424bd307f49eda /net | |
parent | f874e90da203a1687c5f66c45763183bb7049163 (diff) | |
download | pkgsrc-4786a69bc507b67ac5b89a5d3d5084cb1ed0a956.tar.gz |
Some improvements to the rc.d script:
- Put the log and pid files into VARBASE/log and VARBASE/run respectively.
- Let the user override several variables from rc.conf.
Per wiz@'s suggestion.
Bump PKGREVISION to 1.
Diffstat (limited to 'net')
-rw-r--r-- | net/mldonkey/Makefile | 8 | ||||
-rw-r--r-- | net/mldonkey/files/mldonkey.sh | 34 |
2 files changed, 33 insertions, 9 deletions
diff --git a/net/mldonkey/Makefile b/net/mldonkey/Makefile index e5e68a2fcc4..62ccfa6587a 100644 --- a/net/mldonkey/Makefile +++ b/net/mldonkey/Makefile @@ -1,13 +1,19 @@ -# $NetBSD: Makefile,v 1.40 2006/05/30 19:25:59 wiz Exp $ +# $NetBSD: Makefile,v 1.41 2006/08/10 11:35:26 jmmv Exp $ # .include "Makefile.common" +PKGREVISION= 1 + RCD_SCRIPTS= mldonkey BUILD_DEFS+= MLDONKEY_GROUP MLDONKEY_HOME MLDONKEY_USER OWN_DIRS_PERMS= ${MLDONKEY_HOME} ${MLDONKEY_USER} ${MLDONKEY_GROUP} 0700 +OWN_DIRS_PERMS+= ${VARBASE}/log/mldonkey \ + ${MLDONKEY_USER} ${MLDONKEY_GROUP} 0700 +OWN_DIRS_PERMS+= ${VARBASE}/run/mldonkey \ + ${MLDONKEY_USER} ${MLDONKEY_GROUP} 0700 PKG_GROUPS= ${MLDONKEY_GROUP} PKG_USERS= ${MLDONKEY_USER}:${MLDONKEY_GROUP} diff --git a/net/mldonkey/files/mldonkey.sh b/net/mldonkey/files/mldonkey.sh index a1d7f543240..a25ede20171 100644 --- a/net/mldonkey/files/mldonkey.sh +++ b/net/mldonkey/files/mldonkey.sh @@ -1,6 +1,6 @@ #!@RCD_SCRIPTS_SHELL@ # -# $NetBSD: mldonkey.sh,v 1.6 2006/02/27 22:51:22 wiz Exp $ +# $NetBSD: mldonkey.sh,v 1.7 2006/08/10 11:35:26 jmmv Exp $ # # KEYWORD: shutdown # PROVIDE: mldonkey @@ -11,14 +11,18 @@ if [ -f /etc/rc.subr ]; then . /etc/rc.subr fi +: ${mldonkey_group=@MLDONKEY_GROUP@} +: ${mldonkey_home=@MLDONKEY_HOME@} +: ${mldonkey_logdir=@VARBASE@/log/mldonkey} +: ${mldonkey_rundir=@VARBASE@/run/mldonkey} +: ${mldonkey_user=@MLDONKEY_USER@} + name="mldonkey" rcvar=${name} command="@PREFIX@/libexec/mldonkey/mlnet" -command_args=">@MLDONKEY_HOME@/log 2>&1 &" -required_dirs="@MLDONKEY_HOME@" -mldonkey_chdir="@MLDONKEY_HOME@" -mldonkey_group="@MLDONKEY_GROUP@" -mldonkey_user="@MLDONKEY_USER@" +command_args="-pid ${mldonkey_rundir} >${mldonkey_logdir}/mlnet.log 2>&1 &" +pidfile="${mldonkey_rundir}/mlnet.pid" +required_dirs="${mldonkey_home}" start_cmd="mldonkey_start" mldonkey_start() { @@ -27,8 +31,22 @@ mldonkey_start() { else @ECHO@ " ${name}" fi - @SU@ -l ${mldonkey_user} \ - -c "${command} ${mldonkey_flags} ${command_args}" + + if [ ! -d ${mldonkey_logdir} ]; then + mkdir -p ${mldonkey_logdir} + chown ${mldonkey_user}:${mldonkey_group} ${mldonkey_logdir} + chmod 0700 ${mldonkey_logdir} + fi + + if [ ! -d ${mldonkey_rundir} ]; then + mkdir -p ${mldonkey_rundir} + chown ${mldonkey_user}:${mldonkey_group} ${mldonkey_rundir} + chmod 0700 ${mldonkey_rundir} + fi + + @SU@ -l ${mldonkey_user} -c \ + "HOME=${mldonkey_home} \ + ${command} ${mldonkey_flags} ${command_args}" } if [ -f /etc/rc.subr ]; then |