Index: trunk/ippScripts/scripts/addstar_run.pl
===================================================================
--- trunk/ippScripts/scripts/addstar_run.pl	(revision 27718)
+++ trunk/ippScripts/scripts/addstar_run.pl	(revision 28181)
@@ -37,5 +37,5 @@
 }
 
-my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $image_only, $verbose, $no_update,
+my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
      $no_op, $redirect, $save_temps);
 GetOptions(
@@ -48,4 +48,7 @@
     'reduction=s'       => \$reduction, # Reduction class
     'dvodb|w=s'         => \$dvodb,  # output DVO database
+    'minidvodb'         => \$minidvodb,  # use minidvodb?
+    'minidvodb_name|w=s'=> \$minidvodb_name,  # miniDVO database name
+    'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group
     'image-only'        => \$image_only,   # Print to stdout
     'verbose'           => \$verbose,   # Print to stdout
@@ -58,5 +61,5 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-          -msg => "Required options: --exp_tag --add_id --camera --outroot",
+          -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot",
           -exitval => 3,
           ) unless
@@ -65,6 +68,9 @@
     defined $outroot and
     defined $camroot and
+    defined $dvodb and
     defined $camera;
-
+if ($minidvodb && !defined($minidvodb_group)) {
+		my_die( "missing minidvodb_group", $add_id, 3 );
+	    }
 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
 
@@ -103,6 +109,37 @@
 my $dtime_addstar = 0;
 
+if (defined $dvodbReal) {
+	if ($minidvodb) {
+	    
+	    if (!defined($minidvodb_name)) {
+		#take the active one, if it's not defined on the command line
+		#reverts would have this already set, for example.
+		my $command = "addtool -listminidvodbrun ";
+		$command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group;
+		$command .= " -state 'active' -limit 1";
+		$command .= " -dbname $dbname" if defined $dbname;
+		print $command;
+		my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+		    run(command => $command, verbose => $verbose);
+		&my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success;
+		my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
+		    &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR);
+
+		my $components = parse_md_list($metadata) or
+		    &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR);
+		my $comp = $$components[0];
+		$minidvodb_name = $comp->{minidvodb_name};
+	
+		if (!defined($minidvodb_name)) {
+		    &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR);
+		} 
+		
+	    }
+	    # tack on the minidvodb part to the db.
+	    $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/';
+	    
+	}
 unless ($no_op) {
-    if (defined $dvodbReal) {
+   	    print $dvodbReal;
 
         ## addstar can either save the full set of detections, or just
@@ -142,6 +179,7 @@
 $fpaCommand .= " -path_base $outroot";
 $fpaCommand .= " -dtime_addstar $dtime_addstar";
+$fpaCommand .= " -dvodb_path $dvodbReal";
 $fpaCommand .= " -dbname $dbname" if defined $dbname;
-
+print $fpaCommand;
 # Add the result into the database
 unless ($no_update) {
@@ -171,4 +209,5 @@
         $command .= " -addprocessedexp";
         $command .= " -fault $exit_code";
+	$command .= " -dvodb_path $dvodbReal" if defined $dvodbReal;
         $command .= " -path_base $outroot" if defined $outroot;
         $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400));
