View | Details | Raw Unified | Return to bug 8402
Collapse All | Expand All

(-)a/install_misc/koha-debian-deps.pl (-1 / +92 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright (C) 2013 KohaAloha, NZ
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=pod
21
a script to build a file containing a list of debian packages needed to install Koha - from ./debian.control
22
23
script must be run with --run arg, to execute
24
25
=cut
26
27
use Modern::Perl;
28
use List::MoreUtils qw(uniq);
29
use Parse::DebControl;
30
31
use Getopt::Long;
32
my $run,;
33
my $result = GetOptions( 'r|run' => \$run, );
34
35
if ( not $run ) {
36
    print_usage();
37
    exit 0;
38
}
39
40
my $parser = new Parse::DebControl;
41
$parser->DEBUG();
42
43
my %opt = ( 'stripComments' => 1, );
44
my $data = $parser->parse_file( './debian/control', \%opt );
45
46
my $deps;
47
foreach my $p (@$data) {
48
    $deps .= $p->{'Depends'} . "\n" if $p->{'Depends'};
49
}
50
51
my @deps2;
52
53
foreach my $d ( split '\n', $deps ) {
54
55
    next if $d =~ qr/\$/;
56
57
    $d =~ s/\|.*$//;
58
    $d =~ s/,//;
59
    $d =~ s/\"//;
60
    $d =~ s/^[ \t]+|[ \t]+$//g;
61
    $d .= "\n";
62
63
    push @deps2, $d if $d !~ /\$/;
64
}
65
66
my @uniq = uniq(@deps2);
67
print @uniq;
68
69
sub print_usage {
70
    print <<'_USAGE_';
71
72
this script outputs a list of debian packages for Koha, built from the ./debian.control file
73
74
so, something like...
75
 $ ./koha-debian-deps.pl -r > install_misc/debian.packages
76
77
then...
78
 $  aptitude install $( < install_misc/debian.packages)
79
80
or...
81
 $  apt-get install  $( < install_misc/debian.packages)
82
83
84
script must be run with --run arg, to execute
85
86
Parameters:
87
    --run or -r           run this script
88
_USAGE_
89
90
}
91
92
1;

Return to bug 8402