← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:feature/curtainer-support-minimal-images into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:feature/curtainer-support-minimal-images into curtin:master.

Commit message:
tools/curtainer: enable using ubuntu-minimal images

Ubuntu Minimal images are much smaller and run fewer things at
boot so they're ideal for the curtainer bootstrap environment for
extracting curtin source.  The minimal image does not have the
'add-apt-repository' command present so write out the daily ppa
source list file and import the PPA gpg key into apt.


Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/389431
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:feature/curtainer-support-minimal-images into curtin:master.
diff --git a/tools/curtainer b/tools/curtainer
index a6fdc1b..dec7500 100755
--- a/tools/curtainer
+++ b/tools/curtainer
@@ -160,6 +160,8 @@ main() {
         fail "$name did not become ready after $maxwait"
 
     inside "$name" which eatmydata >/dev/null || eatmydata=""
+    release=$(inside $name lsb_release -sc) ||
+        fail "$name did not have a lsb release codename"
 
     # curtin depends on zfsutils-linux via probert-storage, but zfsutils-linux
     # can't be installed in an unprivileged container as it fails to start
@@ -171,10 +173,9 @@ main() {
 
     if $proposed; then
         mirror=$(inside $name awk '$1 == "deb" { print $2; exit(0); }' \
-            /etc/apt/sources.list) &&
-            rel=$(inside $name lsb_release -sc) ||
+            /etc/apt/sources.list) ||
             fail "failed to get mirror in $name"
-        line="$mirror $rel-proposed main universe"
+        line="$mirror $release-proposed main universe"
         local fname="/etc/apt/sources.list.d/proposed.list"
         debug 1 "enabling proposed in $fname: deb $line"
         inside "$name" sh -c "echo deb $line > $fname" ||
@@ -187,9 +188,24 @@ main() {
     if $daily; then
         local daily_ppa="ppa:curtin-dev/daily"
         debug 1 "enabling daily: $daily_ppa"
-        inside "$name" add-apt-repository --enable-source --yes \
-            "${daily_ppa}" ||
-            fail "failed add-apt-repository for daily."
+        local addaptrepo="add-apt-repository"
+        inside "$name" which $addaptrepo >/dev/null || addaptrepo=""
+        if [ -n "${addaptrepo}" ]; then
+            inside "$name" ${addaptrepo} --enable-source --yes \
+                "${daily_ppa}" ||
+                fail "failed add-apt-repository for daily."
+        else
+            # https://launchpad.net/~curtin-dev/+archive/ubuntu/daily
+            local url=http://ppa.launchpad.net/curtin-dev/daily/ubuntu
+            local keyserver="keyserver.ubuntu.com"
+            local key=55FE7C8C0165013E
+            local fname=/etc/apt/sources.list.d/curtin-daily-ppa.list
+            inside "$name" sh -c "
+                echo deb $url $release main > $fname &&
+                gpg --keyserver $keyserver --recv $key &&
+                gpg --export --armour $key | apt-key add -" ||
+                fail "failed to add $daily_ppa repository manually"
+        fi
     fi
 
     line="Acquire::Languages \"none\";"

Follow ups