build-sid-toolbox: Eliminate intermediate container image
authorMartin Pitt <martin@piware.de>
Wed, 26 Feb 2020 23:08:18 +0000 (00:08 +0100)
committerMartin Pitt <martin@piware.de>
Wed, 26 Feb 2020 23:08:18 +0000 (00:08 +0100)
This can be done just as well through podman exec.

build-sid-toolbox

index a31b0b13442ea01915fc4976bebb3669139e8d0c..386d394d0bee049428471d8fb4024c39151772f1 100755 (executable)
@@ -2,33 +2,24 @@
 set -eux
 
 toolbox rm -f sid || true
-podman rm build-toolbox-sid || true
-podman rmi -f toolbox-sid || true
+toolbox create -c sid --image docker.io/debian:unstable
 
-podman run -i --name build-toolbox-sid debian:unstable <<EOF
-# toolbox hashbang is /usr/bin/sh
-ln -s /bin/sh /usr/bin/sh
+# can't do that with toolbox run yet, as we need to install sudo first
+podman start sid
+podman exec -it sid sh -exc '
 # https://bugzilla.redhat.com/show_bug.cgi?id=1785244
 if [ ! -e /etc/resolv.conf ]; then
     ln -sfn /run/host/monitor/resolv.conf /etc/resolv.conf
 fi
 
 # go-faster apt/dpkg
-echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/unsafe-io
+echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/unsafe-io
 
 apt-get update
 apt-get install -y libnss-myhostname sudo eatmydata
-EOF
-podman commit build-toolbox-sid toolbox-sid
-podman rm build-toolbox-sid
+'
 
-toolbox create -c sid --image localhost/toolbox-sid
-# again https://bugzilla.redhat.com/show_bug.cgi?id=1785244
 toolbox run --container sid sh -exc '
-# https://bugzilla.redhat.com/show_bug.cgi?id=1785244
-if [ ! -e /etc/resolv.conf ]; then
-    sudo ln -sfn /run/host/monitor/resolv.conf /etc/resolv.conf
-fi
 # otherwise installing systemd fails
 sudo umount /var/log/journal