chiark / gitweb /
grep-my-excuses: monitor grub
[bin.git] / ubuntu-daily
index 9a41f4c4c2e11449ab24f511a953b460dbefc27e..43d56e76316f1f11d6a7ca0265ef60cad71563bf 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
 
 PROJECT=
-CURRENT_DIST=natty
+CURRENT_DIST=oneiric
 DIST="$CURRENT_DIST"
-BASE=antimony:cdimage/www/full
+BASE=cdimage.ubuntu.com::cdimage
 RSYNC=false
 HTTP=false
 
@@ -13,14 +13,14 @@ Usage: $0 [options] image_type architecture
 
 Options:
   -f|--flavour FLAVOUR         Flavour (default: ubuntu).
-  -d|--dist DIST               Distribution (default: natty).
-  -a|--anonymous               Don't use privileged access.
+  -d|--dist DIST               Distribution (default: oneiric).
+  -a|--authenticated           Use privileged access.
   -r|--rsync                   Force rsync.
   -h|--http                    Force HTTP only (no reuse).
 EOF
 }
 
-eval set -- "$(getopt -o f:d:arh -l help,flavour:,dist:,anonymous,rsync,http -- "$@")" || { usage >&2; exit 2; }
+eval set -- "$(getopt -o f:d:arh -l help,flavour:,dist:,authenticated,rsync,http -- "$@")" || { usage >&2; exit 2; }
 while :; do
        case $1 in
                --help)
@@ -38,8 +38,8 @@ while :; do
                        DIST="$2"
                        shift 2
                        ;;
-               -a|--anonymous)
-                       BASE=cdimage.ubuntu.com::cdimage
+               -a|--authenticated)
+                       BASE=antimony:cdimage/www/full
                        shift
                        ;;
                -r|--rsync)
@@ -59,14 +59,7 @@ if $HTTP; then
        BASE="http://cdimage.ubuntu.com"
 fi
 
-case $2 in
-       hppa*|ia64*|lpia*|powerpc*|sparc*)
-               PREFIX=ports/
-               ;;
-       *)
-               PREFIX=
-               ;;
-esac
+PREFIX=
 if [ "$DIST" != "$CURRENT_DIST" ]; then
        PREFIX="$DIST/$PREFIX"
 fi
@@ -102,7 +95,7 @@ case $1 in
 esac
 
 case $1 in
-       install|alternate|server|addon|serveraddon|dvd) ;;
+       install|alternate|server|addon|serveraddon)     ;;
        *)
                $HTTP || RSYNC=:
                ;;
@@ -121,16 +114,49 @@ else
                sed -i "s/=$DIST-$1-$2/=$PROJECT-$DIST-$1-$2/g" "$LOCAL.jigdo"
        fi
        rsync -avP "$REMOTE.template" "$LOCAL.template"
+
+       mkdir -p old
+
        EXISTING=false
+       MOUNTS=
+
+       do_mount () {
+               mkdir -p "old/$1"
+               MOUNTS="${MOUNTS:+$MOUNTS }$1"
+               sudo mount -o loop,ro "$1" "old/$1"
+       }
+
+       cleanup () {
+               trap - EXIT HUP INT QUIT TERM
+
+               local mount
+
+               for mount in $MOUNTS; do
+                       sudo umount "old/$mount"
+                       rmdir -p --ignore-fail-on-non-empty "old/$mount"
+               done
+
+               if $EXISTING; then
+                       rm -f "$LOCAL.iso.old"
+               fi
+       }
+       trap cleanup EXIT HUP INT QUIT TERM
+
        if [ -e "$LOCAL.iso" ]; then
                EXISTING=:
                mv "$LOCAL.iso" "$LOCAL.iso.old"
-               mkdir -p "old-$2"
-               sudo mount -o loop "$LOCAL.iso.old" "old-$2"
-       fi
-       ionice -c2 -n7 jigdo-lite "$LOCAL.jigdo"
-       if $EXISTING; then
-               sudo umount "old-$2" || true
-               rm -f "$LOCAL.iso.old"
+               do_mount "$LOCAL.iso.old"
        fi
+
+       for iso in *"$DIST"-*.iso; do
+               case $iso in
+                       *-install-*|*-alternate-*|*-server-*|*-addon-*|*-serveraddon-*) ;;
+                       *)
+                               continue
+                               ;;
+               esac
+               do_mount "$iso"
+       done
+
+       ionice -c2 -n7 jigdo-lite --scan "$PWD/old" "$LOCAL.jigdo"
 fi