Index: trunk/ippTools/share/Makefile.am
===================================================================
--- trunk/ippTools/share/Makefile.am	(revision 32469)
+++ trunk/ippTools/share/Makefile.am	(revision 32479)
@@ -275,4 +275,5 @@
 	magicdstool_definebyquery_warp_bg.sql \
 	magicdstool_definebyquery_diff.sql \
+	magicdstool_definecopy_camera.sql \
 	magicdstool_definecopy_chip.sql \
 	magicdstool_definecopy_warp.sql \
Index: trunk/ippTools/share/magicdstool_definecopy_camera.sql
===================================================================
--- trunk/ippTools/share/magicdstool_definecopy_camera.sql	(revision 32479)
+++ trunk/ippTools/share/magicdstool_definecopy_camera.sql	(revision 32479)
@@ -0,0 +1,31 @@
+SELECT DISTINCT       -- DISTINCT because we are going though diffInputSkyfile
+    magicRun.magic_id,
+    chipRun.exp_id,
+    'camera' AS stage,
+    camRun.cam_id AS stage_id,
+    camRun.data_group,
+    camRun.cam_id,
+    camRun.label,
+    CAST(NULL AS SIGNED) AS inv_magic_id
+FROM magicRun
+    JOIN magicMask USING(magic_id)
+    JOIN diffRun USING(diff_id)
+    JOIN diffInputSkyfile USING(diff_id)
+    JOIN warpRun AS oldWarpRun
+        ON (!magicRun.inverse AND diffInputSkyfile.warp1 = oldWarpRun.warp_id)
+        OR ( magicRun.inverse AND diffInputSkyfile.warp2 = oldWarpRun.warp_id)
+    -- This ends the usual JOIN down to the raw level
+    JOIN rawExp
+        ON rawExp.exp_id = magicRun.exp_id
+    JOIN chipRun
+        ON chipRun.exp_id = rawExp.exp_id
+    JOIN camRun
+        ON camRun.chip_id = chipRun.chip_id
+    LEFT JOIN magicDSRun
+        ON magicRun.magic_id = magicDSRun.magic_id
+        AND magicDSRun.stage  = 'camera'
+        AND magicDSRun.label = '%s'
+WHERE magicRun.state = 'full'
+    -- HOOK: NEWLINE HERE TO ACTIVATE %s AND magicDSRun.magic_ds_id IS NULL
+    AND camRun.magicked  = 0
+    AND camRun.state = 'full'
Index: trunk/ippTools/src/magicdstool.c
===================================================================
--- trunk/ippTools/src/magicdstool.c	(revision 32469)
+++ trunk/ippTools/src/magicdstool.c	(revision 32479)
@@ -350,9 +350,9 @@
     PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
     PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false);
+    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", true, false);
 
     // Optional
     PXOPT_LOOKUP_STR(recoveryroot, config->args, "-recoveryroot", false, false);
     PXOPT_LOOKUP_BOOL(noreplace, config->args, "-noreplace", false);
-    PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false);
     PXOPT_LOOKUP_STR(set_data_group, config->args, "-set_data_group", false, false);
     PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
@@ -374,5 +374,9 @@
     pxAddLabelSearchArgs (config, where, "-magic_label", "magicRun.label", "=="); // define magic label
     psString labelName = NULL;                                                    // Name of label
-    psStringAppend(&labelName, "%sRun.label", stage);
+    if (strcmp(stage, "camera")) {
+        psStringAppend(&labelName, "%sRun.label", stage);
+    } else {
+        psStringAppend(&labelName, "camRun.label");
+    }
     pxAddLabelSearchArgs (config, where, "-stage_label", labelName, "=="); // define stageRun label
     psFree(labelName);
@@ -392,4 +396,6 @@
         break;
       case IPP_STAGE_CAMERA:
+        query = pxDataGet("magicdstool_definecopy_camera.sql");
+        break;
       case IPP_STAGE_DIFF:
       case IPP_STAGE_FAKE:
Index: trunk/ippTools/src/magicdstoolConfig.c
===================================================================
--- trunk/ippTools/src/magicdstoolConfig.c	(revision 32469)
+++ trunk/ippTools/src/magicdstoolConfig.c	(revision 32479)
@@ -79,5 +79,5 @@
     psMetadataAddStr(definecopyArgs, PS_LIST_TAIL, "-recoveryroot", 0, "define recovery directory", NULL);
     psMetadataAddBool(definecopyArgs, PS_LIST_TAIL, "-noreplace", 0, "do not replace input files with the destreaked versions", false);
-    psMetadataAddStr(definecopyArgs, PS_LIST_TAIL, "-set_label",    0, "define label", NULL);
+    psMetadataAddStr(definecopyArgs, PS_LIST_TAIL, "-set_label",    0, "define label (required)", NULL);
     psMetadataAddStr(definecopyArgs, PS_LIST_TAIL, "-set_data_group", 0, "define data_group", NULL);
     psMetadataAddStr(definecopyArgs, PS_LIST_TAIL, "-set_note", 0, "define note", NULL);
