Hi Andrea:
 
I propose changes similar to the following:

    if [ -x /usr/bin/bittorrent-tracker ]; then
      BT_TRACKER_BIN=/usr/bin/bittorrent-tracker
    else
      BT_TRACKER_BIN=/usr/bin/bttrack
    fi
 
This prevents the following messages from showing up when you execute 
/etc/init.dsystemimager-server-bittorrent [start|stop]:

which: no maketorrent-console in 
(/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:)
which: no launchmany-console in 
(/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:)
which: no launchmany-curses in 
(/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:)
 
What do you think?
 
Cheers,
 
Bernard

________________________________

From: [EMAIL PROTECTED] on behalf of Andrea Righi
Sent: Fri 02/06/2006 05:40
To: [EMAIL PROTECTED]
Subject: [systemimager-commits] r3613 - in trunk: etc/init.d sbin



Author: arighi
Date: 2006-06-02 07:40:05 -0500 (Fri, 02 Jun 2006)
New Revision: 3613

Modified:
   trunk/etc/init.d/systemimager-server-bittorrent
   trunk/sbin/si_installbtimage
Log:
support also old version of the BitTorrent commands on the image server (needed 
by some distributions that include the old BitTorrent package)

Modified: trunk/etc/init.d/systemimager-server-bittorrent
===================================================================
--- trunk/etc/init.d/systemimager-server-bittorrent     2006-06-01 13:49:14 UTC 
(rev 3612)
+++ trunk/etc/init.d/systemimager-server-bittorrent     2006-06-02 12:40:05 UTC 
(rev 3613)
@@ -53,7 +53,13 @@
     # Remove the previous state file (if present).
     rm -f $BT_TRACKER_STATE
     # Start tracker in background.
-    bittorrent-tracker --port $BT_TRACKER_PORT --dfile $BT_TRACKER_STATE 
--logfile $BT_TRACKER_LOG &
+    BT_TRACKER_BIN=`which bittorrent-tracker || which bttrack`
+    if [ -z $BT_TRACKER_BIN ]; then
+        echo failed.
+        echo Cannot find a valid tracker binary.
+        exit 1
+    fi
+    $BT_TRACKER_BIN --port $BT_TRACKER_PORT --dfile $BT_TRACKER_STATE 
--logfile $BT_TRACKER_LOG &
     if [ $? -ne 0 ]; then
         echo failed.
        exit 1

Modified: trunk/sbin/si_installbtimage
===================================================================
--- trunk/sbin/si_installbtimage        2006-06-01 13:49:14 UTC (rev 3612)
+++ trunk/sbin/si_installbtimage        2006-06-02 12:40:05 UTC (rev 3613)
@@ -120,6 +120,27 @@
     $compress = '';
 }

+# Find available BitTorrent binaries.
+chomp(my $maketorrent = `which maketorrent-console || which btmaketorrent`);
+unless ($maketorrent) {
+    print "ERROR: cannot find a valid binary to make torrents.\n";
+    exit(1);
+}
+chomp(my $launchmany = `which launchmany-console || which btlaunchmany`);
+chomp(my $launchmany_curses = `which launchmany-curses || which 
btlaunchmanycurses`);
+if ($launchmany) {
+    unless ($launchmany_curses) {
+        $launchmany_curses = $launchmany;
+    }
+} else {
+    if ($launchmany_curses) {
+        $launchmany = $launchmany_curses;
+    } else {
+        print "ERROR: cannot find a valid binary to launch the seeder.\n";
+        exit(1);
+    }
+}
+
 # Prepare all images for seeding.
 bt_prepare($IMAGE_DIR, $images, 'image');

@@ -137,7 +158,7 @@
     '/standard/boel_binaries.tar.gz', $boel_binaries)
     if (! -e $boel_binaries);
 # Make .torrent file.
-system "maketorrent-console --target $TORRENT_DIR/boel_binaries.tar.gz.torrent 
http://$image_server:$tracker_port/announce $boel_binaries";
+system "$maketorrent --target $TORRENT_DIR/boel_binaries.tar.gz.torrent 
http://$image_server:$tracker_port/announce $boel_binaries";
 if ($?) {
     die "ERROR: cannot create BOEL binaries torrent file!\n";
 }
@@ -147,7 +168,7 @@
 print "Starting first image server seeder...\n";
 if ($quiet) {
     $PIDFILE = '/var/run/systemimager-server-btseeder.pid';
-    open(PID, "launchmany-console --no_start_trackerless_client 
--max_upload_rate 0 --rerequest_interval 1 --bind $image_server --save_in 
$TARBALL_DIR $TORRENT_DIR>/dev/null 2>&1 & echo \$!|");
+    open(PID, "$launchmany --no_start_trackerless_client --max_upload_rate 0 
--rerequest_interval 1 --bind $image_server --save_in $TARBALL_DIR 
$TORRENT_DIR>/dev/null 2>&1 & echo \$!|");
     my $pid = <PID>;
     close(PID);
     open(OUT, ">$PIDFILE") or die("ERROR: cannot open $PIDFILE for 
writing!\n");
@@ -155,11 +176,11 @@
     close(OUT);
     # Check if the daemon is started.
     if (! -f $PIDFILE) {
-        die("ERROR: cannot start seeder with launchmany-console!\n");
+        die("ERROR: cannot start seeder with $launchmany!\n");
     }
     $_ = system "ps -p `cat $PIDFILE 2>/dev/null` >/dev/null 2>&1";
     if ($_) {
-        die("ERROR: cannot start seeder with launchmany-console!\n");
+        die("ERROR: cannot start seeder with $launchmany!\n");
     }
 } else {
     # Evaluate if python-curses is installed.
@@ -172,8 +193,8 @@
 sys.exit(0);
 EOF
 `;
-    my $bt_ui = ($?) ? 'console' : 'curses';
-    system "launchmany-$bt_ui --no_start_trackerless_client --max_upload_rate 
0 --rerequest_interval 1 --bind $image_server --save_in $TARBALL_DIR 
$TORRENT_DIR";
+    my $bt_ui = ($?) ? $launchmany : $launchmany_curses;
+    system "$bt_ui --no_start_trackerless_client --max_upload_rate 0 
--rerequest_interval 1 --bind $image_server --save_in $TARBALL_DIR 
$TORRENT_DIR";
 }
 print "done.\n";

@@ -254,7 +275,7 @@
             $torrent_file = "$TORRENT_DIR/$type-$name.tar.torrent"
         }
         unless (-f "$torrent_file") {
-            system "maketorrent-console --target $torrent_file 
http://$image_server:$tracker_port/announce $tarball_file";
+            system "$maketorrent --target $torrent_file 
http://$image_server:$tracker_port/announce $tarball_file";
             if ($?) {
                 die "ERROR: cannot create $type torrent file!\n";
             }



_______________________________________________
systemimager-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/systemimager-commits


<<winmail.dat>>

_______________________________________________
Sisuite-devel mailing list
Sisuite-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sisuite-devel

Reply via email to