Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None | 0 0
  1. #/bin/bash
  2. #Ubuntu release mirror
  3. #mirror@dhakacom.com
  4.  
  5. fatal() {
  6.   echo "$1"
  7.   exit 1
  8. }
  9.  
  10. warn() {
  11.   echo "$1"
  12. }
  13.  
  14. # Find a source mirror near you which supports rsync on
  15. # https://launchpad.net/ubuntu/+cdmirrors
  16. # rsync://<iso-country-code>.rsync.releases.ubuntu.com/releases should always work
  17. RSYNCSOURCE=rsync://us1.releases.ubuntu.com/releases
  18.  
  19. # Define where you want the mirror-data to be on your mirror
  20. BASEDIR=/var/www/html/ubuntu-releases/
  21.  
  22. if [ ! -d ${BASEDIR} ]; then
  23.   warn "${BASEDIR} does not exist yet, trying to create it..."
  24.   mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed."
  25. fi
  26.  
  27. rsync --verbose --recursive --times --links --hard-links \
  28.   --stats --delete-after \
  29.   ${RSYNCSOURCE} ${BASEDIR} || fatal "Failed to rsync from ${RSYNCSOURCE}."
  30.  
  31. date -u > ${BASEDIR}/.trace/$(hostname -f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement