Handle hostnames with upper-case letters
[webmin.git] / create-module.pl
index 3ad3b19..2b506ec 100755 (executable)
@@ -8,9 +8,18 @@
 chop($pwd = `pwd`);
 
 # Parse command-line options
-if ($ARGV[0] eq "--dir") {
-       shift(@ARGV);
-       $forcedir = shift(@ARGV);
+while(@ARGV) {
+       if ($ARGV[0] eq "--dir") {
+               shift(@ARGV);
+               $forcedir = shift(@ARGV);
+               }
+       elsif ($ARGV[0] eq "--sign") {
+               shift(@ARGV);
+               $createsig = 1;
+               }
+       else {
+               last;
+               }
        }
 
 $file = shift(@ARGV);
@@ -36,7 +45,7 @@ foreach $m (@ARGV) {
        $subdir = $forcedir || $mod;
        $copydir = "/tmp/create-module/$subdir";
        system("rm -rf $copydir");
-       system("cp -r -L $mod $copydir");
+       system("cp -r -L $mod $copydir 2>/dev/null || cp -R -L $mod $copydir");
 
        # Find type from .info file
        undef(%minfo);
@@ -68,6 +77,10 @@ if ($file =~ /^(.*)\.gz$/i) {
        system("gzip -c $1 >$file");
        unlink("$1");
        }
+if ($createsig) {
+       system("rm -f $file-sig.asc");
+       system("gpg --armor --output $file-sig.asc --detach-sig $file");
+       }
 
 # read_file(file, &assoc, [&order], [lowercase])
 # Fill an associative array with name=value pairs from a file