diff options
author | lioux <lioux@FreeBSD.org> | 2006-02-16 07:23:07 +0800 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2006-02-16 07:23:07 +0800 |
commit | d2b9c90ae1d4095f2543ca026e1d641276a13336 (patch) | |
tree | b99f4b96ed16dd0cf7b3653e91e05a3a74acccd5 /net-p2p | |
parent | 20480fa6a08a27420825c1ab02271f720c04f6c8 (diff) | |
download | freebsd-ports-gnome-d2b9c90ae1d4095f2543ca026e1d641276a13336.tar.gz freebsd-ports-gnome-d2b9c90ae1d4095f2543ca026e1d641276a13336.tar.zst freebsd-ports-gnome-d2b9c90ae1d4095f2543ca026e1d641276a13336.zip |
o Improve rcng script by adding mlnet_flags option
o Make sure that rc_command stop actually works by fixing pidfile
variable
o Bump PORTREVISION
Diffstat (limited to 'net-p2p')
-rw-r--r-- | net-p2p/mldonkey-devel/Makefile | 2 | ||||
-rw-r--r-- | net-p2p/mldonkey-devel/files/mlnet.in | 40 | ||||
-rw-r--r-- | net-p2p/mldonkey-devel/files/mlnet.sh | 40 |
3 files changed, 51 insertions, 31 deletions
diff --git a/net-p2p/mldonkey-devel/Makefile b/net-p2p/mldonkey-devel/Makefile index 58bdabac17b4..6123bcbdec24 100644 --- a/net-p2p/mldonkey-devel/Makefile +++ b/net-p2p/mldonkey-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= mldonkey PORTVERSION= 2.7.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES+= net-p2p MASTER_SITES= ${MASTER_SITE_SAVANNAH} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/net-p2p/mldonkey-devel/files/mlnet.in b/net-p2p/mldonkey-devel/files/mlnet.in index 82edeb6d8272..f03ef1e46de3 100644 --- a/net-p2p/mldonkey-devel/files/mlnet.in +++ b/net-p2p/mldonkey-devel/files/mlnet.in @@ -13,6 +13,7 @@ # #mlnet_enable="YES" #mlnet_user="" +#mlnet_flags="" #mlnet_logfile="" # @@ -20,40 +21,49 @@ name="mlnet" rcvar=`set_rcvar` -command="%%PREFIX%%/bin/mlnet" -procname="%%PREFIX%%/bin/mlnet-real" +command="%%PREFIX%%/bin/${name}" +procname="%%PREFIX%%/bin/${name}-real" -## hardcoded, cannot override -mlnet_pidfile="${HOME}/.mldonkey/mlnet.pid" +load_rc_config "${name}" +: ${mlnet_enable="NO"} +: ${mlnet_user="$(whoami)"} +: ${mlnet_flags=""} +: ${mlnet_logfile=""} + +pidfile="$(eval echo ~${mlnet_user}/.mldonkey/$(basename ${procname}).pid)" +required_dirs="$(eval echo ~${mlnet_user})" 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" + warn "You have to set mlnet_user to a non-root user for security reasons" + return 1 fi + + return 0 } +start_precmd="mlnet_check_vars" 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} \ + if [ "x${mlnet_user}" = "x$(whoami)" ]; then + eval "${command} \ ${mlnet_logcommand} \ ${mlnet_flags} \ >/dev/null &" + else + su -l ${mlnet_user} -c "${command} \ + ${mlnet_logcommand} \ + ${mlnet_flags} \ + >/dev/null &" + fi } -load_rc_config "${name}" -: ${mlnet_enable="NO"} -: ${mlnet_user=""} -: ${mlnet_logfile=""} +stop_precmd="mlnet_check_vars" run_rc_command "$1" diff --git a/net-p2p/mldonkey-devel/files/mlnet.sh b/net-p2p/mldonkey-devel/files/mlnet.sh index 82edeb6d8272..f03ef1e46de3 100644 --- a/net-p2p/mldonkey-devel/files/mlnet.sh +++ b/net-p2p/mldonkey-devel/files/mlnet.sh @@ -13,6 +13,7 @@ # #mlnet_enable="YES" #mlnet_user="" +#mlnet_flags="" #mlnet_logfile="" # @@ -20,40 +21,49 @@ name="mlnet" rcvar=`set_rcvar` -command="%%PREFIX%%/bin/mlnet" -procname="%%PREFIX%%/bin/mlnet-real" +command="%%PREFIX%%/bin/${name}" +procname="%%PREFIX%%/bin/${name}-real" -## hardcoded, cannot override -mlnet_pidfile="${HOME}/.mldonkey/mlnet.pid" +load_rc_config "${name}" +: ${mlnet_enable="NO"} +: ${mlnet_user="$(whoami)"} +: ${mlnet_flags=""} +: ${mlnet_logfile=""} + +pidfile="$(eval echo ~${mlnet_user}/.mldonkey/$(basename ${procname}).pid)" +required_dirs="$(eval echo ~${mlnet_user})" 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" + warn "You have to set mlnet_user to a non-root user for security reasons" + return 1 fi + + return 0 } +start_precmd="mlnet_check_vars" 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} \ + if [ "x${mlnet_user}" = "x$(whoami)" ]; then + eval "${command} \ ${mlnet_logcommand} \ ${mlnet_flags} \ >/dev/null &" + else + su -l ${mlnet_user} -c "${command} \ + ${mlnet_logcommand} \ + ${mlnet_flags} \ + >/dev/null &" + fi } -load_rc_config "${name}" -: ${mlnet_enable="NO"} -: ${mlnet_user=""} -: ${mlnet_logfile=""} +stop_precmd="mlnet_check_vars" run_rc_command "$1" |