Scripts

Differences between revisions 2 and 3
Revision 2 as of 2009-09-09 13:16:28
Size: 1455
Editor: gw
Comment:
Revision 3 as of 2009-09-09 13:19:02
Size: 1473
Editor: gw
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''Work in Progress!'''

Line 9: Line 12:
 #/bin/dash {{{
#/bin/dash
Line 11: Line 15:
 fatal() {
  echo "$1"
   exit 1
 }
fatal() {
  echo "$1"
  exit 1
}
Line 16: Line 20:
 # Find a source mirror near you which supports rsync on
 # https://launchpad.net/ubuntu/+archivemirrors
 # rsync://archive.ubuntu.com/ubuntu should always work
 RSYNCSOURCE=rsync://archive.ubuntu.com/ubuntu
# Find a source mirror near you which supports rsync on
# https://launchpad.net/ubuntu/+archivemirrors
# rsync://archive.ubuntu.com/ubuntu should always work
RSYNCSOURCE=rsync://archive.ubuntu.com/ubuntu
Line 21: Line 25:
 # Define where you want the mirror-data to be on your mirror
 BASEDIR=/var/www/ubuntuarchive/
# Define where you want the mirror-data to be on your mirror
BASEDIR=/var/www/ubuntuarchive/
rsync --recursive --times --links --hard-links \
  --stats \
  --exclude "Packages*" --exclude "Sources*" \
  --exclude "Release*" \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed"
Line 24: Line 33:
 rsync --recursive --times --links --hard-links \
   --stats \
   --exclude "Packages*" --exclude "Sources*" \
   --exclude "Release*" \
   ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed"

 rsync --recursive --times --links --hard-links \
   
--stats --delete --delete-after \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed"
rsync --recursive --times --links --hard-links \
  --stats --delete --delete-after \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed"
}}}

Work in Progress!

To be able to create a mirror people can rely on, you need to have all the files and you need them at the right moment. 'File not found'-errors cause a lot of issues and annoyances for users. This page provides you with scripts to sync from other mirrors and prevent 404's.

Archive mirrors

For archive mirrors, it is very important not to delete packages before the Packages.gz-files (which hold information about the packages available) are updated. Therefor, you need a 'Two stage sync'. This means that you download new packages first, and new Packages.gz after that. After you've downloaded the Packages.gz files, it's safe to delete old packages.

The script

#/bin/dash

fatal() {
  echo "$1"
  exit 1
}

# Find a source mirror near you which supports rsync on
# https://launchpad.net/ubuntu/+archivemirrors
# rsync://archive.ubuntu.com/ubuntu should always work
RSYNCSOURCE=rsync://archive.ubuntu.com/ubuntu

# Define where you want the mirror-data to be on your mirror
BASEDIR=/var/www/ubuntuarchive/
rsync --recursive --times --links --hard-links \
  --stats \
  --exclude "Packages*" --exclude "Sources*" \
  --exclude "Release*" \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed"

rsync --recursive --times --links --hard-links \
  --stats --delete --delete-after \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed"

Releases mirrors

Mirrors/Scripts (last edited 2017-10-17 23:22:07 by hloeung)