a10fa91f6f226857107b957570d1f18a6f6fa627
[jalview.git] / utils / jarunsigner.pl
1 #!/usr/bin/perl
2 use strict;
3
4 # perverse script to get rid of unwanted jar signatures
5 use Cwd qw(abs_path);
6 use File::Temp qw(tempdir);
7
8 my $tempdir = tempdir( CLEANUP => 1);
9
10 my $jarfile;
11
12 my @jarfiles;
13
14 while (scalar @ARGV) {
15     my $jarfile = shift @ARGV;
16     ((-f $jarfile) and $jarfile=~/.+\.jar/) 
17         and push @jarfiles, abs_path($jarfile);
18 }
19 my $pwdir = `pwd`;
20 chdir($tempdir);
21
22 while (scalar @jarfiles) {
23     $jarfile = shift @jarfiles;
24     system("rm -Rf *");
25     system("jar xf $jarfile");
26     system("mv $jarfile $jarfile.bak");
27     system("find META-INF \\( -name \"*.SF\" \\) -exec rm -f \\{\\} \\;");
28     system("find META-INF \\( -name \"*.RSA\" \\) -exec rm -f \\{\\} \\;");
29     system("find META-INF \\( -name \"*.DSA\" \\) -exec rm -f \\{\\} \\;");
30     system("jar cf $jarfile *");
31 }
32
33 chdir($pwdir);