Index: /tags/ipp-ops-20220906/ippScripts/scripts/dist_bundle.pl
===================================================================
--- /tags/ipp-ops-20220906/ippScripts/scripts/dist_bundle.pl	(revision 42732)
+++ /tags/ipp-ops-20220906/ippScripts/scripts/dist_bundle.pl	(revision 42733)
@@ -25,4 +25,9 @@
 
 my $ipprc = PS::IPP::Config->new(); # IPP configuration
+
+# we can record the location an appropriate magic.mdc file for the file command 
+my $file_magic = "$ENV{PSCONFDIR}/$ENV{PSCONFIG}/etc/compress.mgc";
+### TEST print "magic: $file_magic\n";
+### TEST system ("file -m $file_magic o60523g0045o.2132764.wrp.2688740.skycell.1566.004.pswarp.mdc");
 
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
@@ -75,4 +80,5 @@
 my $file_cmd   = can_run('file') or (warn "can't find program file" and $missing_tools = 1);
 my $zcat   = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1);
+my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
 if ($missing_tools) {
     warn("Can't find required tools.");
@@ -81,5 +87,5 @@
 
 # Parse the command-line arguments
-my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean, $exp_type);
+my ($camera, $stage, $class_id, $stage_id, $component, $path_base, $chip_path_base, $alt_path_base, $clean, $exp_type);
 my ($outroot, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix);
 my ($dbname, $save_temps, $verbose, $no_update, $logfile);
@@ -131,4 +137,29 @@
 }
 
+# Determine the value of a "good" burntool run.
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
+
+my $config_cmd = "$ppConfigDump -camera $camera -get-key BURNTOOL.STATE.GOOD";
+my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+    run ( command => $config_cmd, verbose => $verbose);
+unless ($success) {
+    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+    &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
+}
+
+my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
+    &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR);
+
+my $burntoolStateGood = 999;
+foreach my $cfg (@$recipeData) {
+    if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') {
+        $burntoolStateGood = $cfg->{value};
+    }
+}
+if ($burntoolStateGood == 999) {
+    &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR);
+}
+
+
 $ipprc->redirect_output($logfile) if $logfile;
 
@@ -144,5 +175,5 @@
 # note: We my_die in get_file_list if something goes wrong.
 
-my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs);
+my $file_list = get_file_list($stage, $component, $path_base, $clean, $num_sky_inputs,$burntoolStateGood);
 
 if (($stage ne 'raw') and ($stage ne 'fake') and ($stage ne 'stack_summary') and !$poor_quality) {
@@ -555,4 +586,5 @@
     my $clean = shift;
     my $num_sky_inputs = shift;
+    my $bt_state_good = shift;
 
     my @file_list;
@@ -576,5 +608,10 @@
                 my %burntool_table;
                 $burntool_table{file_rule} = "BURNTOOL.TABLE";
-                $burntool_table{name} = "$path_base.burn.tbl";
+		
+    		if($bt_state_good == 15) {
+    		    $burntool_table{name} = "$path_base.burn.v15.tbl";	
+    		} else {
+    		    $burntool_table{name} = "$path_base.burn.tbl";		
+    		}		
                 push @file_list, \%burntool_table;
             }
@@ -647,5 +684,6 @@
     my $mdc_compressed;
     {
-        my $command = "$file_cmd $resolved";
+        my $command = "$file_cmd -m $file_magic $resolved";
+#        my $command = "$file_cmd $resolved";
         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
             run(command => $command, verbose => $verbose);
