Skip to content

Commit

Permalink
Added support for template .plg files to patch_capabilities.pl script.
Browse files Browse the repository at this point in the history
patch_capabilities.pl now supports both template pkg files and makesis
'ready' pkg files. If template pkg file is given next argument has to be
'target-platform'

Usage: patch_capabilities.pl pkg_filename [target-platform] [capabilies]
    If template .pkg file is given, next agrument must be 'target-platform'
E.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"

Reviewed-by: Miikka Heikkinen
  • Loading branch information
Janne Anttila committed Aug 31, 2009
1 parent 5d3a2b8 commit 827123e
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions bin/patch_capabilities.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
#
#######################################################################

sub Usage() {
print("This script can be used to set capabilities of all binaries\n");
print("specified for deployment in a .pkg file.\n");
print("If no capabilities are given, the binaries will be given the\n");
print("capabilities supported by self-signed certificates.\n");
print("\nUsage: patch_capabilities.pl pkg_filename [target-platform] [capability list]\n");
print(" If template .pkg file is given, next agrument must be 'target-platform'.\n");
print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n");
exit();
}

my @capabilitiesToSet = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData");

# If arguments were given to the script,
Expand All @@ -15,6 +26,19 @@
# Parse the first given script argument as a ".pkg" file name.
my $pkgFileName = shift(@ARGV);

# Check if using template .pkg and do preprocessing if needed
if (($pkgFileName =~ m|_template\.pkg$|i) && -r($pkgFileName))
{
my $target;
unless ($target = shift(@ARGV))
{
Usage();
}

system ("createpackage.bat -p ".$pkgFileName." ".$target);
$pkgFileName =~ s/_template\.pkg/_${target}\.pkg/;
}

# If the specified ".pkg" file exists (and can be read),
if (($pkgFileName =~ m|\.pkg$|i) && -r($pkgFileName))
{
Expand Down Expand Up @@ -98,10 +122,5 @@
}
else
{
print("This script can be used to set capabilities of all binaries\n");
print("specified for deployment in a .pkg file.\n");
print("If no capabilities are given, the binaries will be given the\n");
print("capabilities supported by self-signed certificates.\n");
print("\nUsage: patch_capabilities.pl pkg_filename [capability list]\n");
print("\nE.g. patch_capabilities.pl myapp_armv5_urel.pkg \"All -TCB\"\n");
Usage();
}

0 comments on commit 827123e

Please sign in to comment.