Index: trunk/ippScripts/scripts/addstar_run.pl
===================================================================
--- trunk/ippScripts/scripts/addstar_run.pl	(revision 30326)
+++ trunk/ippScripts/scripts/addstar_run.pl	(revision 31377)
@@ -37,13 +37,14 @@
 }
 my $minidvodb_path;
-my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
+my ( $add_id, $camera, $stage, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
      $no_op, $redirect, $save_temps);
 GetOptions(
-    'exp_tag=s'          => \$exp_tag, # Exposure identifier
     'add_id=s'          => \$add_id, # Camtool identifier
     'camera|c=s'        => \$camera, # Camera
+    'stage|s=s'        => \$stage, # Camera
+    
     'dbname|d=s'        => \$dbname, # Database name
     'outroot|w=s'       => \$outroot, # output file base name
-    'camroot|w=s'       => \$camroot, # camera stage root name.
+    'stageroot|w=s'       => \$stageroot, # stage root name.
     'reduction=s'       => \$reduction, # Reduction class
     'dvodb|w=s'         => \$dvodb,  # output DVO database
@@ -61,11 +62,11 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-          -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot",
+          -msg => "Required options: --add_id --camera --outroot --dvodb --stageroot --stage",
           -exitval => 3,
           ) unless
-    defined $exp_tag and
+    defined $stage and
     defined $add_id and
     defined $outroot and
-    defined $camroot and
+    defined $stageroot and
     defined $dvodb and
     defined $camera;
@@ -86,7 +87,15 @@
 # Recipes to use based on reduction class
 $reduction = 'DEFAULT' unless defined $reduction;
-
+my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR');
 # XXX This is now not used: do we still need it?
-my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use
+if ($stage =~/cam/) {
+  $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use
+}
+if ($stage =~/stack/) {
+  $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STACK'); # Recipe to use
+}
+#if ($stage =~/staticsky/) {
+#  $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STATICSKY'); # Recipe to use
+#}
 &my_die("Unrecognised ADDSTAR recipe", $add_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar;
 
@@ -97,5 +106,12 @@
 
 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
-my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",     $camroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR);
+
+# it was PSASTRO.OUTPUT
+my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",     $stageroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR);
+
+if (($stage =~/staticsky/) || ($stage =~/stack/)) {
+    $fpaObjects =~ s/smf$/cmf/;
+    
+}
 my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR);
 
@@ -173,6 +189,8 @@
         $command .= " $realFile";
         $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference
-        $command .= " -image" if $image_only;
-
+	    $command .= " -image" if $image_only;
+	    if ($stage = ~/staticsky/) {
+		$command .= " -accept-astrom ";
+	    }
         my $mjd_addstar_start = DateTime->now->mjd;   # MJD of starting script
 
