Attached please see patches for flamethrower and
systemimager which adds support to the bittorrent transport.
They are to be applied to trunk of
both trees.
This is still work-in-progress and
I'm not too happy about putting the BT setup (like tarring, seeding, setting up
tracker) in flamethrowerd. I think using a similar approach to Andrea's
(running a separate process) would be better.
Also, currently I create multiple
torrent files for each module, as discussed with Andrea, we can probably just
use one torrent (with the name of the image) to handle multiple
files/directories.
I have incorporated Andrea's idea of
having a staging directory for the tarballs and extended it such that it is
available for flamethrower (multicast or bt transport).
We're getting close to be able to
check code into trunk, I think a few more discussions and a few more tests and
we can agree on how best to merge our efforts and check it in so that everybody
can test.
Currently I'm using libbt, but I am
getting very poor performance with it when seeding and leeching
files.
I'm going to try libtorrent next, the
issue with that is it requires the boost system for building. I am not too
familar with the system but in my mind, this is additional dependency (libbt
only requires curl-devel, which isn't so bad).
Potentially we could use Andrea's
frozen python bt, but he mentioned that the frozen files are quite large - may
make our ramdisk quite bulky.
Okay that's it for now, if you have
any questions, feel free to ask.
Cheers,
Bernard
Index: lib/Flamethrower.pm
===================================================================
--- lib/Flamethrower.pm (revision 55)
+++ lib/Flamethrower.pm (working copy)
@@ -76,6 +76,9 @@
'rexmit_hello_interval' => { ARGCOUNT => ARGCOUNT_ONE },
'ttl' => { ARGCOUNT => ARGCOUNT_ONE },
'nosync' => { ARGCOUNT => ARGCOUNT_ONE },
+ 'transport' => { ARGCOUNT => ARGCOUNT_ONE },
+ 'bt_limit_upload' => { ARGCOUNT => ARGCOUNT_ONE },
+ 'bt_max_upload' => { ARGCOUNT => ARGCOUNT_ONE },
);
Index: bin/flamethrowerd
===================================================================
--- bin/flamethrowerd (revision 55)
+++ bin/flamethrowerd (working copy)
@@ -111,11 +111,25 @@
exit 1;
}
-my $file = "udp-sender";
-unless( Flamethrower->which($file,$ENV{PATH}) ){
- print ("Couldn't find $file in path: $ENV{PATH}\n");
- print ("Please install udp-sender, then try again.\n");
- exit 1;
+my $pname = "";
+
+# What transport are we using?
+my $transport = $ft_config->transport();
+
+if ($transport eq "bittorrent") {
+ $pname = "bittorrent-console";
+ unless( Flamethrower->which($pname,$ENV{PATH}) ){
+ print ("Couldn't find $pname in path: $ENV{PATH}\n");
+ print ("Please install $pname, then try again.\n");
+ exit 1;
+ }
+} else {
+ $pname = "udp-sender";
+ unless( Flamethrower->which($pname,$ENV{PATH}) ){
+ print ("Couldn't find $pname in path: $ENV{PATH}\n");
+ print ("Please install $pname, then try again.\n");
+ exit 1;
+ }
}
&daemonize;
@@ -335,9 +349,65 @@
return $cmd;
}
+# Usage: my $cmd = build_bittorrent_cmd($module);
+sub build_bittorrent_cmd {
+
+ my $module = shift;
+ my $tardir = "/tmp";
+
+
############################################################################
+ #
+ # Set vars for all options
+ #
+
############################################################################
+
+
############################################################################
+ #
+ # Global settings
+ #
+ my $log;
+ if ( $ft_config->get("log") ) {
+ $log = " > " . $ft_config->get("log") . ".$module";
+ }
+
+ my $bt_max_upload_rate;
+ if ( $ft_config->get("bt_limit_upload") &&
$ft_config->get("bt_max_upload") ) {
+ $bt_max_upload_rate = " --max_upload_rate " .
$ft_config->get("bt_max_upload");
+ } else {
+ $bt_max_upload_rate = " --max_upload_rate 0"
+ }
+ #
+
############################################################################
+
+
+
############################################################################
+ #
+ # Module specific overrides
+ #
+ #my $dir;
+ #if ( $ft_config->get("${module}_dir") ) {
+ # $dir = $ft_config->get("${module}_dir");
+ #}
+ #
+
############################################################################
+
+ # Build command
+ #
+ my $cmd = qq(bittorrent-console --save_as $tardir/${module}.tar
http://localhost/torrents/${module}.torrent);
+ #my $cmd = qq(bittorrent-console --save_as $tardir/${module}.tar
http://localhost/torrents/${module}.torrent );
+ $cmd .= $bt_max_upload_rate if(defined $bt_max_upload_rate);
+ #$cmd .= $slice_size if(defined $slice_size);
+ $cmd .= $log if(defined $log);
+
+ return $cmd;
+}
+
# Usage: update_directory();
sub update_directory {
+ my %portbases;
+ my $transport = $ft_config->transport();
+
print "update_directory()\n" if ($debug);
# Create our directory directory, if necessary.
@@ -357,12 +427,14 @@
unlink <$dir/*>;
+ if ($transport ne "bittorrent") {
+
############################################################################
#
# Get list of explicitly specified portbase numbers so we don't
# dynamically use one that already exists.
#
- my %portbases = $ft_config->varlist('_portbase$');
+ %portbases = $ft_config->varlist('_portbase$');
# Be sure to include the flamethrower_directory port.
$_ = $ft_config->get("flamethrower_directory_portbase");
@@ -387,6 +459,8 @@
#
############################################################################
+
+ }
############################################################################
#
@@ -409,33 +483,36 @@
if ( ! defined($ft_config->get("${module}_dir")) ) {
die("Please set DIR in flamethrower.conf for [$module]!");
}
+
+ if ($transport ne "bittorrent") {
- # PORTBASE
- my $portbase;
- if ($ft_config->varlist("${module}_portbase")) {
+ # PORTBASE
+ my $portbase;
+ if ($ft_config->varlist("${module}_portbase")) {
- # portbase is already set
- $portbase = $ft_config->get("${module}_portbase");
+ # portbase is already set
+ $portbase = $ft_config->get("${module}_portbase");
- } else {
+ } else {
- # Start with flamethrower_directory_portbase + 2.
- $portbase = $ft_config->get("flamethrower_directory_portbase")
+ 2;
+ # Start with flamethrower_directory_portbase + 2.
+ $portbase =
$ft_config->get("flamethrower_directory_portbase") + 2;
- # If that port is already in use, increment by two until we
- # get a free one.
- while ( defined($portbases{$portbase}) ) {
- $portbase += 2;
- }
+ # If that port is already in use, increment by two until we
+ # get a free one.
+ while ( defined($portbases{$portbase}) ) {
+ $portbase += 2;
+ }
- # Put it into module specific data structure
- $ft_config->set("${module}_portbase", $portbase);
+ # Put it into module specific data structure
+ $ft_config->set("${module}_portbase", $portbase);
- # Add our new portbase to the existing list.
- $portbases{$portbase} = $portbase;
+ # Add our new portbase to the existing list.
+ $portbases{$portbase} = $portbase;
+ }
+ print FILE "PORTBASE=$portbase\n";
}
- print FILE "PORTBASE=$portbase\n";
# ASYNC
my $async;
@@ -506,7 +583,24 @@
}
print FILE "NOSYNC=$nosync\n" if ($nosync);
+ # TRANSPORT
+ my $transport;
+ if ($ft_config->varlist("${module}_transport")) {
+ # transport is already set
+ $transport = $ft_config->get("${module}_transport");
+ } else {
+ # May or may not be set
+ # get it from global setting (if it exists)
+ if ($ft_config->varlist("^transport")) {
+ $transport= $ft_config->get("transport");
+
+ # Put it into module specific data structure
+ $ft_config->set("${module}_transport", $transport);
+ }
+ }
+ print FILE "TRANSPORT=$transport\n" if ($transport);
+
close(FILE);
}
@@ -521,6 +615,23 @@
read_config_file($conf_file);
}
my $dir = $ft_config->get("flamethrower_state_dir");
+ my $transport = $ft_config->transport();
+ my $log = $ft_config->get("log");
+ my $tracker_port = "2222";
+
+ if ($transport eq "bittorrent") {
+ my $child_file = "${dir}/flamethrowerd.bttracker.pid";
+ unless (-e $child_file) {
+ my $cmd = "bittorrent-tracker --port $tracker_port --dfile
/tmp/flamethrower_bt_dfile >> $log &";
+ my $child_pid = open(SENDER, "$cmd|") or die "Couldn't fork: $cmd";
+ record_pid($child_file, $child_pid+1);
+ while(<SENDER>){
+ print $_ if($debug);
+ }
+ close(SENDER);
+ }
+ }
+
my $modules = $ft_config->modules();
foreach my $module ( @$modules ) {
my $file = "${dir}/flamethrowerd.${module}.pid";
@@ -553,14 +664,14 @@
my $state_dir = shift;
my $parent_file = "${state_dir}/flamethrowerd.${module}.pid";
- my $child_file = "${state_dir}/flamethrowerd.${module}.udp-sender.pid";
+ my $child_file = "${state_dir}/flamethrowerd.${module}.$pname.pid";
my $file;
my $parent_pid;
my $child_pid;
print "cast($module, $state_dir)\n" if($debug);
-
+
# Fork and cast
if ($parent_pid = fork) {
record_pid($parent_file, $parent_pid);
@@ -570,7 +681,14 @@
print "casting $module\n" if($debug);
- my $cmd = build_udp_sender_cmd($module);
+ my $cmd = "";
+ if ($transport eq "bittorrent") {
+ # Make torrent if using the BitTorrent transport
+ maketorrent($module);
+ $cmd = build_bittorrent_cmd($module);
+ } else {
+ $cmd = build_udp_sender_cmd($module);
+ }
print "cmd $cmd\n" if($debug);
my $child_pid = open(SENDER, "$cmd|") or die "Couldn't fork: $cmd";
@@ -595,6 +713,40 @@
}
}
+# Usage: maketorrent($module);
+sub maketorrent {
+ my $module = shift;
+ my $port = "2222";
+ my $cmd = "";
+ my $docroot = "/var/www/html";
+ my $tardir = "/tmp";
+
+ my $interface;
+ if ( $ft_config->get("interface") ) {
+ $interface = $ft_config->get("interface");
+ }
+
+ (my $ip) = (`/sbin/ifconfig $interface`)[1] =~ /inet addr:(\S+)/;
+
+ my $dir;
+ if ( $ft_config->get("${module}_dir") ) {
+ $dir = $ft_config->get("${module}_dir");
+ }
+
+ print "maketorrent $module\n" if($debug);
+
+ # First, need to tar up the module
+ $cmd = "cd $dir && tar -cf $tardir/$module.tar *";
+
+ # Make torrent file using maketorrent
+ $cmd .= " && maketorrent-console http://$ip:$port/announce
$tardir/$module.tar";
+
+ # Move resulting torrent to document root's torrents directory
+ $cmd .= " && mv $tardir/$module.tar.torrent
$docroot/torrents/$module.torrent";
+ print "cmd $cmd\n" if($debug);
+ system($cmd);
+}
+
# Usage: read_config_file($file);
sub read_config_file {
my $file = shift;
Index: etc/flamethrower.conf
===================================================================
--- etc/flamethrower.conf (revision 55)
+++ etc/flamethrower.conf (working copy)
@@ -21,6 +21,12 @@
START_FLAMETHROWER_DAEMON = yes
#
+# Flamethrower transport to use. Currently supported transports are
+# multicast (default) and bittorrent.
+#
+#TRANSPORT = bittorrent
+
+#
# Port number where the Flamethrower configuration database can be
# found on the Flamethrower server. (this is a udp-sender portbase
# entry)
@@ -297,7 +303,20 @@
#
#TTL = 1
+#
+# BITTORRENT TRANSPORT OPTIONS
+#
+# Limit upload rate for BitTorrent transport. Use in conjunction with
+# BT_MAX_UPLOAD if you want to limit the upload rate.
+#
+#BT_LIMIT_UPLOAD = on
+#
+# Max upload rate for BitTorrent transport (in KB/s)
+#
+#BT_MAX_UPLOAD = 20
+
+
################################################################################
#
# MODULE SPECIFIC SETTINGS
Index: VERSION =================================================================== --- VERSION (revision 3389) +++ VERSION (working copy) @@ -1 +1 @@ -3.6.0 +3.8.0bt Index: systemimager.spec =================================================================== --- systemimager.spec (revision 3389) +++ systemimager.spec (working copy) @@ -181,6 +181,7 @@ URL: http://systemimager.org/ Distribution: System Installation Suite Obsoletes: systemimager-%{_build_arch}boot +BuildRequires: curl-devel Requires: systemimager-server >= %{version} AutoReqProv: no @@ -214,6 +215,7 @@ URL: http://systemimager.org/ Distribution: System Installation Suite Obsoletes: systemimager-%{_build_arch}initrd_template +BuildRequires: curl-devel Requires: systemimager-client >= %{version} AutoReqProv: no Index: initrd_source/make.d/bittorrent.rul =================================================================== --- initrd_source/make.d/bittorrent.rul (revision 0) +++ initrd_source/make.d/bittorrent.rul (revision 0) @@ -0,0 +1,38 @@ +# +# $Id$ +# +# http://sourceforge.net/projects/libbt +# +BT_VERSION = 1.05 +BT_TARBALL = libbt-$(BT_VERSION).tar.gz +BT_URL = http://easynews.dl.sourceforge.net/sourceforge/libbt/$(BT_TARBALL) +#BT_URL = http://download.systemimager.org/pub/bt/$(BT_TARBALL) +BT_DIR = libbt-$(BT_VERSION) +BT_BINARY = $(INITRD_SRC_DIR)/$(BT_DIR)/src/btget +BT_PATCHES = $(shell ls $(INITRD_PATCH_DIR)/bittorrent.*.patch 2>/dev/null | sort) + +ALL_SOURCE += $(INITRD_SRC_DIR)/$(BT_TARBALL) + +PHONY += bittorrent +libbt: $(BT_BINARY) + +$(BT_BINARY): $(INITRD_SRC_DIR)/$(BT_TARBALL) $(BT_PATCHES) \ + $(UCLIBC_TARGET) + rm -rf $(INITRD_SRC_DIR)/$(BT_DIR) + cd $(INITRD_SRC_DIR) && tar -xvzf $(BT_TARBALL) + + cd $(INITRD_SRC_DIR)/$(BT_DIR) && \ + cat $(BT_PATCHES) < /dev/null | patch -p1 + cd $(INITRD_SRC_DIR)/$(BT_DIR) && \ + ./configure PATH=$(INITRD_BUILD_PATH) + cd $(INITRD_SRC_DIR)/$(BT_DIR)/src && \ + $(MAKE) static + +$(INITRD_SRC_DIR)/$(BT_TARBALL): + [ -d $(INITRD_SRC_DIR) ] || mkdir -p $(INITRD_SRC_DIR) + $(GETSOURCE) $(BT_URL) $(INITRD_SRC_DIR) + +PHONY += bittorrent_clean +bittorrent_clean: + rm -rf $(INITRD_SRC_DIR)/$(BT_DIR) + Index: initrd_source/patches/bittorrent.btget-timeout.patch =================================================================== --- initrd_source/patches/bittorrent.btget-timeout.patch (revision 0) +++ initrd_source/patches/bittorrent.btget-timeout.patch (revision 0) @@ -0,0 +1,23 @@ +--- libbt-1.05/src/btget.c.orig 2005-12-09 15:50:12.000000000 -0800 ++++ libbt-1.05/src/btget.c 2005-12-29 18:49:39.000000000 -0800 +@@ -601,11 +601,10 @@ + } + } + +-#if 0 + if (optquiettmo > 0) { + static int lastcheck = 0; + static int donetime = 0; +- int check = (ctx->complete == 1) && peer_allcomplete( &ctx->downloads[0]->peerset); ++ int check = (complt == ctx->downloads[0]->fileset.npieces ) && peer_allcomplete( &ctx->downloads[0]->peerset); + if (check) { + if (!lastcheck) { + printf("=== All peers done!\n"); +@@ -619,7 +618,6 @@ + } + lastcheck = check; + } +-#endif + } + + return 0; Index: initrd_source/initrd.rul =================================================================== --- initrd_source/initrd.rul (revision 3389) +++ initrd_source/initrd.rul (working copy) @@ -109,6 +109,7 @@ build_dir: $(INITRD_DIR)/build_dir-stamp $(INITRD_DIR)/build_dir-stamp: $(SKEL_FILES) \ + $(BT_BINARY) \ $(BUSYBOX_BINARY) \ $(DEVFSD_BINARY) \ $(DHCLIENT_BINARY) \ @@ -136,6 +137,7 @@ # Copy over other binaries. cp -a $(DEVFSD_BINARY) $(INITRD_BUILD_DIR)/sbin cp -a $(DHCLIENT_BINARY) $(INITRD_BUILD_DIR)/sbin + cp -a $(BT_BINARY) $(INITRD_BUILD_DIR)/bin cp -a $(RSYNC_BINARY) $(INITRD_BUILD_DIR)/bin cp -a $(UDPCAST_BINARY) $(INITRD_BUILD_DIR)/bin Index: initrd_source/skel/etc/init.d/functions =================================================================== --- initrd_source/skel/etc/init.d/functions (revision 3389) +++ initrd_source/skel/etc/init.d/functions (working copy) @@ -188,6 +188,8 @@ echo "MONITOR_SERVER=$MONITOR_SERVER" >> /tmp/variables.txt echo "MONITOR_PORT=$MONITOR_PORT" >> /tmp/variables.txt + echo "TRANSPORT=$TRANSPORT" >> /tmp/variables.txt + echo "FLAMETHROWER_STAGING=$FLAMETHROWER_STAGING" >> /tmp/variables.txt } # ################################################################################ @@ -260,7 +262,7 @@ COUNT="$RETRY" logmsg "Killing off running processes." kill -9 $TMPFS_WATCHER_PID >/dev/null 2>/dev/null - killall -9 udp-receiver rsync >/dev/null 2>/dev/null + killall -9 btget udp-receiver rsync >/dev/null 2>/dev/null write_variables cat /etc/issue if [ ! -z $USELOGGER ] ; @@ -362,25 +364,34 @@ flamethrower_client() { if [ ! -z $FLAMETHROWER_TARPIPE ]; then - FLAMETHROWER_TARPIPE=tarpipe + FLAMETHROWER_TARPIPE=tarpipe fi + + # Stage to /tmp (tmpfs) unless otherwise specified + if [ -z $FLAMETHROWER_STAGING]; then + FLAMETHROWER_STAGING=/tmp + fi + logmsg - logmsg "flamethrower_client(${MODULE_NAME}) $FLAMETHROWER_TARPIPE " - logmsg --------------------------------------------------------------------- + logmsg "flamethrower_client(${MODULE_NAME}) $FLAMETHROWER_TARPIPE $FLAMETHROWER_STAGING" + logmsg --------------------------------------------------------------------------------- - # validate - if [ -z $PORTBASE ]; then - if [ -f ${FLAMETHROWER_DIRECTORY_DIR}/${MODULE_NAME} ]; then - . ${FLAMETHROWER_DIRECTORY_DIR}/${MODULE_NAME} - else - logmsg WARNING WARNING WARNING WARNING WARNING - logmsg You must either set PORTBASE, or have a sourceable file called - logmsg ${FLAMETHROWER_DIRECTORY_DIR}/MODULE_NAME - # allow for now to continue until overrides get their modules - return - #shellout + if [ -z $TRANSPORT ]; then + # validate for multicast transport + if [ -z $PORTBASE ]; then + if [ -f ${FLAMETHROWER_DIRECTORY_DIR}/${MODULE_NAME} ]; then + . ${FLAMETHROWER_DIRECTORY_DIR}/${MODULE_NAME} + else + logmsg WARNING WARNING WARNING WARNING WARNING + logmsg You must either set PORTBASE, or have a sourceable file called + logmsg ${FLAMETHROWER_DIRECTORY_DIR}/MODULE_NAME + # allow for now to continue until overrides get their modules + return + #shellout + fi fi fi + if [ -z $DIR ]; then logmsg "Must set DIR !!!" shellout @@ -388,20 +399,22 @@ mkdir -p $DIR fi - # build command - UDP_RECEIVER_OPTIONS="--interface ${DEVICE} --portbase $PORTBASE --nokbd" - if [ ! -z $TTL ]; then - UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --ttl $TTL" + if [ -z $TRANSPORT ]; then + # build command for multicast transport + UDP_RECEIVER_OPTIONS="--interface ${DEVICE} --portbase $PORTBASE --nokbd" + if [ ! -z $TTL ]; then + UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --ttl $TTL" + fi + if [ "$NOSYNC" = "on" ]; then + UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --nosync" + fi + if [ "$ASYNC" = "on" ]; then + UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --async" + fi + if [ ! -z $MCAST_ALL_ADDR ]; then + UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --mcast-all-addr $MCAST_ALL_ADDR" + fi fi - if [ "$NOSYNC" = "on" ]; then - UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --nosync" - fi - if [ "$ASYNC" = "on" ]; then - UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --async" - fi - if [ ! -z $MCAST_ALL_ADDR ]; then - UDP_RECEIVER_OPTIONS="$UDP_RECEIVER_OPTIONS --mcast-all-addr $MCAST_ALL_ADDR" - fi # Which tar opts should we use? If our tar has --overwrite capability, use it. # Summary: busybox tar doesn't (boel_binaries and prior). @@ -430,18 +443,26 @@ TAR_EXIT_STATUS=$? UDP_RECEIVER_EXIT_STATUS=0 else - logmsg udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar - udp-receiver $UDP_RECEIVER_OPTIONS --file /tmp/multicast.tar + if [ -z $TRANSPORT ]; then + logmsg udp-receiver $UDP_RECEIVER_OPTIONS --file $FLAMETHROWER_STAGING/multicast.tar + udp-receiver $UDP_RECEIVER_OPTIONS --file $FLAMETHROWER_STAGING/multicast.tar + else + logmsg "cd $FLAMETHROWER_STAGING && btget -q 1 -u http://$IMAGESERVER/torrents/${MODULE_NAME}.torrent" + cd $FLAMETHROWER_STAGING && btget -q 1 -u http://$IMAGESERVER/torrents/${MODULE_NAME}.torrent + fi UDP_RECEIVER_EXIT_STATUS=$? # untar it if [ "$UDP_RECEIVER_EXIT_STATUS" = "0" ]; then - logmsg tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR} - tar ${TAR_OPTS} -f /tmp/multicast.tar -C ${DIR} + if [ ! -z $TRANSPORT ]; then + mv $FLAMETHROWER_STAGING/${MODULE_NAME}.tar $FLAMETHROWER_STAGING/multicast.tar + fi + logmsg tar ${TAR_OPTS} -f $FLAMETHROWER_STAGING/multicast.tar -C ${DIR} + tar ${TAR_OPTS} -f $FLAMETHROWER_STAGING/multicast.tar -C ${DIR} TAR_EXIT_STATUS=$? fi # discard used tarball like an old sock (recommended by: Ramon Bastiaans <[EMAIL PROTECTED]>) - rm -f /tmp/multicast.tar + rm -f $FLAMETHROWER_STAGING/multicast.tar fi # did everything work properly @@ -481,6 +502,8 @@ unset TAR_OPTS unset SUCCESS unset FLAMETHROWER_TARPIPE + unset TRANSPORT + unset FLAMETHROWER_STAGING } # Index: initrd_source/skel/etc/dhclient-script.systemimager-prefix =================================================================== --- initrd_source/skel/etc/dhclient-script.systemimager-prefix (revision 3389) +++ initrd_source/skel/etc/dhclient-script.systemimager-prefix (working copy) @@ -18,6 +18,7 @@ # option-142 -> SSH_DOWNLOAD_URL # option-143 -> FLAMETHROWER_DIRECTORY_PORTBASE # option-144 -> TMPFS_STAGING +# option-145 -> TRANSPORT # option-208 -> SSH_DOWNLOAD_URL (depricated) # @@ -65,7 +66,7 @@ echo "TMPFS_STAGING=$new_option_144" >> $FILE echo "GATEWAY=$new_routers" >> $FILE echo "GATEWAYDEV=$interface" >> $FILE - +echo "TRANSPORT=$new_option_145" >> $FILE ################################################################################ # Index: initrd_source/skel/etc/dhclient.conf =================================================================== --- initrd_source/skel/etc/dhclient.conf (revision 3389) +++ initrd_source/skel/etc/dhclient.conf (working copy) @@ -14,6 +14,7 @@ # option-142 -> SSH_DOWNLOAD_URL # option-143 -> FLAMETHROWER_DIRECTORY_PORTBASE # option-144 -> TMPFS_STAGING +# option-145 -> TRANSPORT # option-208 -> SSH_DOWNLOAD_URL (depricated) # @@ -24,6 +25,7 @@ option-142, option-143, option-144, + option-145, option-208, subnet-mask, broadcast-address, Index: etc/flamethrower.conf =================================================================== --- etc/flamethrower.conf (revision 3389) +++ etc/flamethrower.conf (working copy) @@ -22,6 +22,12 @@ START_FLAMETHROWER_DAEMON = yes # +# Flamethrower transport to use. Currently supported transports are +# multicast (default) and bittorrent. +# +TRANSPORT = bittorrent + +# # Port number where the Flamethrower configuration database can be # found on the Flamethrower server. (this is a udp-sender portbase # entry) @@ -298,7 +304,20 @@ # #TTL = 1 +# +# BITTORRENT TRANSPORT OPTIONS +# +# Limit upload rate for BitTorrent transport. Use in conjunction with +# BT_MAX_UPLOAD if you want to limit the upload rate. +# +#BT_LIMIT_UPLOAD = on +# +# Max upload rate for BitTorrent transport (in KB/s) +# +#BT_MAX_UPLOAD = 20 + + ################################################################################ # # MODULE SPECIFIC SETTINGS Index: etc/init.d/systemimager-server-flamethrowerd =================================================================== --- etc/init.d/systemimager-server-flamethrowerd (revision 3389) +++ etc/init.d/systemimager-server-flamethrowerd (working copy) @@ -34,7 +34,12 @@ for PID_FILE in `ls ${STATE_DIR}/*` do if [ -f $PID_FILE ]; then - kill -9 `cat $PID_FILE` + PID=`cat $PID_FILE` + CPID=`ps -o pid= --ppid $PID` + kill -9 $PID + if [ ! -z $CPID ]; then + kill -9 $CPID + fi rm -f $PID_FILE echo -n "." fi Index: etc/autoinstallscript.template =================================================================== --- etc/autoinstallscript.template (revision 3389) +++ etc/autoinstallscript.template (working copy) @@ -213,6 +213,14 @@ RETRY=7 FLAMETHROWER_TARPIPE=y flamethrower_client +elif [ ! -z $TRANSPORT ]; then + + # Use BitTorrent transport + MODULE_NAME="${IMAGENAME}" + DIR=/a + RETRY=3 + FLAMETHROWER_STAGING=/a/tmp + flamethrower_client else # Use rsync if [ $NO_LISTING ]; then @@ -274,7 +282,7 @@ MODULE_NAME="override_${OVERRIDE}" DIR=/a RETRY=7 - FLAMETHROWER_TARPIPE=y + #FLAMETHROWER_TARPIPE=y flamethrower_client else # Use rsync Index: Makefile =================================================================== --- Makefile (revision 3389) +++ Makefile (working copy) @@ -477,6 +477,7 @@ $(BOEL_BINARIES_TARBALL): \ $(BC_BINARY) \ + $(BT_BINARY) \ $(TAR_BINARY) \ $(GZIP_BINARY) \ $(DISCOVER_BINARY) \ @@ -488,7 +489,6 @@ $(PARTED_BINARY) \ $(UTIL_LINUX_BINARIES) \ $(RAIDTOOLS_BINARIES) \ - $(MDADM_BINARIES) \ $(MKREISERFS_BINARY) \ $(MKJFS_BINARY) \ $(MKXFS_BINARY) \ @@ -506,6 +506,7 @@ mkdir -m 755 -p $(BOEL_BINARIES_DIR)/sbin mkdir -m 755 -p $(BOEL_BINARIES_DIR)/etc/ssh install -m 755 --strip $(BC_BINARY) $(BOEL_BINARIES_DIR)/bin/ + install -m 755 --strip $(BT_BINARY) $(BOEL_BINARIES_DIR)/bin/ install -m 755 --strip $(TAR_BINARY) $(BOEL_BINARIES_DIR)/bin/ install -m 755 --strip $(GZIP_BINARY) $(BOEL_BINARIES_DIR)/bin/ install -m 755 --strip $(DISCOVER_BINARY) $(BOEL_BINARIES_DIR)/sbin/ @@ -517,8 +518,6 @@ install -m 755 --strip $(UTIL_LINUX_BINARIES) $(BOEL_BINARIES_DIR)/sbin/ install -m 755 --strip $(RAIDTOOLS_BINARIES) $(BOEL_BINARIES_DIR)/sbin/ cd $(BOEL_BINARIES_DIR)/sbin/ && ln -f raidstart raidstop - #EF: mdadm will replace raidtools - install -m 755 --strip $(MDADM_BINARIES) $(BOEL_BINARIES_DIR)/sbin/ install -m 755 --strip $(MKREISERFS_BINARY) $(BOEL_BINARIES_DIR)/sbin/ install -m 755 --strip $(MKJFS_BINARY) $(BOEL_BINARIES_DIR)/sbin/ install -m 755 --strip $(OPENSSH_BINARIES) $(BOEL_BINARIES_DIR)/sbin/
