From 3d20ecdb2f528fa4c1adae3c7b4416ffd51638bb Mon Sep 17 00:00:00 2001 From: Karol Wojtaszek Date: Wed, 6 Dec 2006 22:47:38 +0000 Subject: [PATCH] Fixed mldonkey init script to work with new mldonkey-2.8.2, bug #157242 Package-Manager: portage-2.1.2_pre2-r7 --- net-p2p/mldonkey/ChangeLog | 6 +- net-p2p/mldonkey/Manifest | 26 +++-- net-p2p/mldonkey/files/mldonkey.initd-2.8 | 135 ++++++++++++++++++++++ net-p2p/mldonkey/mldonkey-2.8.2.ebuild | 4 +- 4 files changed, 157 insertions(+), 14 deletions(-) create mode 100644 net-p2p/mldonkey/files/mldonkey.initd-2.8 diff --git a/net-p2p/mldonkey/ChangeLog b/net-p2p/mldonkey/ChangeLog index b3483e43376b..6e1f6c094946 100644 --- a/net-p2p/mldonkey/ChangeLog +++ b/net-p2p/mldonkey/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for net-p2p/mldonkey # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.132 2006/12/02 19:24:28 sekretarz Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.133 2006/12/06 22:47:37 sekretarz Exp $ + + 07 Dec 2006; Karol Wojtaszek + +files/mldonkey.initd-2.8, mldonkey-2.8.2.ebuild: + Fixed mldonkey init script to work with new mldonkey-2.8.2, bug #157242 *mldonkey-2.8.2 (02 Dec 2006) diff --git a/net-p2p/mldonkey/Manifest b/net-p2p/mldonkey/Manifest index 594cde866ebb..2c44686d637b 100644 --- a/net-p2p/mldonkey/Manifest +++ b/net-p2p/mldonkey/Manifest @@ -29,6 +29,10 @@ AUX mldonkey.initd 3063 RMD160 66992e16a26f288ee9aaa3432b2e5739e977401a SHA1 67f MD5 39035eb38db4becb71b58945466eeb95 files/mldonkey.initd 3063 RMD160 66992e16a26f288ee9aaa3432b2e5739e977401a files/mldonkey.initd 3063 SHA256 f6568c0e5cc4a6406662d8bef51271b4c785b49081dcb1bb5e2661dc5f835055 files/mldonkey.initd 3063 +AUX mldonkey.initd-2.8 3064 RMD160 dc786b129a6d08f7f0b7fc9267b664bc266d6b0b SHA1 bca5aaab25d1d8661b4ac4ea64b0013da0bf470a SHA256 2bf1cf0225564ab189c6737a66b2df61b7e0585038b43ad5d3302ce8dbbd6088 +MD5 2f3832b13fb1b89eca797146349d1f69 files/mldonkey.initd-2.8 3064 +RMD160 dc786b129a6d08f7f0b7fc9267b664bc266d6b0b files/mldonkey.initd-2.8 3064 +SHA256 2bf1cf0225564ab189c6737a66b2df61b7e0585038b43ad5d3302ce8dbbd6088 files/mldonkey.initd-2.8 3064 AUX mldonkey.png 6835 RMD160 2ef0cbc5be4de95893b43da0281bd52f5aabb314 SHA1 bf61199ffd324558f49940a5ca6a68a36f4656b2 SHA256 c16ecc040b5ea82ed06b04a76c5d7304d7aca2f0854176aa8d78aa90831d8798 MD5 855aedd7fba1ffe74d7f6c0bce98f45f files/mldonkey.png 6835 RMD160 2ef0cbc5be4de95893b43da0281bd52f5aabb314 files/mldonkey.png 6835 @@ -61,14 +65,14 @@ EBUILD mldonkey-2.7.7.ebuild 4467 RMD160 be7e3ed8eb927676b6e3c9f08be7bfe08034697 MD5 267ffcdbe7693de4ad72ced261524758 mldonkey-2.7.7.ebuild 4467 RMD160 be7e3ed8eb927676b6e3c9f08be7bfe080346977 mldonkey-2.7.7.ebuild 4467 SHA256 53616cee7b3fdbd46b2f5c737fb76546143c4ffe04361b0f1949fc92fbc1efd6 mldonkey-2.7.7.ebuild 4467 -EBUILD mldonkey-2.8.2.ebuild 4596 RMD160 2e5c047e9c2688ef7fa3e96536123c6fea8149e6 SHA1 cf1b0c604330b15f2886b15ccb27c2cea1495743 SHA256 de6f2d4f8af1e0f74fe9e12888d18ee20aeaa6528163f81b41e86d8143b11d9a -MD5 0723d56c242ea1c821b0d30b0a79cc28 mldonkey-2.8.2.ebuild 4596 -RMD160 2e5c047e9c2688ef7fa3e96536123c6fea8149e6 mldonkey-2.8.2.ebuild 4596 -SHA256 de6f2d4f8af1e0f74fe9e12888d18ee20aeaa6528163f81b41e86d8143b11d9a mldonkey-2.8.2.ebuild 4596 -MISC ChangeLog 21694 RMD160 ed5c80c575ab5bd25a6b612332b8234b5d9c67a0 SHA1 e941f4319f297627a05f00b2c5378738033c714f SHA256 00a36a84d56d2da06cac64d8f68895ccff3a1907651e7b50676b607bdb0d6deb -MD5 9c434322533815685c61f3e1370c78d8 ChangeLog 21694 -RMD160 ed5c80c575ab5bd25a6b612332b8234b5d9c67a0 ChangeLog 21694 -SHA256 00a36a84d56d2da06cac64d8f68895ccff3a1907651e7b50676b607bdb0d6deb ChangeLog 21694 +EBUILD mldonkey-2.8.2.ebuild 4602 RMD160 8a6e64088e2c86fab474089d767985a5f91eeed3 SHA1 45f96cdd8c3d572b1fc72d95d4276a458b26303f SHA256 ba707eb5a085eb4ae7c3d61b58b7a0cec5d2d340d22450922f22f3a4ee79ef31 +MD5 35057848aee18f2370eab075a510794f mldonkey-2.8.2.ebuild 4602 +RMD160 8a6e64088e2c86fab474089d767985a5f91eeed3 mldonkey-2.8.2.ebuild 4602 +SHA256 ba707eb5a085eb4ae7c3d61b58b7a0cec5d2d340d22450922f22f3a4ee79ef31 mldonkey-2.8.2.ebuild 4602 +MISC ChangeLog 21875 RMD160 4d6e3ca36c93e56af0df348516cedb34af0a8dcd SHA1 54b73360845dc09c510ff1cd3f891be884c9b17d SHA256 c1b1b5eaeedff847565567c3682bb32f8bacf1589049341d42d39ae53ed76ad9 +MD5 73f713da7e39b9e08b34f0dd365d0280 ChangeLog 21875 +RMD160 4d6e3ca36c93e56af0df348516cedb34af0a8dcd ChangeLog 21875 +SHA256 c1b1b5eaeedff847565567c3682bb32f8bacf1589049341d42d39ae53ed76ad9 ChangeLog 21875 MISC metadata.xml 242 RMD160 d0edc89382298dee00d3571b62a5f457ef268751 SHA1 25511186cac54f1353a3347f72da7f5d05b9da57 SHA256 b354d71d5efbed0ff97e27564894438b42a8bd8b577007cadc6972dd37d6b5f8 MD5 ee159929f3e247f937fe88bb1919d8bd metadata.xml 242 RMD160 d0edc89382298dee00d3571b62a5f457ef268751 metadata.xml 242 @@ -94,7 +98,7 @@ SHA256 cdb85c503837b524df40852095c65b6fe6211fdc48b803c4da5a92554e6286a1 files/di -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) -iD8DBQFFcfKWub4+zaPCR/oRAnEEAKCCmavTH74YMzpm9bh8HzLSWNT5twCeKjqX -DVyL+xxEQGSmGK/YMCECXi8= -=DcpI +iD8DBQFFd2hfub4+zaPCR/oRAupJAJ0Z8fWiGyuGAc1aKXe5NzEnkhKYkACfQfe5 +YD/AN9iixe1m+k49hWlHRXg= +=w54+ -----END PGP SIGNATURE----- diff --git a/net-p2p/mldonkey/files/mldonkey.initd-2.8 b/net-p2p/mldonkey/files/mldonkey.initd-2.8 new file mode 100644 index 000000000000..e3f8548a9f8a --- /dev/null +++ b/net-p2p/mldonkey/files/mldonkey.initd-2.8 @@ -0,0 +1,135 @@ +#!/sbin/runscript + +opts="start stop restart slow fast info" + +depend() { + need net +} + +start() { + ebegin "Starting mldonkey" + result=0 + + if [ -z "${MLDONKEY_DIR}" ]; then + ewarn "mldonkey's start script has been changed. You should remove" + ewarn "BASEDIR and SUBDIR from /etc/conf.d/mldonkey and set MLDONKEY_DIR" + ewarn "to the correct value (you probably want" + ewarn "MLDONKEY_DIR=${BASEDIR}/${SUBDIR})" + MLDONKEY_DIR=${BASEDIR}/${SUBDIR} + einfo "Using ${MLDONKEY_DIR} as working directory" + fi + + if [ ! -d ${MLDONKEY_DIR} ]; then + einfo "Directory ${MLDONKEY_DIR} not existing, trying to create..." + if `mkdir -p ${MLDONKEY_DIR} 2>/dev/null`; then + chown ${USER}:users ${MLDONKEY_DIR} + else + eerror "Directory ${MLDONKEY_DIR} could not be created!" + ((result++)) + fi + fi + + cd ${MLDONKEY_DIR} + env MLDONKEY_DIR=${MLDONKEY_DIR} start-stop-daemon --quiet --start \ + -c ${USER} -N ${NICE} -x /usr/bin/mlnet &>${LOG} & + sleep 5 + if ! pgrep -u ${USER} mlnet >/dev/null + then + eerror "MLDonkey could not be started! Check logfile: ${LOG}" + ((result++)) + fi + eend $result +} + +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 + # give it a chance to die: + local timeout=10 + while [ $timeout -gt 0 ] && pgrep -u ${USER} mlnet &>/dev/null; do + sleep 1 + let 'timeout--' + done + 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 + 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 + + 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|/bin/grep value=\" |/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" +} diff --git a/net-p2p/mldonkey/mldonkey-2.8.2.ebuild b/net-p2p/mldonkey/mldonkey-2.8.2.ebuild index 4e3b6149b9d0..19af6c80fbc4 100644 --- a/net-p2p/mldonkey/mldonkey-2.8.2.ebuild +++ b/net-p2p/mldonkey/mldonkey-2.8.2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/mldonkey-2.8.2.ebuild,v 1.1 2006/12/02 19:24:28 sekretarz Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/mldonkey-2.8.2.ebuild,v 1.2 2006/12/06 22:47:37 sekretarz Exp $ inherit flag-o-matic @@ -110,7 +110,7 @@ src_install() { dobin ${FILESDIR}/mldonkey insinto /etc/conf.d; newins ${FILESDIR}/mldonkey.confd mldonkey - exeinto /etc/init.d; newexe ${FILESDIR}/mldonkey.initd mldonkey + exeinto /etc/init.d; newexe "${FILESDIR}/mldonkey.initd-2.8" mldonkey fi if use gtk; then -- 2.26.2