Merged back with mainline, added stevenk patch for clean urls that accept login info and port numbers, fixed minor

documentation, new default config options for postmirror.sh scripts
pull/2/head
Brandon Holtsclaw 15 years ago
parent 509319ec68
commit 827de8e9b1
  1. 7
      CHANGELOG
  2. 58
      apt-mirror
  3. 2
      debian/Debian-mirror.list
  4. 2
      debian/Ubuntu-mirror.list
  5. 9
      debian/changelog
  6. 9
      debian/copyright
  7. 8
      debian/postinst

@ -1,5 +1,12 @@
0.4.6
* minor cleanup to the documentation
* applied patch from Steve Kowalik ( stevenk@ubuntu.com ) to
allow user:pass@host ( http and ftp authenticated )
and port numbers in the url host:8080 etc
* Added ability to run a shell script after apt-mirror completes the
mirroring confg values "run_postmirror" 0/1
and "postmirror_script" /path/to/script.sh
* added rate_limit option ( closes sf.net bug #1729402 )
a value of 25 is equal to 25 Bytes/Second
a value of 25k is equal to 25 KiloBytes/Second

@ -28,14 +28,14 @@ Main features:
=head1 COMMENTS
apt-mirror uses F</etc/apt/mirror.list> as a configuration file.
By default it is tuned to official debian mirror in Finland. Change
By default it is tuned to official Debian or Ubuntu mirrors. Change
it for your needs.
After you setup the configuration file you may run as root:
# su - apt-mirror -c apt-mirror
Or uncomment line in F</etc/cron.d/apt-mirror> to enable daily mirror upgrades.
Or uncomment line in F</etc/cron.d/apt-mirror> to enable daily mirror updates.
=head1 FILES
@ -54,9 +54,22 @@ F</var/spool/apt-mirror/skel>
F</var/spool/apt-mirror/var>
Log files placed here. URLs and MD5 summs also here.
=head1 KNOWN BUGS
=head1 CONFIGURATION EXAMPLES
Do not specify default http port (80) explicitly. (i.e. deb http://server:80/ sid ...)
The mirror.list configuration supports many options, the file is well commented explinging each option.
here are some sample mirror configuration lines showing the various supported ways :
Normal:
deb http://example.com/debian stable main contrib non-free
Arch Specific: ( many other arch's are supported )
deb-powerpc http://example.com/debian stable main contrib non-free
HTTP and FTP Auth or non-standard port:
deb http://user:pass@example.com:8080/debian stable main contrib non-free
Source Mirroring:
deb-src http://example.com/debian stable main contrib non-free
=head1 ORIGINAL AUTHOR
@ -86,8 +99,10 @@ my %config_variables = (
"cleanscript" => '$var_path/clean.sh',
"_contents" => 1,
"_autoclean" => 0,
"_tilde" => 0
"limit_rate" => 100m
"_tilde" => 0,
"limit_rate" => '100m',
"run_postmirror" => 0,
"postmirror_script" => '$var_path/postmirror.sh'
);
my @config_binaries = ();
@ -370,14 +385,21 @@ sub remove_spaces($) {
}
}
sub sanitise_uri {
my $uri = shift;
$uri =~ s[^(\w+)://][];
$uri =~ s/^([^@]+)?@?// if $uri =~ /@/;
$uri =~ s&:\d+/&/&; # and port information
$uri =~ s/~/\%7E/g if get_variable("_tilde");
return $uri;
}
sub proceed_index_gz {
my $uri = shift;
my $index = shift;
my ($path, $package, $mirror, $files) = '';
$path = $uri;
$path =~ s[^(\w+)://][];
$path =~ s/~/\%7E/g if get_variable("_tilde");
$path = sanitise_uri($uri);
local $/ = "\n\n";
$mirror = get_variable("mirror_path") . "/" . $path;
@ -494,8 +516,8 @@ sub copy_file {
foreach (@index_urls) {
die("apt-mirror: invalid url in index_urls") unless s[^(\w+)://][];
copy_file(get_variable("skel_path") . "/$_", get_variable("mirror_path") . "/$_");
copy_file(get_variable("skel_path") . "/$_", get_variable("mirror_path") . "/$_") if(s/\.gz$//);
copy_file(get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_"));
copy_file(get_variable("skel_path") . "/" . sanitise_uri("$_"), get_variable("mirror_path") . "/" . sanitise_uri("$_")) if(s/\.gz$//);
}
@ -513,8 +535,7 @@ sub process_file {
my $file = shift;
$file =~ s[~][%7E]g if get_variable("_tilde");
return 1 if $skipclean{$file};
$file =~ s[%7E][~] if get_variable("_tilde");
push @rm_files, $file;
push @rm_files, sanitise_uri($file);
my (undef, undef, undef, undef, undef, undef, undef, $size, undef, undef, undef, undef, $blocks) = stat($file);
$unnecessary_bytes += $blocks * 512;
return 0;
@ -587,3 +608,14 @@ if(get_variable("_autoclean")) {
close CLEAN;
}
if(get_variable("run_postmirror")) {
print "Running the Post Mirror script ...\n";
print "(" . get_variable("postmirror_script") . ")\n\n";
if(-x get_variable("postmirror_script")){
system (get_variable("postmirror_script"));
} else {
system ('/bin/sh ' . get_variable("postmirror_script"));
}
print "\nPost Mirror script has completed. See above output for any possible errors.\n\n";
}

@ -9,6 +9,8 @@
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#

@ -9,6 +9,8 @@
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#

9
debian/changelog vendored

@ -1,9 +1,10 @@
apt-mirror (0.4.5-2) UNRELEASED; urgency=low
apt-mirror (0.4.6-0) UNRELEASED; urgency=low
[ Brandon Holtsclaw ]
*
* New Upstream Release
* updated debian/*-mirror.list to reflect new upsteam options
* added postmirror.sh creation in postinst
-- Brandon Holtsclaw <brandon@imbrandon.com> Sat, 01 Dec 2007 04:15:24 -0600
-- Brandon Holtsclaw <brandon@imbrandon.com> Thu, 27 Dec 2007 01:55:18 -0600
apt-mirror (0.4.5-1) unstable; urgency=low

9
debian/copyright vendored

@ -5,13 +5,12 @@ Mon, 10 Jul 2006 12:44:33 -0500.
It was downloaded from http://apt-mirror.sourceforge.net/
Copyright (C) 2005 Dmitry N. Hramstov <hdn@nsu.ru>
Copyright 2005,2006,2007 Dmitry N. Hramstov <hdn@nsu.ru>
Copyright 2007 Brandon Holtsclaw <brandon@imbrandon.com>
Upstream Author:
Dmitry N. Hramtsov <hdn@nsu.ru>
Copyright Holder:
Upstream Authors:
Dmitry N. Hramtsov <hdn@nsu.ru>
Brandon Holtsclaw <brandon@imbrandon.com>
License:

8
debian/postinst vendored

@ -17,19 +17,25 @@ setup_aptmirror_user() {
setup_aptmirror_clean() {
touch /var/spool/apt-mirror/var/clean.sh
chown apt-mirror:apt-mirror /var/spool/apt-mirror/var/clean.sh
chmod +x /var/spool/apt-mirror/var/clean.sh
}
setup_postmirror_script() {
touch /var/spool/apt-mirror/var/postmirror.sh
chmod +x /var/spool/apt-mirror/var/postmirror.sh
}
set_aptmirror_owner() {
chown apt-mirror:apt-mirror /var/spool/apt-mirror
chown apt-mirror:apt-mirror /var/spool/apt-mirror/mirror
chown apt-mirror:apt-mirror /var/spool/apt-mirror/skel
chown apt-mirror:apt-mirror /var/spool/apt-mirror/var
chown apt-mirror:apt-mirror /var/spool/apt-mirror/var/clean.sh
chown apt-mirror:apt-mirror /var/spool/apt-mirror/var/postmirror.sh
}
setup_aptmirror_user
setup_aptmirror_clean
setup_postmirror_script
set_aptmirror_owner

Loading…
Cancel
Save