aboutsummaryrefslogtreecommitdiffstats
path: root/bin/mga-signpackage
blob: 435e92ed55774ef1b0533dac8b736059a6389e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);