#! /usr/bin/env perl -w # update-simple-ca # create a new simple ca setup package which uses the more-secure sha1 hash # instead of the md5 hash which was the default in GT 4.0.7 and earlier and # GT 4.2.0 use strict; use Getopt::Long; use File::Temp qw/tempdir/; sub usage { my $rc = shift; print "update-simple-ca [SIMPLE-CA-DIR]\n"; exit(0); } my $help = 0; my $result = GetOptions("help" => \$help); if ($help) { usage(0); } elsif (!$result) { usage(1); } if (scalar(@ARGV) == 0) { push(@ARGV, "$ENV{HOME}/.globus/simpleCA"); } foreach my $cadir (@ARGV) { my $tarball = glob("$cadir/globus_simple_ca_*_setup-[0-9].[0-9][0-9].tar.gz"); my $tarname = $tarball; my $tempdir; my $pkgname = $tarball; if (! -r $tarball) { print STDERR "Error reading $tarball\n"; exit(1); } $tarname =~ s|.*/([^/]*)$|$1|; $pkgname =~ s|.*/([^/]*)\.tar\.gz$|$1|; $tempdir = tempdir(CLEANUP => 1); chdir $tempdir; system("gzcat $tarball | tar xf -"); chdir $pkgname; open(PATCH, "|patch"); print PATCH < $cadir/$pkgname-new.tar.gz "); }