Index: trunk/DataStoreServer/scripts/dsreg
===================================================================
--- trunk/DataStoreServer/scripts/dsreg	(revision 17948)
+++ trunk/DataStoreServer/scripts/dsreg	(revision 18535)
@@ -46,4 +46,5 @@
 my $del;
 my $remove;
+my $force;          # on --del don't return error if fileset doesn't exist
 
 my $verbose = 0;
@@ -55,8 +56,7 @@
 
 GetOptions(
-        'add'           =>      \$add,
-        'del'           =>      \$del,
+        'add=s'         =>      \$add,
+        'del=s'         =>      \$del,
         'product=s'     =>      \$product,
-        'fileset=s'     =>      \$fileset,
         'list=s'        =>      \$filelist,
         'type=s'        =>      \$fstype,
@@ -66,4 +66,5 @@
         'copy'          =>      \$copyfiles,
         'rm'            =>      \$remove,
+        'force'         =>      \$force,
         'ps0=s'         =>      \$ps0,          # product specific columns 0 - 7
         'ps1=s'         =>      \$ps1,
@@ -82,6 +83,4 @@
 
 $err .= "--product is required\n" unless defined $product;
-$err .= "--fileset is required\n" unless defined $fileset;
-
 
 # will exit if neither --add and --del is specified or if they both are specified
@@ -90,4 +89,5 @@
 
 if ($add) {
+    $fileset = $add;
     $err .= "--type is required\n" unless defined $fstype;
     $err .= "--list is required\n" unless defined $filelist;
@@ -101,4 +101,6 @@
         $err .= "datapath must begin with / when using --link\n";
     }
+} else {
+    $fileset = $del;
 }
 
@@ -169,5 +171,9 @@
     if (!$fs_row) {
         print STDERR "Fileset '$fileset' not found under $product.\n";
-        exit 1;
+        if ($force) {
+            exit 0;
+        } else {
+            exit 1;
+        }
     }
     $stmt->finish();
@@ -259,11 +265,15 @@
 
         my $filename;
+        my $bytes;
+        my $md5sum;
         my $filetype;
 
         my @fields = split /\|/;
-        if (@fields < 2) {
+        if (@fields < 4) {
             die "malformed input line at $filelist line $lineno: $_\n";
         }
         $filename = shift @fields;
+        $bytes    = shift @fields;  # if this is null it will be calculated below
+        $md5sum   = shift @fields;  # if this is null it will be calculated below
         $filetype = shift @fields;
 
@@ -276,4 +286,6 @@
         my $hashref = {
             'file'      => $filename,
+            'bytes'     => $bytes,
+            'md5sum'    => $md5sum,
             'type'      => $filetype,
             'ts_cols'   => $ts_cols,
@@ -321,18 +333,22 @@
     }
 
-    # now calculate the md5sum and file size
+    # now calculate the md5sum and file size if they weren't provided
     foreach my $file (@files) {
 	my $filename = fileparse($file->{file}, ());
         my $path = "$fileset_dir/$filename";
-        my @finfo = stat("$path");
-
-        unless (@finfo) {
-            die ("Line $lineno: referenced file "
-                ."($path does not exist.\n");
-        }
-        $file->{bytes}  = $finfo[7];
-
-        # Get MD5 sum
-        $file->{md5sum} = file_md5_hex($path);
+        if (! -e $path ) {
+            die "file $path not found";
+        }
+        if (!$file->{bytes}) {
+            my @finfo = stat($path);
+            unless (@finfo) {
+                die ("can't stat $path");
+            }
+            $file->{bytes}  = $finfo[7];
+        }
+        if (!$file->{md5sum}) {
+            # Get MD5 sum
+            $file->{md5sum} = file_md5_hex($path);
+        }
     }
 
