Index: trunk/ippScripts/scripts/dist_bundle.pl
===================================================================
--- trunk/ippScripts/scripts/dist_bundle.pl	(revision 27018)
+++ trunk/ippScripts/scripts/dist_bundle.pl	(revision 27449)
@@ -59,5 +59,5 @@
 
 # Parse the command-line arguments
-my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean);
+my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean);
 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix);
 my ($dbname, $save_temps, $verbose, $no_update, $logfile);
@@ -76,4 +76,5 @@
            'no_magic'       => \$no_magic,   # magic is not required for this distribution run
            'magicked'       => \$magicked,   # magicked state for this component
+           'alt_path_base=s'=> \$alt_path_base,  # path to alternate inputs
            'outdir=s'       => \$outdir,     # "directory" for outputs
            'prefix=s'       => \$prefix,     # "prefix" to apply to filenames
@@ -104,6 +105,4 @@
 $ipprc->define_camera($camera);
 
-# making a clean bundle of raw images doesn't make sense
-
 # create the output directories if it is not a nebulous path and it doesn't exist
 if (index($outdir, "neb://") != 0) {
@@ -151,5 +150,4 @@
 my ($inv_image, $inv_mask, $inv_variance);
 
-# foreach my $file_rule (keys %$file_list) {
 my $num_files = 0;
 foreach my $file (@$file_list) {
@@ -208,4 +206,6 @@
         } elsif ($image_type eq 'inv_variance') {
             $inv_variance = $file_name;;
+        } elsif ($image_type eq 'inv_variance') {
+            $inv_variance = $file_name;;
         } else {
             &my_die("invalid image type found: $image_type", $component,
@@ -225,11 +225,13 @@
     # requires magic and hasn't been magicked, but we check again here
 
-    if (!($magicked or $no_magic)) {
+    if (!($magicked or $no_magic or $alt_path_base)) {
         &my_die("cannot create distribution bundle ${stage}_id $stage_id because the data has not been magic desreaked", $component, $PS_EXIT_DATA_ERROR);
     }
 
     &my_die("no image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$image;
-    &my_die("no mask image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$mask;
-    &my_die("no variance image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
+    if ($stage ne "raw") {
+        &my_die("no mask image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$mask;
+        &my_die("no variance image found in file list", $component, $PS_EXIT_CONFIG_ERROR) if !$variance;
+    }
 
     my $class_id;
@@ -240,5 +242,6 @@
         # and so the camera mask and the chip mask are the same
         $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $chip_path_base, $component);
-        my $fh = open_with_retries($mask);
+        my $mask_resolved = $ipprc->file_resolve($mask);
+        my $fh = open_with_retries($mask_resolved);
         close $fh;
     } elsif ($stage eq "chip") {
@@ -384,12 +387,23 @@
     my @file_list;
     if ($stage eq "raw") {
-        # XXX: TODO for now disttool sets path_base is set to the uri of the file
-        # eventually rawImfile will have a path_base that we'll need to add '.fits'
-        # XXX do we want to distribute the registration log files?
+        # raw files have no '.mdc' file thus we need to build the list of files by
+        # hand
+        # XXX do we want to distribute the registration log files? I vote no
         if (!$clean) {
-            my %file;
-            $file{file_rule} = "RAW.IMAGE";
-            $file{name} = $path_base;
-            push @file_list, \%file;
+            my %image;
+            $image{file_rule} = "RAW.IMAGE";
+            my $image_name;
+            if ($alt_path_base) {
+                $image_name = "$alt_path_base.fits";
+            } else {
+                $image_name = "$path_base.fits";
+            }
+            $image{name} = $image_name;
+            push @file_list, \%image;
+
+            my %burntool_table;
+            $burntool_table{file_rule} = "BURNTOOL.TABLE";
+            $burntool_table{name} = "$path_base.burn.tbl";
+            push @file_list, \%burntool_table;
         }
         return \@file_list;
