aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/files/signbot/mga-signpackage
blob: bd88efeb7431ed5dbb36df6c4310e298efa7c446 (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
30
31
#!/usr/bin/perl -w

use strict;
use warnings;
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);
exit 0