bin/createpackage.pl
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/bin/createpackage.pl	Tue Jul 06 15:10:48 2010 +0300
+++ b/bin/createpackage.pl	Wed Aug 18 10:37:55 2010 +0300
@@ -78,6 +78,7 @@
                                as a comments. Also empty lines are ignored. The paths in
                                <file> can be absolute or relative to <file>.
      [-u|unsigned]           = Preserves the unsigned package.
+     [-o|only-unsigned]      = Creates only unsigned package.
      [-s|stub]               = Generates stub sis for ROM.
      [-n|sisname <name>]     = Specifies the final sis name.
 Where parameters are as follows:
@@ -121,11 +122,13 @@
 my $preserveUnsigned = "";
 my $stub = "";
 my $signed_sis_name = "";
+my $onlyUnsigned = "";
 
 unless (GetOptions('i|install' => \$install,
                    'p|preprocess' => \$preprocessonly,
                    'c|certfile=s' => \$certfile,
                    'u|unsigned' => \$preserveUnsigned,
+                   'o|only-unsigned' => \$onlyUnsigned,
                    's|stub' => \$stub,
                    'n|sisname=s' => \$signed_sis_name,)) {
     Usage();
@@ -292,7 +295,10 @@
     # Create stub SIS.
     system ("makesis -s $pkgoutput $stub_sis_name");
 } else {
-    if ($certtext eq "Self Signed" && !@certificates && $templatepkg !~ m/_installer\.pkg$/i) {
+    if ($certtext eq "Self Signed"
+        && !@certificates
+        && $templatepkg !~ m/_installer\.pkg$/i
+        && !$onlyUnsigned) {
         print("Auto-patching capabilities for self signed package.\n");
         system ("patch_capabilities $pkgoutput");
     }
@@ -302,6 +308,25 @@
     system ("makesis $pkgoutput $unsigned_sis_name") and die ("makesis failed");
     print("\n");
 
+    my $targetInsert = "";
+    if ($targetplatform ne "-") {
+        $targetInsert = " for $targetplatform";
+    }
+
+    if ($onlyUnsigned) {
+        stat($unsigned_sis_name);
+        if( -e _ ) {
+            print ("Successfully created unsigned package ${unsigned_sis_name}${targetInsert}!\n");
+        } else {
+            print ("\nUnsigned package creation failed!\n");
+        }
+
+        if (!$preservePkgOutput) {
+            unlink $pkgoutput;
+        }
+        exit;
+    }
+
     # Sign SIS with certificate info given as an argument.
     my $relcert = File::Spec->abs2rel($certificate);
     my $relkey = File::Spec->abs2rel($key);
@@ -311,11 +336,7 @@
     # Check if creating signed SIS Succeeded
     stat($signed_sis_name);
     if( -e _ ) {
-        my $targetInsert = "";
-        if ($targetplatform ne "-") {
-            $targetInsert = "for $targetplatform ";
-        }
-        print ("Successfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n");
+        print ("Successfully created signed package ${signed_sis_name}${targetInsert} using certificate: $certtext!\n");
 
         # Sign with additional certificates & keys
         for my $row ( @certificates ) {