Skip to content

Commit

Permalink
Use mmdebstrap as our only debootstrap implementation
Browse files Browse the repository at this point in the history
Simplify what we support.
  • Loading branch information
zeha committed Jan 30, 2025
1 parent 68c1be4 commit 383605e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 37 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ jobs:
- bullseye
- buster

debootstrap:
- debootstrap
- mmdebstrap

exclude:
# debootstrap in bullseye is too old.
- host_release: bullseye
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/
7 changes: 1 addition & 6 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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~),
Expand All @@ -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
Expand Down
16 changes: 9 additions & 7 deletions grml-debootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
}
# }}}

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion grml-debootstrap.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions tests/build-vm-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/docker-build-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions tests/docker-install-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ 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"

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"

0 comments on commit 383605e

Please sign in to comment.