From 8ada760c71154bddbe031ed2ded5f6bae10aaddf Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 27 Mar 2007 20:23:31 +1000 Subject: [PATCH] Added the following scripts: * ubuntu-sync - A script to help ease the task of downloading ubuntu daily CD images. (Needs work) * ubuntu-cd - A script to make it easier to download pre-release milestone CDs of Ubuntu releases (Needs work) --- ubuntu-cd | 24 ++++++++++++ ubuntu-sync | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100755 ubuntu-cd create mode 100755 ubuntu-sync diff --git a/ubuntu-cd b/ubuntu-cd new file mode 100755 index 0000000..c42743c --- /dev/null +++ b/ubuntu-cd @@ -0,0 +1,24 @@ +#!/bin/bash + +# Get the latest CD snapshot release. +Distro=$1 +Ver=feisty +Code=herd + +cd ~/distros/ubuntu/${Distro}/${Ver} +mkdir -p ${Code}-$2 +cd ${Code}-$2 + +cp ../*.iso . + +if [ "${Distro}" == "ubuntu" ]; then + rsync rsync://cdimage.ubuntu.com/cdimage/releases/${Ver}/${Code}-$2/${Ver}-alternate-i386.iso ${Ver}-alternate-i386.iso + rsync rsync://cdimage.ubuntu.com/cdimage/releases/${Ver}/${Code}-$1/${Ver}-desktop-i386.iso ${Ver}-desktop-i386.iso + #rsync rsync://cdimage.ubuntu.com/cdimage/releases/${Ver}/${Code}-$1/${Ver}-alternate-powerpc.iso ${Ver}-alternate-powerpc.iso + #rsync rsync://cdimage.ubuntu.com/cdimage/releases/${Ver}/${Code}-$1/${Ver}-desktop-powerpc.iso ${Ver}-desktop-powerpc.iso +else + rsync rsync://cdimage.ubuntu.com/cdimage/${Distro}/releases/${Ver}/${Code}-$2/${Ver}-alternate-i386.iso ${Ver}-alternate-i386.iso + rsync rsync://cdimage.ubuntu.com/cdimage/${Distro}/releases/${Ver}/${Code}-$1/${Ver}-desktop-i386.iso ${Ver}-desktop-i386.iso + #rsync rsync://cdimage.ubuntu.com/cdimage/${Distro}/releases/${Ver}/${Code}-$1/${Ver}-alternate-powerpc.iso ${Ver}-alternate-powerpc.iso + #rsync rsync://cdimage.ubuntu.com/cdimage/${Distro}/releases/${Ver}/${Code}-$1/${Ver}-desktop-powerpc.iso ${Ver}-desktop-powerpc.iso +fi diff --git a/ubuntu-sync b/ubuntu-sync new file mode 100755 index 0000000..d311f81 --- /dev/null +++ b/ubuntu-sync @@ -0,0 +1,103 @@ +#!/bin/bash + +# Syncronise new ubuntu CD images, depending on command-line flags given. +# If none are given, sync all images. + +if [ -e /tmp/ubuntu-sync.01532-lock ]; then + echo "Another copy of the script is running." + exit 1 +fi + +Ubuntu_Distro_Dir=$HOME/distros/ubuntu +Dist=feisty + +# Only sync the oldest images, and only i386 images if low bandwidth. +Low_Bandwidth=1 + +while [ "$1" ]; do + case "$1" in + -u) + Image_Sets="${Image_Sets} ubuntu" + shift 1 + break + ;; + -k) + Image_Sets="${Image_Sets} kubuntu" + shift 1 + break + ;; + -e) + Image_Sets="${Image_Sets} edubuntu" + shift 1 + break + ;; + -x) + Image_Sets="${Image_Sets} xubuntu" + shift 1 + break + ;; + -s) + Image_Sets="${Image_Sets} ubuntu-server" + shift 1 + break + ;; + esac +done +if [ "${Low_Bandwidth}" == 1 ] && [ "${Image_Sets}" == "" ]; then + cd ${Ubuntu_Distro_Dir} + Image_Sets=`ls -td1 */${Dist} | tail -1 | cut -f 1 -d /` +elif [ "${Low_Bandwidth}" == 0 ] && [ "${Image_Sets}" == "" ]; then + Image_Sets="ubuntu xubuntu ubuntu-server edubuntu kubuntu" +fi + +# Sync images. +if [ ! -e /tmp/ubuntu-sync.01532-lock ]; then + touch /tmp/ubuntu-sync.01532-lock +fi +for Current_Set in ${Image_Sets} +do +cd ${Ubuntu_Distro_Dir}/${Current_Set}/${Dist} +Rsync_Options="--partial-dir=${Ubuntu_Distro_Dir}/${Current_Set}/${Dist}/.partial" + if [ "${Current_Set}" == "ubuntu" ]; then + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/daily/current/${Dist}-alternate-i386.iso ${Dist}-alternate-i386.iso ; then + date > alternate-i386-sync + fi + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/daily-live/current/${Dist}-desktop-i386.iso ${Dist}-desktop-i386.iso ; then + date > desktop-i386-sync + fi + if [ "${Low_Bandwidth}" == 0 ]; then + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/ports/daily/current/${Dist}-alternate-powerpc.iso ${Dist}-alternate-powerpc.iso ; then + date > alternate-powerpc-sync + fi + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/ports/daily-live/current/${Dist}-desktop-powerpc.iso ${Dist}-desktop-powerpc.iso ; then + date > desktop-powerpc-sync + fi + fi + else + if [ "${Current_Set}" == "edubuntu" ]; then + Install=install + Live=live + elif [ "${Current_Set}" == "ubuntu-server" ]; then + Install=server + Live=live + else + Install=alternate + Live=desktop + fi + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/${Current_Set}/daily/current/${Dist}-${Install}-i386.iso ${Dist}-${Install}-i386.iso ; then + date > ${Install}-i386-sync + fi + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/${Current_Set}/daily-live/current/${Dist}-${Live}-i386.iso ${Dist}-${Live}-i386.iso ; then + date > ${Live}-i386-sync + fi + if [ "${Low_Bandwidth}" == 0 ]; then + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/${Current_Set}/daily/current/${Dist}-${Install}-powerpc.iso ${Dist}-${Install}-powerpc.iso ; then + date > ${Install}-powerpc-sync + fi + if rsync ${Rsync_Options} rsync://cdimage.ubuntu.com/cdimage/${Current_Set}/daily-live/current/${Dist}-${Live}-powerpc.iso ${Dist}-${Live}-powerpc.iso ; then + date > ${Live}-powerpc-sync + fi + fi + fi +done +rm /tmp/ubuntu-sync.01532-lock