]> piware.de Git - bin.git/blobdiff - build-debian-toolbox
build-cockpit-toolbox: tasks container moved to ghcr.io
[bin.git] / build-debian-toolbox
index 821b52b91411e29567eeab944a9fb649b695b8cc..c1d139a16568c43822de73cd9cf3a268209fc71a 100755 (executable)
@@ -5,39 +5,52 @@ RELEASE=${1:-sid}
 DISTRO=${2:-debian}
 
 toolbox rm -f $RELEASE || true
+podman pull docker.io/$DISTRO:$RELEASE
 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, https://github.com/containers/toolbox/pull/380
-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
 
+# otherwise installing systemd fails
+umount /var/log/journal
+
+# enable sources
+if [ -e /etc/apt/sources.list.d/debian.sources ]; then
+    sed -i "/^Types:/ s/deb$/deb deb-src/" /etc/apt/sources.list.d/debian.sources
+fi
+
 apt-get update
 apt-get install -y libnss-myhostname sudo eatmydata libcap2-bin
 
 # allow sudo with empty password
 sed -i "s/nullok_secure/nullok/" /etc/pam.d/common-auth
+
+# unbreak slow host name resolution
+sed -i "/^hosts:/ s/files dns myhostname/files myhostname dns/" /etc/nsswitch.conf
 '
 
 toolbox run --container $RELEASE sh -exc '
-# otherwise installing systemd fails
-sudo umount /var/log/journal
-
 # useful hostname
 . /etc/os-release
 echo "${ID}-${VERSION_ID:-sid}" | sudo tee /etc/hostname
 sudo hostname -F /etc/hostname
 
-sudo eatmydata apt-get -y dist-upgrade
+sudo DEBIAN_FRONTEND=noninteractive 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 wget gnupg ubuntu-dev-tools python3-debian fakeroot libdistro-info-perl
+sudo eatmydata apt-get install -y --no-install-recommends build-essential git-buildpackage libwww-perl less vim lintian debhelper manpages-dev git dput pristine-tar bash-completion wget gnupg ubuntu-dev-tools python3-debian fakeroot libdistro-info-perl openssh-client flatpak-xdg-utils
+
+# autopkgtest
+sudo eatmydata apt-get install -y --no-install-recommends autopkgtest qemu-system-x86 qemu-utils genisoimage
+
+# commands to forward to the host
+for cmd in podman toolbox; do
+    printf "#!/bin/sh\n/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host $cmd \42\$@\42\n" | sudo tee /usr/local/bin/$cmd >/dev/null
+    sudo chmod a+x /usr/local/bin/$cmd
+done
 '
 
 toolbox enter --container $RELEASE