grml/grml-debootstrap

Architecture empty on systems without dpkg

Closed this issue · 0 comments

If using grml-debootstrap on non-Debian-based systems should be supported, then without dpkg being installed, the variable ARCH should be checked to be not-empty, so debootstrap is not called with --arch with no actual architecture.

 * Running debootstrap  for release bullseye () using http://deb.debian.org/debian
 * Executing: debootstrap --arch    bullseye /mnt/debootstrap.60629 http://deb.debian.org/debian
/usr/sbin/debootstrap: line 505: cd: http://deb.debian.org: No such file or directory
 -> Failed (rc=1)
 * Removing /var/cache/grml-debootstrap/stages_qemu-test-grml.img

The code:

# architecture setup {{{
if [ -n "$ARCH" ] ; then
ARCHCMD="--arch $ARCH"
ARCHINFO=" (${ARCH})"
else
ARCH="$(dpkg --print-architecture)"
ARCHCMD="--arch $ARCH"
ARCHINFO=" (${ARCH})"
fi
# }}}

Specifying the architecture explicitly, for example --arch amd64, fixes the problem.