aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mga-signpackage29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/mga-signpackage b/bin/mga-signpackage
new file mode 100755
index 0000000..435e92e
--- /dev/null
+++ b/bin/mga-signpackage
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+use strict;
+use RPM4::Sign;
+use File::Spec;
+
+sub signpackage {
+ my ($file, $name, $path) = @_;
+
+ # check if parent directory is writable
+ my $parent = (File::Spec->splitpath($file))[1];
+ die "Unsignable package, parent directory is read-only"
+ unless -w $parent;
+
+ my $sign = RPM4::Sign->new(
+ name => $name,
+ path => $path,
+ passphrase => '',
+ );
+
+ $sign->rpmssign($file)
+}
+
+if (@ARGV != 3) {
+ exit 1;
+}
+
+signpackage(@ARGV);
+