setup-dchroot: merge from tor (genname split into function, ubuntu updates)
[mirror/dsa-puppet.git] / modules / schroot / files / setup-dchroot
index 1040212..c3cc504 100755 (executable)
@@ -72,6 +72,20 @@ do_cleanup() {
     done
 }
 
+genname() {
+    local suite="$1"; shift
+    local arch="$1"; shift
+
+    if [ -n "$sbuildnames" ]; then
+        local name="${suite}-${arch}-sbuild"
+    else
+        local name="${suite}_${arch}-dchroot"
+    fi
+
+    echo "$name"
+}
+
+
 genschrootconf() {
     local suite="$1"; shift
     local arch="$1"; shift
@@ -83,11 +97,7 @@ genschrootconf() {
         local suite="${suite}-${extra}"
     fi
 
-    if [ -n "$sbuildnames" ]; then
-        local name="${suite}-${arch}-sbuild"
-    else
-        local name="${suite}_${arch}-dchroot"
-    fi
+    local name="$(genname "$suite" "$arch")"
 
     local fullname="$name"
     case "$arch" in
@@ -393,6 +403,12 @@ if [ -n "$buildd" ] ; then
         ;;
     esac
 fi
+if [ -n "$ubuntu" ]; then
+  echo "deb $mirror ${suite}-updates main" >> "$rootdir/etc/apt/sources.list"
+  echo "deb $mirror ${suite}-security main" >> "$rootdir/etc/apt/sources.list"
+  chroot "$rootdir" apt-get update
+  chroot "$rootdir" apt-get dist-upgrade -y
+fi
 rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*"
 chroot "$rootdir" apt-get clean
 umount "$rootdir/dev" 2>/dev/null || true