/usr/bin/flamethrower is in flamethrower 0.1.8-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
#
# "Flamethrower"
#
# Copyright (C) 2003 Brian Elliott Finley <finley@mcs.anl.gov>
#
# $Id: flamethrower 46 2003-11-18 00:29:22Z brianfinley $
#
use strict;
use File::Path;
use File::Temp;
use Getopt::Long;
use lib "/usr/lib/flamethrower";
use Flamethrower;
use vars qw($config $ft_config $VERSION);
#
# Set some defaults
#
my $program_name = "flamethrower";
my $version_number = "0.1.8";
my $conf_file = '/etc/flamethrower/flamethrower.conf';
my $transport = "udp-receiver";
my $tmp_dir = File::Temp::tempdir();
my $version_info = <<"EOF";
$program_name (part of Flamethrower) version $version_number
Copyright (C) 2003 Brian Elliott Finley <finley\@mcs.anl.gov>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EOF
# set help information
my $help_info = $version_info . <<"EOF";
Usage: $program_name [OPTION]... --module MODULE --directory DIRECTORY
or: $program_name [OPTION]... --list
Options: (options can be presented in any order)
--help
Display this output.
--version
Display version and copyright information.
--verbose
Be verbose.
--config-file FILE
Alternate config file location. Defaults to:
$conf_file
Note: SystemImager users try using:
/etc/systemimager/flamethrower.conf
--list
List available modules on the Flamethrower server.
--module MODULE
Join a multicast to recieve an identical copy of MODULE in the directory
specified by --directory.
--directory DIRECTORY
Local directory in which to place your copy of MODULE.
--ttl TTL
--async
--nosync
--mcast-all-addr ADDRESS
--portbase PORTBASE
PORTBASE for the Flamethrower directory.
Download, report bugs, and make suggestions at:
http://systemimager.org/support/
EOF
# interpret command line options
GetOptions(
"help" => \my $help,
"version" => \my $version,
"verbose" => \my $verbose,
"config-file=s" => \$conf_file,
"list" => \my $list,
"module=s" => \my $module,
"directory=s" => \my $directory,
"ttl=s" => \my $ttl,
"async" => \my $async,
"nosync" => \my $nosync,
"mcast-all-addr=s" => \my $mcast_all_addr,
"portbase=s" => \my $flamethrower_directory_portbase,
) or die qq($help_info);
################################################################################
#
# process options
#
# if requested, print help information
if($help) {
print qq($help_info);
exit 0;
}
# if requested, print version and copyright information
if($version) {
print qq($version_info);
exit 0;
}
# Read the config file and update the directory
Flamethrower->read_config($conf_file) or die("Couldn't read $conf_file!");
# Warn if specified interface doesn't exist.
my $interface = $ft_config->interface();
if (( ! -d "/proc/sys/net/ipv4/conf/$interface" ) and ( ! -d "/proc/sys/net/ipv6/conf/$interface" )) {
print STDERR "\n\n";
print STDERR "FATAL: Interface $interface, as specified in your flamethrowerd.conf file,\n";
print STDERR " does not appear to be configured on this machine.\n";
print STDERR "\n";
exit 1;
}
unless( Flamethrower->which( "$transport", $ENV{PATH} ) ) {
print "I can't find $transport in your path:\n";
print " $ENV{PATH}\n";
print "Please be sure that you have the udpcast package installed.\n";
exit 1;
}
#
# Take settings from conf file if not specified on the command line.
#
unless($ttl) { $ttl = $ft_config->get('ttl'); }
unless($nosync) { $nosync = $ft_config->get('nosync'); }
unless($async) { $async = $ft_config->get('async'); }
unless($mcast_all_addr) { $mcast_all_addr = $ft_config->get('mcast_all_addr'); }
unless($flamethrower_directory_portbase) { $flamethrower_directory_portbase = $ft_config->get('flamethrower_directory_portbase'); }
if($list) {
my $portbase = $flamethrower_directory_portbase;
my $dir = $tmp_dir;
print "Available modules:\n"; # show this first, so the user knows something is happening
flamethrower_client('flamethrower_directory', $dir, $portbase, $interface, $mcast_all_addr, $async, $nosync, $ttl);
opendir(DIR, "$dir") or die("Couldn't open dir $dir!");
while( defined($_ = readdir(DIR)) ) {
print " $_\n" unless((m/^\.{1,2}$/o) or (m/^flamethrower_directory$/o));
}
closedir(DIR);
print "\n";
rmtree($dir) or print "WARNING: Couldn't remove temporary directory: $dir!\n";
} elsif(($module) and ($directory)) {
#
# Get directory info
#
my $portbase = $flamethrower_directory_portbase;
my $dir = $tmp_dir;
flamethrower_client('flamethrower_directory', $dir, $portbase, $interface, $mcast_all_addr, $async, $nosync, $ttl);
#
# read module info
#
my $file = "$dir/$module";
open(FILE, "<$file") or die("Couldn't open $file for reading!");
while(<FILE>) {
chomp;
next if(m/^MODULE=/o);
my ($variable, $value) = split(/=/);
$portbase = $value if($variable eq 'PORTBASE');
$async = $value if($variable eq 'ASYNC');
$ttl = $value if($variable eq 'TTL');
$mcast_all_addr = $value if($variable eq 'MCAST_ALL_ADDR');
# don't get log info from server -- let client decide
# don't get interface from server -- let client decide
# don't get nosync from server -- let client decide
# don't get norespect from server -- just don't
}
close(FILE);
rmtree($dir) or print "WARNING: Couldn't remove temporary directory: $dir!\n";
$dir = $directory;
flamethrower_client($module, $dir, $portbase, $interface, $mcast_all_addr, $async, $nosync, $ttl);
} else {
print qq($help_info);
exit 1;
}
exit 0;
#########################################################################################
#
# Subroutines
#
#
# Usage:
#
# flamethrower_client($module, $dir, $portbase, $interface[, $mcast_all_addr, $async, $nosync, $ttl]);
#
sub flamethrower_client {
my $module = shift;
my $dir = shift;
my $portbase = shift;
my $interface = shift;
my $mcast_all_addr = shift;
my $async = shift;
my $nosync = shift;
my $ttl = shift;
unless(-e $dir) {
eval { mkpath("$dir", 0, 0700) };
if ($@) {
die("Couldn't create temporary directory: $dir: $@");
}
}
############################################################################
#
# build command
#
my $udp_receiver_options = "--interface $interface";
$udp_receiver_options .= " --portbase $portbase";
if($ttl) {
$udp_receiver_options .= " --ttl $ttl";
}
if( "$nosync" eq "on" ) {
$udp_receiver_options .= " --nosync";
}
if( "$async" eq "on" ) {
$udp_receiver_options .= " --async";
}
if( $mcast_all_addr ) {
$udp_receiver_options .= " --mcast-all-addr $mcast_all_addr";
}
#
# Which tar opts should we use? If our tar has --overwrite capability, use it.
# Summary: busybox tar doesn't. Debian patched gnu tar does. We want
# this option enabled to ensure proper directory permissions. -BEF-
#
my $tar_opts;
if(`tar --help 2>&1 | grep overwrite`) {
$tar_opts = '--overwrite -xp';
} else {
$tar_opts = '-x';
}
############################################################################
#
# initiate transfer
#
my $udp_cmd;
my $tar_cmd;
my $tar_fh;
my $tar_file;
($tar_fh, $tar_file) = File::Temp::tempfile();
if($verbose) {
$udp_cmd = "udp-receiver $udp_receiver_options --file $tar_file";
$tar_cmd = "tar $tar_opts -C $dir -f $tar_file";
} else {
$udp_cmd = "udp-receiver $udp_receiver_options --file $tar_file 2>/dev/null";
$tar_cmd = "tar $tar_opts -C $dir -f $tar_file";
}
print "$udp_cmd\n" if($verbose);
!system($udp_cmd) or die("FAILED: $tar_cmd");
print "$tar_cmd\n" if($verbose);
!system($tar_cmd) or die("FAILED: $tar_cmd");
close $tar_fh;
unlink("$tar_file");
}
#
# which
#
# Usage:
# which($file,$ENV{PATH}) || do stuff;
#
sub which {
my $file = shift;
my $path = shift;
foreach my $dir (split(/:/,$path)) {
if(-x "$dir/$file") {
return 1;
}
}
return 0;
}
|