summaryrefslogtreecommitdiff
path: root/net-p2p/mldonkey/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-p2p/mldonkey/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-p2p/mldonkey/files')
-rw-r--r--net-p2p/mldonkey/files/mldonkey.confd-2.839
-rw-r--r--net-p2p/mldonkey/files/mldonkey.initd121
-rw-r--r--net-p2p/mldonkey/files/ocaml-4.03.patch145
-rw-r--r--net-p2p/mldonkey/files/ocaml4.patch12
4 files changed, 317 insertions, 0 deletions
diff --git a/net-p2p/mldonkey/files/mldonkey.confd-2.8 b/net-p2p/mldonkey/files/mldonkey.confd-2.8
new file mode 100644
index 000000000000..1d1f282234f7
--- /dev/null
+++ b/net-p2p/mldonkey/files/mldonkey.confd-2.8
@@ -0,0 +1,39 @@
+# /etc/conf.d/mldonkey
+# Config file for mldonkey control script
+
+# Change the following vars only if you know
+# what you're doing, there's no checking for
+# invalid data yet!
+
+# owner of mlnet process (don't change, must be existing)
+USER="p2p"
+
+# mldonkey's working dir (must be existing)
+MLDONKEY_DIR="/home/p2p/mldonkey"
+
+# logfile (/dev/null for nowhere)
+LOG="/var/log/mldonkey.log"
+
+# set to true, if you have enabled logging to syslog in MLDonkey with
+# set log_to_syslog true
+USE_LOGGER=false
+
+# bandwidth control, values in kb/s
+LOW_DOWN="6"
+LOW_UP="2"
+HIGH_DOWN="30"
+HIGH_UP="10"
+
+# nice level, 0<x<19, more nice -> less cpuspeed consumed
+NICE="19"
+
+# mldonkey server ip, usually localhost
+SERVER="localhost"
+
+# port for webinterface, usually 4080
+PORT="4080"
+
+# to enable password restricted access,
+# uncomment and set BOTH following vars:
+#USERNAME="admin"
+#PASSWORD=""
diff --git a/net-p2p/mldonkey/files/mldonkey.initd b/net-p2p/mldonkey/files/mldonkey.initd
new file mode 100644
index 000000000000..12dd599de7be
--- /dev/null
+++ b/net-p2p/mldonkey/files/mldonkey.initd
@@ -0,0 +1,121 @@
+#!/sbin/openrc-run
+
+extra_started_commands="reload slow fast info"
+
+MLDONKEY_BINARY=${MLDONKEY_BINARY:-/usr/bin/mlnet}
+MLDONKEY_TIMEOUT=${TIMEOUT:-10}
+
+depend() {
+ need localmount net
+ ${USE_LOGGER} && use logger
+}
+
+start() {
+ 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
+ ebegin "Directory ${MLDONKEY_DIR} not existing, trying to create..."
+ mkdir -p "${MLDONKEY_DIR}" && chown ${USER}:users "${MLDONKEY_DIR}"
+ eend $? || return 1
+ fi
+
+ ebegin "Starting ${SVCNAME}"
+ cd "${MLDONKEY_DIR}"
+ export MLDONKEY_DIR
+ start-stop-daemon --start --user "${USER}" --nice "${NICE}" \
+ --exec "${MLDONKEY_BINARY}" --pidfile /var/run/"${SVCNAME}".pid \
+ --background --make-pidfile
+ eend $?
+}
+
+setup_uri() {
+ BASE="http://"
+ if [ -n "${USERNAME}" -a -n "${PASSWORD}" ]; then
+ BASE="${BASE}${USERNAME}:${PASSWORD}@"
+ fi
+ BASE="${BASE}${SERVER}:${PORT}"
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME} -- please wait"
+
+ setup_uri
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" "${BASE}"/submit?q=close_fds -q
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" "${BASE}"/submit?q=save -q
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" "${BASE}"/submit?q=kill -q
+
+ # give it a chance to die:
+ local timeout=${MLDONKEY_TIMEOUT}
+ while [ $timeout -gt 0 ]; do
+ if ! start-stop-daemon --test --quiet --stop \
+ --exec "${MLDONKEY_BINARY}" \
+ --pidfile /var/run/"${SVCNAME}".pid ; then
+ eend 0
+ return 0
+ fi
+ sleep 1
+ timeout=$((${timeout} - 1))
+ done
+
+ eend 1 "Failed to cleanly stop ${SVCNAME}"
+ ebegin "Forcing ${SVCNAME} to stop"
+ start-stop-daemon --stop --exec "${MLDONKEY_BINARY}" \
+ --pidfile /var/run/"${SVCNAME}".pid
+ eend $?
+}
+
+# This doesn't work for baselayout-2
+restart() {
+ svc_stop
+ sleep 5
+ svc_start
+}
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --stop --signal HUP --oknodo \
+ --exec "${MLDONKEY_BINARY}" --pidfile /var/run/"${SVCNAME}".pid
+ eend $?
+}
+
+slow() {
+ ebegin "Reducing bandwidth to ${LOW_DOWN}k/${LOW_UP}k"
+ setup_uri
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
+ "${BASE}/submit?q=set+max_hard_download_rate+${LOW_DOWN}" -q
+ wget --spider --timeout=${MLDONKEY_TIMEOUT} \
+ "${BASE}/submit?q=set+max_hard_upload_rate+${LOW_UP}" -q
+ eend $?
+}
+
+fast() {
+ ebegin "Increasing bandwidth to ${HIGH_DOWN}k/${HIGH_UP}k"
+
+ setup_uri
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
+ "${BASE}/submit?q=set+max_hard_upload_rate+${HIGH_UP}" -q
+ wget --spider --timeout="${MLDONKEY_TIMEOUT}" \
+ "${BASE}/submit?q=set+max_hard_download_rate+${HIGH_DOWN}" -q
+ eend $?
+}
+
+
+info() {
+ setup_uri
+ local result=$(wget --timeout="${MLDONKEY_TIMEOUT}" \
+ -O - "${BASE}"/submit?q=vo 2>/dev/null | \
+ grep -C1 max_hard_upload | \
+ grep value=\" | cut -d\" -f2)
+ if [ "${result}" = "${LOW_UP}" ]; then
+ einfo "${SVCNAME} runs slow"
+ else
+ einfo "${SVCNAME} runs fast"
+ fi
+}
diff --git a/net-p2p/mldonkey/files/ocaml-4.03.patch b/net-p2p/mldonkey/files/ocaml-4.03.patch
new file mode 100644
index 000000000000..fce94c851e2d
--- /dev/null
+++ b/net-p2p/mldonkey/files/ocaml-4.03.patch
@@ -0,0 +1,145 @@
+Index: mldonkey-3.1.5/src/config/unix/os_stubs_c.c
+===================================================================
+--- mldonkey-3.1.5.orig/src/config/unix/os_stubs_c.c
++++ mldonkey-3.1.5/src/config/unix/os_stubs_c.c
+@@ -66,7 +66,7 @@ ssize_t os_read(OS_FD fd, char *buf, siz
+
+ void os_ftruncate(OS_FD fd, OFF_T len, /* bool */ int sparse)
+ {
+- int64 cursize;
++ int64_t cursize;
+ if(!fd) failwith("ftruncate32: file is closed");
+
+ cursize = os_getfdsize(fd);
+@@ -109,7 +109,7 @@ int os_getdtablesize()
+
+ *******************************************************************/
+
+-int64 os_getfdsize(OS_FD fd)
++int64_t os_getfdsize(OS_FD fd)
+ {
+ struct stat buf;
+
+@@ -127,7 +127,7 @@ int64 os_getfdsize(OS_FD fd)
+
+ *******************************************************************/
+
+-int64 os_getfilesize(char *path)
++int64_t os_getfilesize(char *path)
+ {
+ struct stat buf;
+
+Index: mldonkey-3.1.5/src/networks/donkey/donkeyGlobals.ml
+===================================================================
+--- mldonkey-3.1.5.orig/src/networks/donkey/donkeyGlobals.ml
++++ mldonkey-3.1.5/src/networks/donkey/donkeyGlobals.ml
+@@ -781,7 +781,6 @@ let set_client_name c name md4 =
+ c.client_md4 <- md4;
+ end
+
+-exception ClientFound of client
+ let find_client_by_name name =
+ try
+ H.iter (fun c ->
+Index: mldonkey-3.1.5/src/utils/cdk/zip.ml
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/cdk/zip.ml
++++ mldonkey-3.1.5/src/utils/cdk/zip.ml
+@@ -72,8 +72,6 @@ type out_file =
+ mutable of_entries: entry list;
+ of_comment: string }
+
+-exception Error of string * string * string
+-
+ (* Return the position of the last occurrence of s1 in s2, or -1 if not
+ found. *)
+
+Index: mldonkey-3.1.5/src/utils/cdk/zlibstubs.c
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/cdk/zlibstubs.c
++++ mldonkey-3.1.5/src/utils/cdk/zlibstubs.c
+@@ -191,7 +191,7 @@ value camlzip_inflateEnd(value vzs)
+
+ value camlzip_update_crc32(value crc, value buf, value pos, value len)
+ {
+- return copy_int32(crc32((uint32) Int32_val(crc),
++ return copy_int32(crc32((uint32_t) Int32_val(crc),
+ &Byte_u(buf, Long_val(pos)),
+ Long_val(len)));
+ }
+Index: mldonkey-3.1.5/src/utils/lib/fst_hash.c
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/lib/fst_hash.c
++++ mldonkey-3.1.5/src/utils/lib/fst_hash.c
+@@ -197,7 +197,7 @@ unsigned short fst_hash_checksum (unsign
+ /*****************************************************************************/
+
+ // hash file
+-int fst_hash_file (unsigned char *fth, char *file, int64 filesize)
++int fst_hash_file (unsigned char *fth, char *file, int64_t filesize)
+ {
+ FILE *fp;
+ unsigned char *buf;
+@@ -271,7 +271,7 @@ int fst_hash_file (unsigned char *fth, c
+ }
+
+
+-void fst_hash_string (unsigned char *fth, unsigned char *file, int64 filesize)
++void fst_hash_string (unsigned char *fth, unsigned char *file, int64_t filesize)
+ {
+ unsigned char * buf = file;
+ size_t len = filesize;
+Index: mldonkey-3.1.5/src/utils/lib/options.ml4
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/lib/options.ml4
++++ mldonkey-3.1.5/src/utils/lib/options.ml4
+@@ -332,7 +332,6 @@ let exit_exn = Exit
+
+
+ let unsafe_get = String.unsafe_get
+-external is_printable : char -> bool = "caml_is_printable"
+ let unsafe_set = String.unsafe_set
+
+ let escaped s =
+@@ -343,7 +342,7 @@ let escaped s =
+ (match unsafe_get s i with
+ '"' | '\\' -> 2
+ | '\n' | '\t' -> 1
+- | c -> if is_printable c then 1 else 4)
++ | c -> 1)
+ done;
+ if !n = String.length s then s
+ else
+@@ -354,16 +353,7 @@ let escaped s =
+ '"' | '\\' as c -> unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
+ | '\n' | '\t' as c -> unsafe_set s' !n c
+ | c ->
+- if is_printable c then unsafe_set s' !n c
+- else
+- let a = int_of_char c in
+- unsafe_set s' !n '\\';
+- incr n;
+- unsafe_set s' !n (char_of_int (48 + a / 100));
+- incr n;
+- unsafe_set s' !n (char_of_int (48 + a / 10 mod 10));
+- incr n;
+- unsafe_set s' !n (char_of_int (48 + a mod 10))
++ unsafe_set s' !n c
+ end;
+ incr n
+ done;
+Index: mldonkey-3.1.5/src/utils/lib/os_stubs.h
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/lib/os_stubs.h
++++ mldonkey-3.1.5/src/utils/lib/os_stubs.h
+@@ -155,8 +155,8 @@ extern OFF_T os_lseek(OS_FD fd, OFF_T po
+ extern void os_ftruncate(OS_FD fd, OFF_T len, int sparse);
+ extern ssize_t os_read(OS_FD fd, char *buf, size_t len);
+ extern int os_getdtablesize();
+-extern int64 os_getfdsize(OS_FD fd);
+-extern int64 os_getfilesize(char *path);
++extern int64_t os_getfdsize(OS_FD fd);
++extern int64_t os_getfilesize(char *path);
+ extern void os_set_nonblock(OS_SOCKET fd);
+ extern void os_uname(char buf[]);
+ extern int os_os_supported();
diff --git a/net-p2p/mldonkey/files/ocaml4.patch b/net-p2p/mldonkey/files/ocaml4.patch
new file mode 100644
index 000000000000..32882417b62c
--- /dev/null
+++ b/net-p2p/mldonkey/files/ocaml4.patch
@@ -0,0 +1,12 @@
+Index: mldonkey-3.1.5/src/utils/net/terminal.ml
+===================================================================
+--- mldonkey-3.1.5.orig/src/utils/net/terminal.ml
++++ mldonkey-3.1.5/src/utils/net/terminal.ml
+@@ -185,7 +185,6 @@ module Output = struct
+ let canal = List.assoc chan !chanmap in
+ etat.chan <- Some (chan, canal);
+ info (sprintf "connecte au canal '%s'" chan);
+- (* {| canal ALL } *)
+ with Not_found -> (* pas encore de recepteur pour ce canal *)
+ try (* on en cree un *)
+ let serveur = nsrecord.get_loc chan in