apply version 2.7 copyright
[jalview.git] / utils / jarunsigner.pl
1 #*******************************************************************************
2 # Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 # Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
4 #
5 # This file is part of Jalview.
6 #
7 # Jalview is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License 
9 # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10 #
11 # Jalview is distributed in the hope that it will be useful, but 
12 # WITHOUT ANY WARRANTY; without even the implied warranty 
13 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14 # 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 with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17 #*******************************************************************************
18 #!/usr/bin/perl
19 use strict;
20
21 # Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
22 # Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
23
24 # This file is part of Jalview.
25
26 # Jalview is free software: you can redistribute it and/or
27 # modify it under the terms of the GNU General Public License 
28 # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
29
30 # Jalview is distributed in the hope that it will be useful, but 
31 # WITHOUT ANY WARRANTY; without even the implied warranty 
32 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
33 # PURPOSE.  See the GNU General Public License for more details.
34
35 # You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
36
37
38 # perverse script to get rid of unwanted jar signatures
39 use Cwd qw(abs_path);
40 use File::Temp qw(tempdir);
41
42 my $tempdir = tempdir( CLEANUP => 1);
43
44 my $jarfile;
45
46 my @jarfiles;
47
48 while (scalar @ARGV) {
49     my $jarfile = shift @ARGV;
50     ((-f $jarfile) and $jarfile=~/.+\.jar/) 
51         and push @jarfiles, abs_path($jarfile);
52 }
53 my $pwdir = `pwd`;
54 chdir($tempdir);
55
56 while (scalar @jarfiles) {
57     $jarfile = shift @jarfiles;
58     system("rm -Rf *");
59     system("jar xf $jarfile");
60     system("mv $jarfile $jarfile.bak");
61     system("find META-INF \\( -name \"*.SF\" \\) -exec rm -f \\{\\} \\;");
62     system("find META-INF \\( -name \"*.RSA\" \\) -exec rm -f \\{\\} \\;");
63     system("find META-INF \\( -name \"*.DSA\" \\) -exec rm -f \\{\\} \\;");
64     system("jar cf $jarfile *");
65 }
66
67 chdir($pwdir);