[Pkg-ocaml-maint-commits] r1453 - in
trunk/packages/mldonkey/trunk/debian: . utils xml-man
Sylvain LE GALL
gildor-guest at costa.debian.org
Sun Jul 17 17:23:09 UTC 2005
Author: gildor-guest
Date: 2005-07-17 17:23:09 +0000 (Sun, 17 Jul 2005)
New Revision: 1453
Modified:
trunk/packages/mldonkey/trunk/debian/TODO
trunk/packages/mldonkey/trunk/debian/mldonkey-server.init
trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
trunk/packages/mldonkey/trunk/debian/utils/mldonkey_files.ml
trunk/packages/mldonkey/trunk/debian/xml-man/mldonkey_files.xml
Log:
Handle fasttrack split and users.ini split in postinst -- SLG
Modified: trunk/packages/mldonkey/trunk/debian/TODO
===================================================================
--- trunk/packages/mldonkey/trunk/debian/TODO 2005-07-16 21:41:59 UTC (rev 1452)
+++ trunk/packages/mldonkey/trunk/debian/TODO 2005-07-17 17:23:09 UTC (rev 1453)
@@ -1,26 +1,32 @@
-* Build packages for :
- - kde_applet
- - gnome_applet
- - mozilla plugin
+* Not assigned:
+ * Build packages for :
+ * kde_applet
+ * gnome_applet
+ * mozilla plugin
-* Explore the possibility to build a package for KMLDonkey (Bug: #274460)
+ * Explore the possibility to build a package for KMLDonkey (Bug: #274460)
-* Correct the init.d script: use start-stop-daemon
+ * Correct bugs :
+ Important bugs - outstanding
+ #244406: mldonkey-server: A new problem of mldonkey_server
+ #268690: 2.5.28 fails to properly connect to mlnet
+ #270476: mldonkey-server: html-gui asks for username and password after upgrade
-* Split downloads.ini in users.ini
+ Normal bugs - outstanding
+ #204266: Chrooted mldonkey-server seems to be broken
+ #254000: logs to syslog instead of using own logfiles in /var/log/mldonkey/
+ #263094: mldonkey: Extra files to distribute
+ #270371: mldonkey-gui: graphical availablility isn't displayed
+ #285202: disconnect mldonkey-server if non-iso8859-1 characters typed in search section
-* Handle the fasttrack split in postinst
+* Jeroen Van Wolffelaar:
+ * Test mldonkey 2.5.28.1 package
+ * Release mldonkey 2.5.28.1
+ * Test mldonkey_make_chroot and its possible integration in the package
+
+* Sylvain le Gall:
+ * Split downloads.ini in users.ini
+ * Handle the fasttrack split in postinst
-* Correct bugs :
- Important bugs - outstanding
- #244406: mldonkey-server: A new problem of mldonkey_server
- #268690: 2.5.28 fails to properly connect to mlnet
- #270476: mldonkey-server: html-gui asks for username and password after upgrade
- Normal bugs - outstanding
- #204266: Chrooted mldonkey-server seems to be broken
- #254000: logs to syslog instead of using own logfiles in /var/log/mldonkey/
- #263094: mldonkey: Extra files to distribute
- #270371: mldonkey-gui: graphical availablility isn't displayed
- #285202: disconnect mldonkey-server if non-iso8859-1 characters typed in search section
Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.init
===================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.init 2005-07-16 21:41:59 UTC (rev 1452)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.init 2005-07-17 17:23:09 UTC (rev 1453)
@@ -74,27 +74,19 @@
exit 1
fi
- if [ -e "$MLDONKEY_DIR/files.ini" ] && [ ! -e "$MLDONKEY_DIR/files.ini.fasttrack" ]; then
- echo ""
- echo "First reboot after Fasttrack problem see /usr/share/doc/mldonkey-server/README.Debian"
- echo -n "Splitting $MLDONKEY_DIR/files.ini to remove Fasttrack files: "
- /usr/bin/mldonkey_files --split Fasttrack -f0 "$MLDONKEY_DIR/files.ini" \
- -f1 "$MLDONKEY_DIR/files.ini.fasttrack" \
- -f2 "$MLDONKEY_DIR/files.ini"
- echo "done."
- fi
-
USER=`/usr/bin/stat --format="%U" "$MLDONKEY_DIR/downloads.ini"`
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chuid $USER"
# export MLDONKEY_CHROOT=$MLDONKEY_DIR
+
+ start-stop-daemon --start --pidfile $PIDFILE \
+ --exec $WRAPPER -- --start --daemon $WRAPPER_OPTIONS
- $WRAPPER --start --daemon $WRAPPER_OPTIONS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
- $WRAPPER --stop --quiet $WRAPPER_OPTIONS
+ start-stop-daemon --stop --pidfile $PIDFILE
echo "."
;;
reload)
Modified: trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst
===================================================================
--- trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst 2005-07-16 21:41:59 UTC (rev 1452)
+++ trunk/packages/mldonkey/trunk/debian/mldonkey-server.postinst 2005-07-17 17:23:09 UTC (rev 1453)
@@ -15,6 +15,10 @@
if [ "$launch_at_startup" = "true" ]; then
+ ###########################
+ # Handling debconf values #
+ ###########################
+
db_get mldonkey-server/mldonkey_umask
mldonkey_umask="$RET"
umask $mldonkey_umask
@@ -85,6 +89,11 @@
db_get mldonkey-server/max_alive
max_alive="$RET"
+
+ ###################
+ # User management #
+ ###################
+
# Creating MLDonkey group if he isn't already there
if ! getent group $mldonkey_group > /dev/null ; then
$DEBUG && echo -n "Creating mldonkey group: "
@@ -108,40 +117,124 @@
$DEBUG && echo "done."
fi
- if [ -f "$MLDONKEY_DIR/downloads.ini" ]; then
- db_get mldonkey-server/reown_file
- if [ "$RET" = "true" ] && ! dpkg-statoverride --list "$MLDONKEY_DIR" >/dev/null; then
- $DEBUG && echo -n "Reowning file of $MLDONKEY_DIR: "
- # BUG: should not use chown, should use dpkg-statoverride itself, but the owner is not always
- # the same. If i use the method suggested in the Debian Policy 10.9.1, i need to dynamically
- # create a user, but this user should never be changed. The DP method will inject a new rules
- # in dpkg-statoverride which will made the above test always false for any further
- # upgrade/configure. With my method, only the user can set dpkg-statoverride rules to stop the
- # reowning of a file... However i am not sure this is the best method to do so.
- /bin/chown -R $run_as_user:$mldonkey_group "$MLDONKEY_DIR"
- $DEBUG && echo "done."
- fi
+ #########################
+ # Relocation management #
+ #########################
- db_get mldonkey-server/mldonkey_move
- if [ "$RET" = "true" ] && [ "$new_mldonkey_dir" != "$MLDONKEY_DIR" ]; then
- $DEBUG && echo -n "Moving file of $MLDONKEY_DIR to $new_mldonkey_dir: "
- /bin/mv "--target-directory=$new_mldonkey_dir" "$MLDONKEY_DIR/*"
- $DEBUG && echo "done."
- fi
+ if [ -e "$CONF" ]; then
+ . "$CONF"
+ if [ -n "$MLDONKEY_DIR" ] && [ -f "$MLDONKEY_DIR/downloads.ini" ]; then
+ db_get mldonkey-server/reown_file
+ if [ "$RET" = "true" ] && ! dpkg-statoverride --list "$MLDONKEY_DIR" >/dev/null; then
+ $DEBUG && echo -n "Reowning file of $MLDONKEY_DIR: "
+ # BUG: should not use chown, should use dpkg-statoverride itself, but the owner is not always
+ # the same. If i use the method suggested in the Debian Policy 10.9.1, i need to dynamically
+ # create a user, but this user should never be changed. The DP method will inject a new rules
+ # in dpkg-statoverride which will made the above test always false for any further
+ # upgrade/configure. With my method, only the user can set dpkg-statoverride rules to stop the
+ # reowning of a file... However i am not sure this is the best method to do so.
+ /bin/chown -R $run_as_user:$mldonkey_group "$MLDONKEY_DIR"
+ $DEBUG && echo "done."
+ fi
+
+ db_get mldonkey-server/mldonkey_move
+ if [ "$RET" = "true" ] && [ "$new_mldonkey_dir" != "$MLDONKEY_DIR" ]; then
+ $DEBUG && echo -n "Moving file of $MLDONKEY_DIR to $new_mldonkey_dir: "
+ /bin/mv "--target-directory=$new_mldonkey_dir" "$MLDONKEY_DIR/*"
+ $DEBUG && echo "done."
+ fi
+ fi
fi
-
- $DEBUG && echo -n "Creating empty $new_mldonkey_dir/downloads.ini: "
- /usr/bin/touch "$new_mldonkey_dir/downloads.ini"
+
+ #################
+ # Downloads.ini #
+ #################
+
+ if [ -e "$new_mldonkey_dir/downloads.ini" ]; then
+ $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/downloads.ini: "
+ /bin/cp -p -f "$new_mldonkey_dir/downloads.ini" "$new_mldonkey_dir/downloads.ini.dpkg"
+ $DEBUG && echo "done."
+ else
+ $DEBUG && echo -n "Creating empty $new_mldonkey_dir/downloads.ini: "
+ /bin/touch "$new_mldonkey_dir/downloads.ini"
+ $DEBUG && echo "done."
+ fi
+
+ $DEBUG && echo -n "Writing new values to $new_mldonkey_dir/downloads.ini: "
+ /usr/bin/mldonkey_options -f "$new_mldonkey_dir/downloads.ini" <<EOF
+run_as_useruid=$run_as_useruid
+run_as_user="$run_as_user"
+client_name="$client_name"
+enable_directconnect=$enable_directconnect
+enable_opennap=$enable_opennap
+enable_overnet=$enable_overnet
+enable_soulseek=$enable_soulseek
+enable_bittorrent=$enable_bittorrent
+enable_gnutella=$enable_gnutella
+enable_fasttrack=$enable_fasttrack
+max_hard_upload_rate=$max_hard_upload_rate
+max_hard_download_rate=$max_hard_download_rate
+EOF
$DEBUG && echo "done."
+
+ #############
+ # Files.ini #
+ #############
+
+ # Handling fasttrack file split here, better than in the mldonkey-server.init
+
+ if [ -e "$new_mldonkey_dir/files.ini" ] \
+ && [ ! -e "$new_mldonkey_dir/files.ini.fasttrack" ] \
+ && /usr/bin/mldonkey_files --test Fasttrack -q -f0 "$new_mldonkey_dir/files.ini"; then
+ echo "Correction of the Fasttrack problem (see /usr/share/doc/mldonkey-server/README.Debian)"
+ echo -n "Splitting $new_mldonkey_dir/files.ini (backup in $new_mldonkey_dir/files.ini.fasttrack): "
+ /usr/bin/mldonkey_files --split Fasttrack -f0 "$new_mldonkey_dir/files.ini" \
+ -f1 "$new_mldonkey_dir/files.ini.fasttrack" \
+ -f2 "$new_mldonkey_dir/files.ini"
+ echo "done."
+ fi
- $DEBUG && echo -n "Creating empty $CONF: "
- /usr/bin/touch "$CONF"
- $DEBUG && echo "done."
-
- $DEBUG && echo -n "Creating empty $new_mldonkey_dir/users.ini: "
- /usr/bin/touch "$new_mldonkey_dir/users.ini"
- $DEBUG && echo "done."
-
+
+ #############
+ # Users.ini #
+ #############
+
+ if [ -e "$new_mldonkey_dir/downloads.ini" ] && \
+ /usr/bin/mldonkey_users --test-users-section -q -f "$new_mldonkey_dir/downloads.ini"; then
+ if [ -e "$new_mldonkey_dir/users.ini" ]; then
+ echo "File $new_mldonkey_dir/users.ini exists and $new_mldonkey_dir/downloads.ini contains a \"users\" section, this is inconstitent."
+ echo "Please user mldonkey_users(1) to strip the \"users\" section of $new_mldonkey_dir/downloads.ini."
+ else
+ # OK we have downloads.ini containing a "users" section, this is pre 2.5.28.1
+ # configuration, lets split it...
+ $DEBUG && echo -n "Transferring \"users\" section from file $new_mldonkey_dir/downloads.ini to $new_mldonkey_dir/users.ini: "
+ /usr/bin/mldonkey_users --dump-users-section -q -f "$new_mldonkey_dir/downloads.ini" > "$new_mldonkey_dir/users.ini"
+ /usr/bin/mldonkey_users --strip-users-section -q -f "$new_mldonkey_dir/downloads.ini" > "$new_mldonkey_dir/downloads.ini.tmp"
+ mv -f "$new_mldonkey_dir/downloads.ini.tmp" "$new_mldonkey_dir/downloads.ini"
+ $DEBUG && echo "done."
+ fi
+ fi
+
+ if [ -n "$password" ]; then
+ if [ -e "$new_mldonkey_dir/users.ini" ]
+ $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/users.ini: "
+ /bin/cp -p -f "$new_mldonkey_dir/users.ini" "$new_mldonkey_dir/users.ini.dpkg"
+ $DEBUG && echo "done."
+ else
+ $DEBUG && echo -n "Creating empty $new_mldonkey_dir/users.ini: "
+ /bin/touch "$new_mldonkey_dir/users.ini"
+ $DEBUG && echo "done."
+ fi
+
+ $DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
+ /usr/bin/mldonkey_users --add admin -q -f "$new_mldonkey_dir/users.ini" -p $password
+ $DEBUG && echo "done."
+ fi
+
+ ####################
+ # Files permission #
+ ####################
+
for file in \
"$new_mldonkey_dir" \
"/var/run/mldonkey" \
@@ -149,7 +242,9 @@
"$new_mldonkey_dir/downloads.ini" \
"$new_mldonkey_dir/downloads.ini.dpkg" \
"$new_mldonkey_dir/downloads.ini.old" \
- "$new_mldonkey_dir/downloads.ini.tmp"; do
+ "$new_mldonkey_dir/downloads.ini.tmp" \
+ "$new_mldonkey_dir/files.ini" \
+ "$new_mldonkey_dir/files.ini.fasttrack"; do
$DEBUG && echo -n "Changing owner and file permission of $file: "
if ! dpkg-statoverride --list "$file" >/dev/null; then
# BUG: cf dpkg-statoverride above
@@ -183,54 +278,19 @@
$DEBUG && echo "$file is listed in dpkg-statoverride."
fi
done
+ fi
+ ################################
+ # /etc/default/mldonkey-server #
+ ################################
- $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/downloads.ini: "
- /bin/cp -p -f "$new_mldonkey_dir/downloads.ini" "$new_mldonkey_dir/downloads.ini.dpkg"
- $DEBUG && echo "done."
-
- $DEBUG && echo -n "Writing new values to $new_mldonkey_dir/downloads.ini: "
- /usr/bin/mldonkey_options -f "$new_mldonkey_dir/downloads.ini" <<EOF
-run_as_useruid=$run_as_useruid
-run_as_user="$run_as_user"
-client_name="$client_name"
-enable_directconnect=$enable_directconnect
-enable_opennap=$enable_opennap
-enable_overnet=$enable_overnet
-enable_soulseek=$enable_soulseek
-enable_bittorrent=$enable_bittorrent
-enable_gnutella=$enable_gnutella
-enable_fasttrack=$enable_fasttrack
-max_hard_upload_rate=$max_hard_upload_rate
-max_hard_download_rate=$max_hard_download_rate
-EOF
- $DEBUG && echo "done."
-
- if [ -n "$password" ]; then
- $DEBUG && echo -n "Creating backup of $new_mldonkey_dir/users.ini: "
- /bin/cp -p -f "$new_mldonkey_dir/users.ini" "$new_mldonkey_dir/users.ini.dpkg"
- $DEBUG && echo "done."
-
- $DEBUG && echo -n "Registering admin password in $new_mldonkey_dir/users.ini: "
- /usr/bin/mldonkey_users --add admin -q -f "$new_mldonkey_dir/users.ini" -p $password
- $DEBUG && echo "done."
- fi
-
- MLDONKEY_DIR=$new_mldonkey_dir
- MLDONKEY_GROUP=$mldonkey_group
- MLDONKEY_UMASK=$mldonkey_umask
- MAX_ALIVE=$max_alive
- fi
-
CONF_NEW=`/bin/tempfile`
$DEBUG && echo -n "Writing new values to $CONF_NEW: "
cat > "$CONF_NEW" <<EOF
# MLDonkey configuration
-# please do not edit by hand
-# use dpkg-reconfigure mldonkey-server
-# This script is loaded by
-# /etc/init.d/mldonkey-server
+# This file is loaded by /etc/init.d/mldonkey-server
+# This file is managed using ucf(1)
MLDONKEY_DIR=$new_mldonkey_dir
MLDONKEY_GROUP=$mldonkey_group
@@ -246,7 +306,6 @@
;;
abort-upgrade|abort-remove|abort-deconfigure)
-
;;
*)
Modified: trunk/packages/mldonkey/trunk/debian/utils/mldonkey_files.ml
===================================================================
--- trunk/packages/mldonkey/trunk/debian/utils/mldonkey_files.ml 2005-07-16 21:41:59 UTC (rev 1452)
+++ trunk/packages/mldonkey/trunk/debian/utils/mldonkey_files.ml 2005-07-17 17:23:09 UTC (rev 1453)
@@ -1,7 +1,10 @@
open Common_options;;
open Type_options;;
-type action = Split of string | Join
+type action =
+ Split of string
+ | Test of string
+ | Join
exception Not_enough_part
exception Invalid_format
@@ -28,7 +31,14 @@
extracted_network = arg
in
List.partition is_arg_network files_lst
+;;
+let test_network arg files_lst =
+ let (lst,_) = filter_network arg files_lst
+ in
+ lst <> []
+;;
+
let load_files_ini filename =
let options =
load_option filename
@@ -44,14 +54,15 @@
| _ -> raise Invalid_format
in
(done_files,files)
+;;
let save_files_ini filename (done_files,files) =
save_option filename (
Options(Id("done_files",ValList(done_files)),
Options(Id("files",ValList(files)),Eof)
))
+;;
-
let _ =
let action = ref Join
in
@@ -66,6 +77,8 @@
let _ = Arg.parse [
("--split", Arg.String ( fun x -> action := Split x ),
"Split file '-f0', put entry with source network arg in '-f1', rest in '-f2'");
+ ("--test", Arg.String ( fun x -> action := Test x),
+ "Test if file '-f0' containes source network arg");
("--join", Arg.Unit ( fun () -> action := Join ),
"Joind file '-f1' and '-f2', put result in '-f0'");
("-f0", Arg.String ( fun x -> filename_part0 := Some x ),
@@ -83,11 +96,7 @@
try
begin
match (!action,!filename_part0,!filename_part1,!filename_part2) with
- (_,None,_,_)
- | (_,_,None,_)
- | (_,_,_,None) ->
- raise Not_enough_part
- | (Join ,Some(part0),Some(part1),Some(part2)) ->
+ (Join ,Some(part0),Some(part1),Some(part2)) ->
let (done_files1,files1) = load_files_ini part1
in
let (done_files2,files2) = load_files_ini part2
@@ -95,13 +104,46 @@
save_files_ini part0 (done_files1 at done_files2,files1 at files2)
| (Split(net),Some(part0),Some(part1),Some(part2)) ->
let (done_files0,files0) =
- load_files_ini part0
+ load_files_ini part0
in
let (files1,files2) =
- filter_network net files0
+ filter_network net files0
in
save_files_ini part1 ([] ,files1);
save_files_ini part2 (done_files0,files2)
+ | (Test(net), Some(part0), _, _) ->
+ let (done_files0,files0) =
+ load_files_ini part0
+ in
+ if test_network net files0 then
+ (
+ (
+ if !quiet then
+ ()
+ else
+ Printf.printf "File %s contains source from network %s.\n" part0 net
+ );
+ exit 0
+ )
+ else
+ (
+ (
+ if !quiet then
+ ()
+ else
+ Printf.printf "File %s doesn't contain source from network %s.\n" part0 net
+ );
+ exit 1
+ )
+ | (Join, None,_,_)
+ | (Split(_),None,_,_)
+ | (Test(_), None,_,_)
+ | (Join, _,None,_)
+ | (Split(_),_,None,_)
+ | (Join, _,_,None)
+ | (Split(_),_,_,None) ->
+ raise Not_enough_part
end
with Not_found ->
raise Invalid_format
+;;
Modified: trunk/packages/mldonkey/trunk/debian/xml-man/mldonkey_files.xml
===================================================================
--- trunk/packages/mldonkey/trunk/debian/xml-man/mldonkey_files.xml 2005-07-16 21:41:59 UTC (rev 1452)
+++ trunk/packages/mldonkey/trunk/debian/xml-man/mldonkey_files.xml 2005-07-17 17:23:09 UTC (rev 1453)
@@ -91,8 +91,18 @@
confirmation will be asked. <option>-f1</option> and
<option>-f2</option> files will be erased.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--test <arg>network_name</arg></option></term>
+ <listitem>
+ <para>This command will search file source entry
+ concerning the network <arg>network_name</arg> in the
+ <option>-f0</option> file. If one file comes from the
+ given network, the exit code will be 0 else 1.
+ </listitem>
</varlistentry>
+
<varlistentry>
<term><option>-q</option></term>
<listitem>
@@ -101,8 +111,10 @@
</varlistentry>
</variablelist>
- <para>The action <option>--split</option> and <option>--join</option>
- are exclusive. You can only perform one at the same time.</para>
+ <para>Actions <option>--split</option>, <option>--test</option> and
+ <option>--join</option> are exclusive. You can only perform one at the
+ same time.
+ </para>
</refsect1>
More information about the Pkg-ocaml-maint-commits
mailing list