diff options
author | Jon Hood <squinky86@gentoo.org> | 2004-07-15 14:51:53 +0000 |
---|---|---|
committer | Jon Hood <squinky86@gentoo.org> | 2004-07-15 14:51:53 +0000 |
commit | 7f7ded88d99f4e0e324cc77961c9c43b06cb5060 (patch) | |
tree | 8c7954b4da085d23379478bd74aaf70beafd8d8a /net-p2p | |
parent | fix depend, the junit tests depend on a 1.4 jdk (diff) | |
download | historical-7f7ded88d99f4e0e324cc77961c9c43b06cb5060.tar.gz historical-7f7ded88d99f4e0e324cc77961c9c43b06cb5060.tar.bz2 historical-7f7ded88d99f4e0e324cc77961c9c43b06cb5060.zip |
more prettiful init script
Diffstat (limited to 'net-p2p')
-rw-r--r-- | net-p2p/mldonkey/ChangeLog | 6 | ||||
-rw-r--r-- | net-p2p/mldonkey/Manifest | 4 | ||||
-rw-r--r-- | net-p2p/mldonkey/files/mldonkey | 127 |
3 files changed, 123 insertions, 14 deletions
diff --git a/net-p2p/mldonkey/ChangeLog b/net-p2p/mldonkey/ChangeLog index e9abcb6f98ca..ab5d8c635168 100644 --- a/net-p2p/mldonkey/ChangeLog +++ b/net-p2p/mldonkey/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for net-p2p/mldonkey # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.52 2004/07/06 20:49:20 squinky86 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.53 2004/07/15 14:51:53 squinky86 Exp $ + + 15 Jul 2004; Jon Hood <squinky86@gentoo.org> files/mldonkey: + fix mldonkey init script for more options; thanks to Matthias Bernges + <matthiasbernges@gmx.de> for the updates *mldonkey-2.5.16-r7 (06 Jul 2004) diff --git a/net-p2p/mldonkey/Manifest b/net-p2p/mldonkey/Manifest index 1a172062184c..88f0ad9103fc 100644 --- a/net-p2p/mldonkey/Manifest +++ b/net-p2p/mldonkey/Manifest @@ -4,7 +4,7 @@ MD5 e021922395e2c4fbf1a65ced0cf265a7 mldonkey-2.5.16-r6.ebuild 2627 MD5 6de0958f42d8a8c43b6074854be3d8e7 mldonkey-2.5.21-r2.ebuild 2667 MD5 13a5fae860b36a1d719929a30ce11fb7 mldonkey-2.5.16-r5.ebuild 2600 MD5 d5ec56cf36a14c96cd96a0ee7916c90d mldonkey-2.5.21-r1.ebuild 2693 -MD5 03b3498839cb16260579928e26430519 ChangeLog 9203 +MD5 021623bd1f5494ef02e6de5129498ba6 ChangeLog 9382 MD5 74e4ceef69a9fc3a7a76299e5f4d2ed8 metadata.xml 307 MD5 476ec69e79e7c93a7bdaa6cb049c0857 files/mldonkey.confd 836 MD5 d9e7f6261a7e566c4e24f870678a8e8b files/mldonkey.initd 1910 @@ -18,5 +18,5 @@ MD5 f145ba120c09f53b0032ea8b3f930128 files/digest-mldonkey-2.5.21-r2 126 MD5 d68e3759e1f0f2f9a295bbf0a1c30f6b files/mldonkey-2.5.16-16g.patch 92755 MD5 be0c71929c461b50601e8715706a4a16 files/mldonkey-2.5.21-configure.patch 540 MD5 3127e746056c13574b2509e71bc074b5 files/97mldonkey 42 -MD5 ac93ed074d62909b2a496045f0740127 files/mldonkey 336 +MD5 9d632d54e4484981f81a2a912272f57e files/mldonkey 2543 MD5 be0c71929c461b50601e8715706a4a16 files/mldonkey-2.5.16-configure.patch 540 diff --git a/net-p2p/mldonkey/files/mldonkey b/net-p2p/mldonkey/files/mldonkey index 6a407cd64679..84aa9b3db367 100644 --- a/net-p2p/mldonkey/files/mldonkey +++ b/net-p2p/mldonkey/files/mldonkey @@ -1,15 +1,120 @@ -#!/bin/sh +#!/sbin/runscript -. /etc/conf.d/mldonkey +opts="start stop restart slow fast info" -if [ ! -d ${HOME}/.mldonkey ] ; then - echo "Creating subdirectory \".mldonkey\" in your home" - echo "to store config files and downloaded files..." - - if ! mkdir ${HOME}/.mldonkey ; then - echo "Creation of subdirectory failed! Exiting..." - exit 1 +depend() { + need net +} + +start() { + ebegin "Starting mldonkey" + if [ ! -d ${BASEDIR}/${SUBDIR} ] + then + einfo "Directory ${BASEDIR}/${SUBDIR} not existing, trying to create..." + su ${USER} -c "mkdir ${BASEDIR}/${SUBDIR}" + if [ ! -d ${BASEDIR}/${SUBDIR} ] + then + eerror "Directory ${BASEDIR}/${SUBDIR} could not be created!" + return 1 + fi + einfo "...ok!" + fi + cd ${BASEDIR}/${SUBDIR}/ + env HOME=${BASEDIR} start-stop-daemon --quiet --start -c ${USER} \ + -x /usr/bin/mlnet &>${LOG} & + sleep 5 + if ! pgrep -u ${USER} mlnet >/dev/null + then + eerror "MLDonkey could not be started! Check logfile: ${LOG}" + fi + renice ${NICE} -u ${USER} >/dev/null + eend $? +} + +stop() { + BASE="http://" + if [[ -n ${USERNAME} && -n ${PASSWORD} ]] + then + BASE=${BASE}${USERNAME}:${PASSWORD}@ + fi + BASE=${BASE}${SERVER}:${PORT} + ebegin "Stopping mldonkey - please wait" + wget --spider ${BASE}/submit?q=close_fds -q + wget --spider ${BASE}/submit?q=save -q + wget --spider ${BASE}/submit?q=kill -q + sleep 10 + start-stop-daemon --oknodo --stop -x /usr/bin/mlnet &>/dev/null + eend $? +} + +restart() { + svc_stop + sleep 5 + svc_start +} + +slow() { + if ! service_started mldonkey + then + start_service mldonkey + fi + ebegin "Reducing bandwidth to ${LOW_DOWN}k/${LOW_UP}k" + + BASE="http://" + if [[ -n ${USERNAME} && -n ${PASSWORD} ]] + then + BASE=${BASE}${USERNAME}:${PASSWORD}@ + fi + BASE=${BASE}${SERVER}:${PORT} + + wget --spider ${BASE}/submit?q=set+max_hard_download_rate+${LOW_DOWN} -q + + wget --spider ${BASE}/submit?q=set+max_hard_upload_rate+${LOW_UP} -q + + eend $? +} + +fast() { + if ! service_started mldonkey + then + start_service mldonkey fi -fi + ebegin "Increasing bandwidth to ${HIGH_DOWN}k/${HIGH_UP}k" + + BASE="http://" + if [[ -n ${USERNAME} && -n ${PASSWORD} ]] + then + BASE=${BASE}${USERNAME}:${PASSWORD}@ + fi + BASE=${BASE}${SERVER}:${PORT} + + wget --spider ${BASE}/submit?q=set+max_hard_download_rate+${HIGH_DOWN} -q -cd ${HOME}/.mldonkey && exec /usr/bin/mlnet + wget --spider ${BASE}/submit?q=set+max_hard_upload_rate+${HIGH_UP} -q + + eend $? +} + + +info() { + if service_started mldonkey + then + BASE="http://" + if [[ -n ${USERNAME} && -n ${PASSWORD} ]] + then + BASE=${BASE}${USERNAME}:${PASSWORD}@ + fi + + BASE=${BASE}${SERVER}:${PORT} + VALUE=$(/usr/bin/wget -O - ${BASE}/submit?q=vo 2> /dev/null| /bin/grep -C1 max_hard_upload|/usr/bin/tail -n 1|/bin/cut -d\" -f2) + if [[ ${VALUE} -eq ${LOW_UP} ]] + then + INFO="mldonkey runs slow" + else + INFO="mldonkey runs fast" + fi + else + INFO="mldonkey is not running" + fi + einfo "$INFO" +} |