From 383605e6f21d938f485dcb05c862321f66f8bb9e Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Wed, 29 Jan 2025 08:24:52 +0100 Subject: [PATCH] Use mmdebstrap as our only debootstrap implementation Simplify what we support. --- .github/workflows/test-build.yml | 11 +++-------- config | 7 +------ debian/control | 8 ++++---- grml-debootstrap | 16 +++++++++------- grml-debootstrap.8.txt | 2 +- tests/build-vm-and-test.sh | 6 +----- tests/docker-build-vm.sh | 4 ---- tests/docker-install-deb.sh | 4 ++-- 8 files changed, 21 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 8a62337..c6d101f 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -58,10 +58,6 @@ jobs: - bullseye - buster - debootstrap: - - debootstrap - - mmdebstrap - exclude: # debootstrap in bullseye is too old. - host_release: bullseye @@ -82,11 +78,10 @@ jobs: name: "Setup test environment" - run: ./tests/build-vm-and-test.sh run - name: "Build VM image using grml-debootstrap on host ${{matrix.host_release}} for ${{matrix.release}} using debootstrap=${{matrix.debootstrap}}" + name: "Build VM image using grml-debootstrap on host ${{matrix.host_release}} for ${{matrix.release}}" env: HOST_RELEASE: ${{matrix.host_release}} RELEASE: ${{matrix.release}} - DEBOOTSTRAP: ${{matrix.debootstrap}} - run: ./tests/build-vm-and-test.sh test id: build_vm_and_test_test @@ -98,7 +93,7 @@ jobs: uses: actions/upload-artifact@v4 if: always() && (steps.build_vm_and_test_test.outcome == 'failure') with: - name: vm-image-${{matrix.host_release}}-${{matrix.release}}-${{matrix.debootstrap}} + name: vm-image-${{matrix.host_release}}-${{matrix.release}} if-no-files-found: error path: qemu.img retention-days: 5 @@ -107,6 +102,6 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: vm-results-${{matrix.host_release}}-${{matrix.release}}-${{matrix.debootstrap}} + name: vm-results-${{matrix.host_release}}-${{matrix.release}} if-no-files-found: error path: tests/results/ diff --git a/config b/config index 9062908..224fd75 100644 --- a/config +++ b/config @@ -93,12 +93,7 @@ # Default: no default. # ROOTPASSWORD='' -# Name of debootstrap executable. -# Supported values: 'debootstrap', 'mmdebstrap' -# Default: 'mmdebstrap' -# DEBOOTSTRAP='mmdebstrap' - -# Pass extra options to debootstrap. +# Pass extra options to mmdebstrap. # Default: no default. # Usage example: # DEBOOTSTRAP_OPT='--include=debconf-utils,locales,pciutils --exclude=nano,tasksel,tasksel-data,iptables' diff --git a/debian/control b/debian/control index d9350b1..fe94a75 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,7 @@ Architecture: all Depends: bash (>= 4.3-11+deb8u2), debian-archive-keyring, - mmdebstrap | debootstrap (>= 1.0.65), + mmdebstrap, dosfstools, e2fsprogs, fdisk | util-linux (<< 2.29.2-3~), @@ -36,9 +36,9 @@ Recommends: kpartx, parted, qemu-utils, -Description: wrapper around debootstrap for installing pure Debian - Provides a wrapper suite around mmdebstrap or debootstrap - to ease installation of a pure Debian system. +Description: installer for pure Debian + Installation program for Debian, for bare-metal and virtual + machines. . Configuration can be done on the command line, in a dialog frontend or in /etc/debootstrap/config. You will get a pure Debian system diff --git a/grml-debootstrap b/grml-debootstrap index ba1a6ba..a3c3d88 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -48,7 +48,6 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$CONFFILES" ] || CONFFILES='/etc/debootstrap' [ -n "$DEBCONF" ] || DEBCONF='yes' [ -n "$DEBIAN_FRONTEND" ] || DEBIAN_FRONTEND='noninteractive' -[ -n "$DEBOOTSTRAP" ] || DEBOOTSTRAP='mmdebstrap' [ -n "$DEFAULT_LANGUAGE" ] || DEFAULT_LANGUAGE='en_US:en' [ -n "$DEFAULT_LOCALES" ] || DEFAULT_LOCALES='en_US.UTF-8' [ -n "$DISK_IDENTIFIER" ] || DISK_IDENTIFIER='26ada0c0-1165-4098-884d-aafd2220c2c6' @@ -298,7 +297,7 @@ cleanup() { # ugly, but make sure we really don't leave anything (/proc /proc and # /dev /dev are intended, trying to work around timing issues, see #657023) for ARG in /run/udev /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do - [ -x "$MNTPOINT"/bin/umount ] && { clean_chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true; } + [ -x "$MNTPOINT"/bin/umount ] && { clean_chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true; } umount "$MNTPOINT"/$ARG >/dev/null 2>&1 || true done @@ -631,6 +630,10 @@ if [ "${_opt_sshcopyid}" ] && [ "${_opt_sshcopyauth}" ] ; then bailout 1 fi +if [ -n "$DEBOOTSTRAP" ]; then + ewarn "The DEBOOTSTRAP setting is deprecated and will be ignored. Please remove it from your configuration." +fi + if [ "$DEBUG" = "true" ] ; then set -x fi @@ -655,7 +658,7 @@ fi # }}} # make sure we have what we need {{{ -check4progs "${DEBOOTSTRAP}" || bailout 1 +check4progs mmdebstrap || bailout 1 if [ -n "$VIRTUAL" ] ; then check4progs kpartx parted qemu-img || bailout 1 @@ -1664,10 +1667,10 @@ debootstrap_system() { eend 1 ; exit 1 fi - einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}" - einfo "Executing: $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR" + einfo "Running mmdebstrap $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}" + einfo "Executing: mmdebstrap $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR" # shellcheck disable=SC2086 - "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR" + mmdebstrap $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR" } # }}} @@ -1728,7 +1731,6 @@ preparechroot() { [ -n "$CONFFILES" ] && echo "CONFFILES='${CONFFILES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" [ -n "$DEBCONF" ] && echo "DEBCONF='${DEBCONF//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" [ -n "$DEBIAN_FRONTEND" ] && echo "DEBIAN_FRONTEND='${DEBIAN_FRONTEND//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" - [ -n "$DEBOOTSTRAP" ] && echo "DEBOOTSTRAP='${DEBOOTSTRAP//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" [ -n "$DEFAULT_LOCALES" ] && echo "DEFAULT_LOCALES='${DEFAULT_LOCALES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" [ -n "$DEFAULT_LANGUAGE" ] && echo "DEFAULT_LANGUAGE='${DEFAULT_LANGUAGE//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" [ -n "$EXTRAPACKAGES" ] && echo "EXTRAPACKAGES='${EXTRAPACKAGES//\'/\'\\\'\'}'" >> "$CHROOT_VARIABLES" diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index 114bb68..a9605f0 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -302,7 +302,7 @@ Set hostname to 'debian01' and password for user root to 'changeme'. Install Debian unstable/sid on /dev/sda6 and install bootmanager GRUB in MBR (master boot record) of /dev/sda. - DEBOOTSTRAP=mmdebstrap grml-debootstrap --target /dev/sda1 --grub /dev/sda + grml-debootstrap --target /dev/sda1 --grub /dev/sda Install default Debian release (bookworm) on /dev/sda1 and install bootmanager GRUB in MBR (master boot record) of /dev/sda. Use mmdebstrap instead of default debootstrap tool for bootstrapping. diff --git a/tests/build-vm-and-test.sh b/tests/build-vm-and-test.sh index 7d5f045..818c5a5 100755 --- a/tests/build-vm-and-test.sh +++ b/tests/build-vm-and-test.sh @@ -46,9 +46,6 @@ RELEASE="${RELEASE:-bookworm}" TARGET="${TARGET:-qemu.img}" -# debootstrap to use, default empty (let grml-debootstrap decide) -DEBOOTSTRAP="${DEBOOTSTRAP:-}" - if [ "$1" == "run" ]; then # Debian version on which grml-debootstrap will *run* HOST_RELEASE="${HOST_RELEASE:-bookworm}" @@ -63,10 +60,9 @@ if [ "$1" == "run" ]; then exec docker run --privileged --rm -i \ -v "$(pwd)":/code \ -e TERM="$TERM" \ - -e DEBOOTSTRAP="$DEBOOTSTRAP" \ -w /code \ debian:"$HOST_RELEASE" \ - bash -c './tests/docker-install-deb.sh '"$DEB_NAME"' '"$DEBOOTSTRAP"' && ./tests/docker-build-vm.sh '"$(id -u)"' '"/code/$TARGET"' '"$RELEASE" + bash -c './tests/docker-install-deb.sh '"$DEB_NAME"' && ./tests/docker-build-vm.sh '"$(id -u)"' '"/code/$TARGET"' '"$RELEASE" elif [ "$1" == "test" ]; then # run tests from inside Debian system diff --git a/tests/docker-build-vm.sh b/tests/docker-build-vm.sh index c98d8a6..bd7a0ce 100755 --- a/tests/docker-build-vm.sh +++ b/tests/docker-build-vm.sh @@ -15,10 +15,6 @@ HOST_UID="$1" TARGET="$2" RELEASE="$3" -if [ -n "${DEBOOTSTRAP:-}" ] && [ "${DEBOOTSTRAP:-}" != "debootstrap" ]; then - apt-get install -qq -y "${DEBOOTSTRAP}" -fi - set -x MIRROR='http://deb.debian.org/debian' diff --git a/tests/docker-install-deb.sh b/tests/docker-install-deb.sh index 36cf942..413f896 100755 --- a/tests/docker-install-deb.sh +++ b/tests/docker-install-deb.sh @@ -8,7 +8,7 @@ set -eu -o pipefail if [ "$#" -ne 2 ]; then echo "$0: Invalid arguments" >&2 - echo "Expect: $0 DEB_NAME DEBOOTSTRAP" >&2 + echo "Expect: $0 DEB_NAME" >&2 exit 1 fi DEB_NAME="$1" @@ -16,4 +16,4 @@ DEB_NAME="$1" apt-get update # docker images can be relatively old, especially for unstable. apt-get upgrade -qq -y -apt-get install -qq -y "$DEB_NAME" "$DEBOOTSTRAP" +apt-get install -qq -y "$DEB_NAME"