diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-05-24 00:54:55 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-05-24 00:54:55 +0200 |
commit | 28cdc0d82c6159addc6d2a66449bc6bd2ef0bb71 (patch) | |
tree | f7ac8ff7173084130e9431fb830ce9c42ec81d76 /perl/contrib/mirror.pl | |
parent | 3a973517a915ce4ad408d239f9220b869ff8cf40 (diff) |
perl: remove subdir, not touched in 9 years
Diffstat (limited to 'perl/contrib/mirror.pl')
-rw-r--r-- | perl/contrib/mirror.pl | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/perl/contrib/mirror.pl b/perl/contrib/mirror.pl deleted file mode 100644 index 99e2709ac..000000000 --- a/perl/contrib/mirror.pl +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/perl - -# -# Author: Daniel Stenberg <daniel@haxx.se> -# Version: 0.1 -# Date: October 10, 2000 -# -# This is public domain. Feel free to do whatever you please with this script. -# There are no warranties whatsoever! It might work, it might ruin your hard -# disk. Use this on your own risk. -# -# PURPOSE -# -# This script uses a local directory to maintain a "mirror" of the curl -# packages listed in the remote curl web sites package list. Files present in -# the local directory that aren't present in the remote list will be removed. -# Files that are present in the remote list but not in the local directory -# will be downloaded and put there. Files present at both places will not -# be touched. -# -# WARNING: don't put other files in the mirror directory, they will be removed -# when this script runs if they don't exist in the remote package list! -# - -# this is the directory to keep all the mirrored curl files in: -$some_dir = $ARGV[0]; - -if( ! -d $some_dir ) { - print "$some_dir is not a dir!\n"; - exit; -} - -# path to the curl binary -$curl = "/home/danste/bin/curl"; - -# this is the remote file list -$filelist = "http://curl.haxx.se/download/curldist.txt"; - -# prepend URL: -$prepend = "http://curl.haxx.se/download"; - -opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; -@existing = grep { /^[^\.]/ } readdir(DIR); -closedir DIR; - -$LOCAL_FILE = 1; -$REMOTE_FILE = 2; - -# create a hash array -for(@existing) { - $allfiles{$_} |= $LOCAL_FILE; -} - -# get remote file list -print "Getting file list from $filelist\n"; -@remotefiles=`$curl -s $filelist`; - -# fill in the hash array -for(@remotefiles) { - chomp; - $allfiles{$_} |= $REMOTE_FILE; - $remote++; -} -if($remote < 10) { - print "There's something wrong. The remote file list seems too smallish!\n"; - exit; -} - -@sfiles = sort { $a cmp $b } keys %allfiles; - - -$leftalone = $downloaded = $removed = 0; -for(@sfiles) { - $file = $_; - $info = $allfiles{$file}; - - if($info == ($REMOTE_FILE|$LOCAL_FILE)) { - print "$file is LOCAL and REMOTE, left alone\n"; - $leftalone++; - } - elsif($info == $REMOTE_FILE) { - print "$file is only REMOTE, getting it...\n"; - system("$curl $prepend/$file -o $some_dir/$file"); - $downloaded++; - } - elsif($info == $LOCAL_FILE) { - print "$file is only LOCAL, removing it...\n"; - system("rm $some_dir/$file"); - $removed++; - } - else { - print "Problem, file $file was marked $info\n"; - } - $loops++; -} - -if(!$loops) { - print "No remote or local files were found!\n"; - exit; -} - -print "$leftalone files were already present\n", - "$downloaded files were added\n", - "$removed files were removed\n"; |