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

(-)a/install_misc/koha-debian-deps.pl (-1 / +94 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
22
a script to build a file containing a list of debian packages needed to install Koha - from ./debian.control
23
24
script must be run with --run arg, to execute
25
26
=cut
27
28
use Modern::Perl;
29
use List::MoreUtils qw(uniq);
30
use Parse::DebControl;
31
use C4::Context;
32
33
use Getopt::Long;
34
my $run,;
35
my $result = GetOptions( 'r|run' => \$run, );
36
37
if ( not $run ) {
38
    print_usage();
39
    exit 0;
40
}
41
42
my $parser = Parse::DebControl->new;
43
$parser->DEBUG();
44
45
my %opt = ( 'stripComments' => 1, );
46
my $debianControl = C4::Context->config('intranetdir') . '/debian/control';
47
my $data = $parser->parse_file( $debianControl, \%opt );
48
49
my $deps;
50
foreach my $p (@$data) {
51
    $deps .= $p->{'Depends'} . "\n" if $p->{'Depends'};
52
}
53
54
my @deps2;
55
56
foreach my $d ( split '\n', $deps ) {
57
58
    next if $d =~ qr/^\$/;
59
60
    $d =~ s/\|.*$//;
61
    $d =~ s/,//;
62
    $d =~ s/\"//;
63
    $d =~ s/^[ \t]+|[ \t]+$//g;
64
    $d .= "\n";
65
66
    push @deps2, $d;
67
}
68
69
my @uniq = uniq(@deps2);
70
print @uniq;
71
72
sub print_usage {
73
    print <<'_USAGE_';
74
75
this script outputs a list of debian packages for Koha, built from the ./debian.control file
76
77
so, something like...
78
 $ ./koha-debian-deps.pl -r > install_misc/debian.packages
79
80
then...
81
 $  aptitude install $( < install_misc/debian.packages)
82
83
or...
84
 $  apt-get install  $( < install_misc/debian.packages)
85
86
87
script must be run with --run arg, to execute
88
89
Parameters:
90
    --run or -r           run this script
91
_USAGE_
92
93
    return;
94
}

Return to bug 8402