chiark / gitweb /
ubuntu-daily: add -h/--http option
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Thu, 18 Nov 2010 12:49:03 +0000 (12:49 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Thu, 18 Nov 2010 12:49:03 +0000 (12:49 +0000)
ubuntu-daily

index d114322..177160c 100755 (executable)
@@ -5,6 +5,7 @@ CURRENT_DIST=maverick
 DIST="$CURRENT_DIST"
 BASE=antimony:cdimage/www/full
 RSYNC=false
+HTTP=false
 
 usage () {
        cat <<EOF
@@ -15,10 +16,11 @@ Options:
   -d|--dist DIST               Distribution (default: maverick).
   -a|--anonymous               Don't use privileged access.
   -r|--rsync                   Force rsync.
+  -h|--http                    Force HTTP only (no reuse).
 EOF
 }
 
-eval set -- "$(getopt -o f:d:ar -l help,flavour:,dist:,anonymous,rsync -- "$@")" || { usage >&2; exit 2; }
+eval set -- "$(getopt -o f:d:arh -l help,flavour:,dist:,anonymous,rsync,http -- "$@")" || { usage >&2; exit 2; }
 while :; do
        case $1 in
                --help)
@@ -44,11 +46,19 @@ while :; do
                        RSYNC=:
                        shift
                        ;;
+               -h|--http)
+                       HTTP=:
+                       shift
+                       ;;
                --)     shift; break ;;
                *)      usage >&2; exit 2;
        esac
 done
 
+if $HTTP; then
+       BASE="http://cdimage.ubuntu.com"
+fi
+
 case $2 in
        hppa*|ia64*|lpia*|powerpc*|sparc*)
                PREFIX=ports/
@@ -94,7 +104,7 @@ esac
 case $1 in
        install|alternate|server|addon|serveraddon|dvd) ;;
        *)
-               RSYNC=:
+               $HTTP || RSYNC=:
                ;;
 esac
 
@@ -103,6 +113,8 @@ REMOTE="$BASE/${PROJECT:+$PROJECT/}$IMAGE_TYPE/current/$DIST-$1-$2"
 
 if $RSYNC; then
        ionice -c2 -n7 rsync -avP "$REMOTE.$EXTENSION" "$LOCAL.$EXTENSION"
+elif $HTTP; then
+       wget -O "$LOCAL.$EXTENSION" "$REMOTE.$EXTENSION"
 else
        rsync -avP "$REMOTE.jigdo" "$LOCAL.jigdo"
        if [ "$PROJECT" ]; then