Generalize build-debian-toolbox
authorMartin Pitt <martin@piware.de>
Mon, 9 Mar 2020 18:27:52 +0000 (19:27 +0100)
committerMartin Pitt <martin@piware.de>
Fri, 13 Mar 2020 07:05:02 +0000 (08:05 +0100)
Supply the release/container tag as argument.

Also avoid the "do you want to download?" question on create.

build-debian-toolbox [new file with mode: 0755]
build-sid-toolbox [deleted file]

diff --git a/build-debian-toolbox b/build-debian-toolbox
new file mode 100755 (executable)
index 0000000..1bb7781
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+set -eux
+
+RELEASE=${1:-sid}
+DISTRO=${2:-debian}
+
+toolbox rm -f $RELEASE || true
+toolbox -y create -c $RELEASE --image docker.io/$DISTRO:$RELEASE
+
+# can't do that with toolbox run yet, as we need to install sudo first
+podman start $RELEASE
+podman exec -it $RELEASE 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
+
+apt-get update
+apt-get install -y libnss-myhostname sudo eatmydata libcap2-bin
+'
+
+toolbox run --container $RELEASE sh -exc '
+# otherwise installing systemd fails
+sudo umount /var/log/journal
+
+sudo eatmydata apt-get -y dist-upgrade
+
+# development tools
+sudo eatmydata apt-get install -y --no-install-recommends git-buildpackage libwww-perl less vim lintian debhelper manpages-dev git dput pristine-tar bash-completion python-keyrings.alt wget gnupg ubuntu-dev-tools python3-debian
+'
+
+toolbox enter --container $RELEASE
diff --git a/build-sid-toolbox b/build-sid-toolbox
deleted file mode 100755 (executable)
index 386d394..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-set -eux
-
-toolbox rm -f sid || true
-toolbox create -c sid --image docker.io/debian:unstable
-
-# 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
-
-apt-get update
-apt-get install -y libnss-myhostname sudo eatmydata
-'
-
-toolbox run --container sid sh -exc '
-# otherwise installing systemd fails
-sudo umount /var/log/journal
-
-sudo eatmydata apt-get -y dist-upgrade
-
-# development tools
-sudo eatmydata apt-get install -y --no-install-recommends git-buildpackage libwww-perl less vim lintian debhelper manpages-dev git dput pristine-tar bash-completion python-keyrings.alt wget gnupg ubuntu-dev-tools python3-debian
-'
-
-toolbox enter --container sid