diff --git a/net-p2p/mldonkey-devel/Makefile b/net-p2p/mldonkey-devel/Makefile index ea7abb1ed87a..141026cf3465 100644 --- a/net-p2p/mldonkey-devel/Makefile +++ b/net-p2p/mldonkey-devel/Makefile @@ -7,6 +7,7 @@ PORTNAME= mldonkey PORTVERSION= 2.6.4 +PORTREVISION= 1 CATEGORIES+= net MASTER_SITES= ${MASTER_SITE_SAVANNAH} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -22,6 +23,7 @@ CONFLICTS= mldonkey-[0-9]* USE_BZIP2= yes USE_ICONV= yes +USE_RC_SUBR= yes WANT_AUTOCONF_VER= 259 USE_REINPLACE= yes GNU_CONFIGURE= yes @@ -113,6 +115,9 @@ post-patch: @${REINPLACE_CMD} -E \ -e 's|%%AUTOCONF%%|${AUTOCONF}|' \ ${BUILD_WRKSRC}/config/Makefile.in +# rc.d + @${SED} -e "s|%%PREFIX%%|${PREFIX}|" \ + ${FILESDIR}/mlnet.sh > ${WRKDIR}/mlnet.sh pre-configure: cd ${WRKSRC}/config && ${AUTOCONF} @@ -154,6 +159,9 @@ do-install: @${INSTALL_DATA} ${WRKSRC}/distrib/${file} ${DOCSDIR} .endfor .endif +# rc.d + @${INSTALL_SCRIPT} ${WRKDIR}/mlnet.sh \ + ${PREFIX}/etc/rc.d post-install: @${CAT} ${PKGMESSAGE} diff --git a/net-p2p/mldonkey-devel/files/mlnet.in b/net-p2p/mldonkey-devel/files/mlnet.in new file mode 100644 index 000000000000..82edeb6d8272 --- /dev/null +++ b/net-p2p/mldonkey-devel/files/mlnet.in @@ -0,0 +1,59 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira + +# PROVIDE: mlnet +# REQUIRE: LOGIN +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable mlnet: +# +#mlnet_enable="YES" +#mlnet_user="" +#mlnet_logfile="" +# + +. /etc/rc.subr + +name="mlnet" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/mlnet" +procname="%%PREFIX%%/bin/mlnet-real" + +## hardcoded, cannot override +mlnet_pidfile="${HOME}/.mldonkey/mlnet.pid" + +mlnet_check_vars() +{ + if [ -z "${mlnet_user}" ]; then + mlnet_user=$(whoami) + fi + + if [ "x${mlnet_user}" = "xroot" ]; then + err 1 "You have to set mlnet_user to a non-root user for security reasons" + fi +} + +start_cmd="start_cmd" +start_cmd() +{ + mlnet_check_vars + if [ -n "${mlnet_logfile}" ]; then + mlnet_logcommand="-log_file ${mlnet_logfile}" + fi + + su -l ${mlnet_user} -c "${command} \ + ${mlnet_logcommand} \ + ${mlnet_flags} \ + >/dev/null &" +} + +load_rc_config "${name}" +: ${mlnet_enable="NO"} +: ${mlnet_user=""} +: ${mlnet_logfile=""} + +run_rc_command "$1" diff --git a/net-p2p/mldonkey-devel/files/mlnet.sh b/net-p2p/mldonkey-devel/files/mlnet.sh new file mode 100644 index 000000000000..82edeb6d8272 --- /dev/null +++ b/net-p2p/mldonkey-devel/files/mlnet.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira + +# PROVIDE: mlnet +# REQUIRE: LOGIN +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable mlnet: +# +#mlnet_enable="YES" +#mlnet_user="" +#mlnet_logfile="" +# + +. /etc/rc.subr + +name="mlnet" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/mlnet" +procname="%%PREFIX%%/bin/mlnet-real" + +## hardcoded, cannot override +mlnet_pidfile="${HOME}/.mldonkey/mlnet.pid" + +mlnet_check_vars() +{ + if [ -z "${mlnet_user}" ]; then + mlnet_user=$(whoami) + fi + + if [ "x${mlnet_user}" = "xroot" ]; then + err 1 "You have to set mlnet_user to a non-root user for security reasons" + fi +} + +start_cmd="start_cmd" +start_cmd() +{ + mlnet_check_vars + if [ -n "${mlnet_logfile}" ]; then + mlnet_logcommand="-log_file ${mlnet_logfile}" + fi + + su -l ${mlnet_user} -c "${command} \ + ${mlnet_logcommand} \ + ${mlnet_flags} \ + >/dev/null &" +} + +load_rc_config "${name}" +: ${mlnet_enable="NO"} +: ${mlnet_user=""} +: ${mlnet_logfile=""} + +run_rc_command "$1" diff --git a/net-p2p/mldonkey-devel/pkg-plist b/net-p2p/mldonkey-devel/pkg-plist index a2ce1f94ec95..f2445bae30a7 100644 --- a/net-p2p/mldonkey-devel/pkg-plist +++ b/net-p2p/mldonkey-devel/pkg-plist @@ -1,3 +1,4 @@ +etc/rc.d/mlnet.sh %%CORE%%bin/kill_mldonkey %%CORE%%bin/mlnet %%CORE%%bin/mlnet-real diff --git a/net/mldonkey-devel/Makefile b/net/mldonkey-devel/Makefile index ea7abb1ed87a..141026cf3465 100644 --- a/net/mldonkey-devel/Makefile +++ b/net/mldonkey-devel/Makefile @@ -7,6 +7,7 @@ PORTNAME= mldonkey PORTVERSION= 2.6.4 +PORTREVISION= 1 CATEGORIES+= net MASTER_SITES= ${MASTER_SITE_SAVANNAH} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -22,6 +23,7 @@ CONFLICTS= mldonkey-[0-9]* USE_BZIP2= yes USE_ICONV= yes +USE_RC_SUBR= yes WANT_AUTOCONF_VER= 259 USE_REINPLACE= yes GNU_CONFIGURE= yes @@ -113,6 +115,9 @@ post-patch: @${REINPLACE_CMD} -E \ -e 's|%%AUTOCONF%%|${AUTOCONF}|' \ ${BUILD_WRKSRC}/config/Makefile.in +# rc.d + @${SED} -e "s|%%PREFIX%%|${PREFIX}|" \ + ${FILESDIR}/mlnet.sh > ${WRKDIR}/mlnet.sh pre-configure: cd ${WRKSRC}/config && ${AUTOCONF} @@ -154,6 +159,9 @@ do-install: @${INSTALL_DATA} ${WRKSRC}/distrib/${file} ${DOCSDIR} .endfor .endif +# rc.d + @${INSTALL_SCRIPT} ${WRKDIR}/mlnet.sh \ + ${PREFIX}/etc/rc.d post-install: @${CAT} ${PKGMESSAGE} diff --git a/net/mldonkey-devel/files/mlnet.sh b/net/mldonkey-devel/files/mlnet.sh new file mode 100644 index 000000000000..82edeb6d8272 --- /dev/null +++ b/net/mldonkey-devel/files/mlnet.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira + +# PROVIDE: mlnet +# REQUIRE: LOGIN +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable mlnet: +# +#mlnet_enable="YES" +#mlnet_user="" +#mlnet_logfile="" +# + +. /etc/rc.subr + +name="mlnet" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/mlnet" +procname="%%PREFIX%%/bin/mlnet-real" + +## hardcoded, cannot override +mlnet_pidfile="${HOME}/.mldonkey/mlnet.pid" + +mlnet_check_vars() +{ + if [ -z "${mlnet_user}" ]; then + mlnet_user=$(whoami) + fi + + if [ "x${mlnet_user}" = "xroot" ]; then + err 1 "You have to set mlnet_user to a non-root user for security reasons" + fi +} + +start_cmd="start_cmd" +start_cmd() +{ + mlnet_check_vars + if [ -n "${mlnet_logfile}" ]; then + mlnet_logcommand="-log_file ${mlnet_logfile}" + fi + + su -l ${mlnet_user} -c "${command} \ + ${mlnet_logcommand} \ + ${mlnet_flags} \ + >/dev/null &" +} + +load_rc_config "${name}" +: ${mlnet_enable="NO"} +: ${mlnet_user=""} +: ${mlnet_logfile=""} + +run_rc_command "$1" diff --git a/net/mldonkey-devel/pkg-plist b/net/mldonkey-devel/pkg-plist index a2ce1f94ec95..f2445bae30a7 100644 --- a/net/mldonkey-devel/pkg-plist +++ b/net/mldonkey-devel/pkg-plist @@ -1,3 +1,4 @@ +etc/rc.d/mlnet.sh %%CORE%%bin/kill_mldonkey %%CORE%%bin/mlnet %%CORE%%bin/mlnet-real