source: main/trunk/package-kits/linux/perllib/Greenstone/Package/_rpm.pm@ 29559

Last change on this file since 29559 was 29559, checked in by Jeremy Symon, 9 years ago

Fedora works. Also updated demo package to set its files to be owned by tomcat too.

File size: 1.2 KB
Line 
1package Greenstone::Package::_rpm;
2
3use strict;
4use warnings;
5use utf8;
6use parent 'Greenstone::Package';
7
8sub replacement_array {
9 my $self = shift;
10 my $array = shift;
11 return join ", ", @{$array};
12}
13
14sub replacement {
15 my ($self, $var) = @_;
16 if ($var eq 'FILES') {
17 return join "\n", @{$self->{config}->{$var}};
18 }
19 return $self->SUPER::replacement ($var);
20}
21
22sub write_function {
23 my ($name, @lines) = @_;
24 my $ret = "";
25 $ret .= "%" . $name . "\n";
26 for my $line (@lines) {
27 $ret .= $line . "\n";
28 }
29 $ret .= "\n";
30 return $ret;
31}
32
33sub add_install {
34 my $self = shift;
35 $self->{config}->{INSTALL} = "";
36 exists $self->{config}->{PRE_INSTALL} and
37 $self->{config}->{INSTALL} .= write_function "pre", @{$self->{config}->{PRE_INSTALL}};
38 exists $self->{config}->{POST_INSTALL} and
39 $self->{config}->{INSTALL} .= write_function "post", @{$self->{config}->{POST_INSTALL}};
40 exists $self->{config}->{PRE_REMOVE} and
41 $self->{config}->{INSTALL} .= write_function "preun", @{$self->{config}->{PRE_INSTALL}};
42 exists $self->{config}->{POST_REMOVE} and
43 $self->{config}->{INSTALL} .= write_function "postun", @{$self->{config}->{POST_INSTALL}};
44}
45
461;
Note: See TracBrowser for help on using the repository browser.