Hey,

 

as I configured the bittorrent transport on my image server today,
si_installbtimage reported the following error:

"ERROR: error in $config_file: BT_INTERFACE not specified or not valid!"

 

Digging into si_installbtimage, revealed that the regular expression in this
line failed to match:

($image_server) = (`/sbin/ifconfig $1`)[1] =~ /inet addr:(\S+)/;

 

In my german version of debian, the output of ifconfig is partially
localized, so that instead of "inet addr:", I have "inet Adresse:". I'm not
sure if this is also the case in other distributions and languages, but I
think this should be fixed.

 

The best thing (tm) IME would be to not rely on the ifconfig output at all
and find some other way to obtain the ip address of an interface, but I'm
not sure how to do this.

 

However, it seems that the common output for german and englisch versions
(and probably other languages too) is the "inet" prefix followed by another
word and a colon ":". So I came up with the following expression:

/inet (?:[^\:]+):(\S+)/

 

This basically excepts any character after inet and only stops at a colon.
This is very liberal and if this causes problems you may want to change this
to something more conservative like \w+.

 

This is only tested on my german version of debian, so you should propably
try this in an English version, too.

 

Thomas Krause

 

Index: si_mkbootserver

===================================================================

--- si_installbtimage       (revision 4255)

+++ si_installbtimage    (working copy)

@@ -107,7 +107,7 @@

     if (m/BT_TRACKER_PORT=([0-9]+)/) {

         $tracker_port = $1;

     } elsif (m/BT_INTERFACE=(.+)/) {

-        ($image_server) = (`/sbin/ifconfig $1`)[1] =~ /inet addr:(\S+)/;

+        ($image_server) = (`/sbin/ifconfig $1`)[1] =~ /inet
(?:[^\:]+):(\S+)/;

     }

 }

 unless ($tracker_port) {

Attachment: fix_get_ipaddress.patch
Description: Binary data

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to