summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-dev/attachments/20120426/c17a395f/attachment-0001.ksh
blob: 0cf3733b7528fdf0f6fee7afcdc488331b5acc4c (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
32
33
34
35
36
#!/usr/bin/perl

use strict;
use warnings;

my $version;

# Given a list of filenames on the command line or on stdin this
# script returns the rpm-helper minimal version needed to handle them

if (@ARGV) {
    foreach (@ARGV) {
	process_file($_);
    }
} else {
  # notice we are passed a list of filenames NOT as common in unix the
  # contents of the file.
    foreach (<>) {
	process_file($_);
    }
}

if ($version) {
    print "Requires(post): rpm-helper >= $version\n";
    print "Requires(preun): rpm-helper >= $version\n";

}

sub process_file {
    my ($file) = @_;

    return unless -f $file;
    return unless $file =~ m{/lib/systemd/system/\S+\.service$};

    $version = "0.24.8";
}