summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/just_fetch.pl59
1 files changed, 32 insertions, 27 deletions
diff --git a/scripts/just_fetch.pl b/scripts/just_fetch.pl
index 663ddbc..80e95ef 100755
--- a/scripts/just_fetch.pl
+++ b/scripts/just_fetch.pl
@@ -4,51 +4,58 @@ use strict ;
use LWP::Simple ; ;
use HTML::LinkExtor ;
-my $upstream_url = "http://grsecurity.net/test.php" ;
+my @upstream_url =
+(
+ "http://grsecurity.net/test.php",
+ "http://grsecurity.net/download_stable.php"
+) ;
my $file_pattern = "grsecurity-";
-my @allowed_suffixes = ( ".patch", ".patch.sig" ) ;
+my @allowed_suffixes = ( ".patch", ".patch.sig" ) ;
my %currently_available = () ;
sub sane
{
- my ( $name ) = @_ ;
+ my ( $name ) = @_ ;
- return 0 if $name eq "" ;
- return 0 if $name =~ / / ;
+ return 0 if $name eq "" ;
+ return 0 if $name =~ / / ;
- my $got_suffix = 0 ;
- foreach my $suffix ( @allowed_suffixes )
- {
- $got_suffix = 1 if $name =~ /$suffix$/ ;
- }
+ my $got_suffix = 0 ;
+ foreach my $suffix ( @allowed_suffixes )
+ {
+ $got_suffix = 1 if $name =~ /$suffix$/ ;
+ }
- return $got_suffix ;
+ return $got_suffix ;
}
sub get_currently_available
{
- my $parser ;
- my @links ;
+ my $parser ;
+ my @links ;
- $parser = HTML::LinkExtor->new( undef, $upstream_url ) ;
- $parser->parse( get( $upstream_url ) )->eof ;
+ foreach my $uurl ( @upstream_url )
+ {
+ $parser = HTML::LinkExtor->new( undef, $uurl ) ;
+ $parser->parse( get( $uurl ) )->eof ;
- @links = $parser->links ;
+ @links = $parser->links ;
- foreach my $ref ( @links )
- {
- my $file_url = ${$ref}[2] ;
- my $file_name = $file_url ;
- $file_name =~ s/^.*\/(.*)$/$1/ ;
+ foreach my $ref ( @links )
+ {
+ my $file_url = ${$ref}[2] ;
+ my $file_name = $file_url ;
+ $file_name =~ s/^.*\/(.*)$/$1/ ;
- next unless sane( $file_name ) ;
+ next unless sane( $file_name ) ;
- $currently_available{ $file_name } = $file_url ;
- }
+ $currently_available{ $file_name } = $file_url ;
+ }
+ }
}
@@ -71,7 +78,7 @@ sub download_newly_available
print "FAIL\n" ;
}
}
-
+
return $downloads ;
}
@@ -103,5 +110,3 @@ sub main
}
main() ;
-
-