Skip to content
Permalink
Browse files

creatensis.pl: check md5sums

  • Loading branch information
jef-n committed Feb 25, 2014
1 parent 29e9272 commit af17dbf3b2bcbf638e7976aa6291c64a8804c38e
Showing with 36 additions and 6 deletions.
  1. +36 −6 ms-windows/osgeo4w/creatensis.pl
@@ -47,7 +47,7 @@

pod2usage(1) if $help;

my $wgetopt = $verbose ? "" : "-q";
my $wgetopt = $verbose ? "" : "-nv";

unless(-f "nsis/System.dll") {
mkdir "nsis", 0755 unless -d "nsis";
@@ -70,21 +70,29 @@
my %file;
my %lic;
my %sdesc;
my %md5;
my $package;

system "wget $wgetopt -O setup.ini -c $root$archpath/$ininame";
die "download of setup.ini failed" if $?;
open F, "setup.ini" || die "setup.ini not found";
while(<F>) {
my $file;
my $md5;

chop;
if(/^@ (\S+)/) {
$package = $1;
} elsif( /^requires: (.*)$/ ) {
@{$dep{$package}} = split / /, $1;
} elsif( /^install:\s+(\S+)\s+/) {
$file{$package} = $1 unless exists $file{$package};
} elsif( /^license:\s+(\S+)\s+/) {
$lic{$package} = $1 unless exists $lic{$package};
} elsif( ($file,$md5) = /^install:\s+(\S+)\s+.*\s+(\S+)$/) {
$file{$package} = $file unless exists $file{$package};
$file =~ s/^.*\///;
$md5{$file} = $md5 unless exists $md5{$file};
} elsif( ($file,$md5) = /^license:\s+(\S+)\s+.*\s+(\S+)$/) {
$lic{$package} = $file unless exists $lic{$package};
$file =~ s/^.*\///;
$md5{$file} = $md5 unless exists $md5{$file};
} elsif( /^sdesc:\s*"(.*)"\s*$/) {
$sdesc{$package} = $1 unless exists $sdesc{$package};
}
@@ -145,6 +153,28 @@ sub getDeps {
print "Downloading $file [$f]...\n" if $verbose;
system "wget $wgetopt -c $f";
die "download of $f failed" if $?;

if( exists $md5{$file} ) {
my $md5;
open F, "md5sum $file|";
while(<F>) {
if( /^(\S+)\s+$file$/ ) {
$md5 = $1;
}
}
close F;

die "No md5sum of $p determined" unless defined $md5;
if( $md5 eq $md5{$file} ) {
print "md5sum of $file verified.\n" if $verbose;
} else {
die "md5sum mismatch for $file [$md5 vs $md5{$file{$p}}]"
}
}
else
{
die "md5sum for $file not found.\n";
}
}
}

@@ -398,7 +428,7 @@ sub getDeps {
$cmd .= " QGIS-Installer.nsi";

system $cmd;
die "running nsis failed" if $?;
die "running nsis failed [$cmd]" if $?;

open P, ">osgeo4w/binary$archpostfix-$version";
print P $binary;

0 comments on commit af17dbf

Please sign in to comment.
You can’t perform that action at this time.