Bail out if architecture isn't set nor can be identified automatically
authorMichael Prokop <mika@grml.org>
Fri, 21 May 2021 14:28:49 +0000 (16:28 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 21 May 2021 14:32:07 +0000 (16:32 +0200)
If `dpkg --print-architecture` isn't available for detecting the current
architecture (e.g. on non-Debian), and neither $ARCH is set nor `--arch
...` was specified, abort and inform user about it.

Closes: grml/grml-debootstrap#173

grml-debootstrap

index d62cd2c..c31b5cd 100755 (executable)
@@ -1155,6 +1155,12 @@ else
    ARCHCMD="--arch $ARCH"
    ARCHINFO=" (${ARCH})"
 fi
+
+if [ -z "${ARCH:-}" ] ; then
+  eerror 'Architecture neither set (environment variable ARCH), nor could be automatically identified (using dpkg).'
+  eerror 'Consider setting the --arch ... option.' ; eend 1
+  bailout 1
+fi
 # }}}
 
 # It is not possible to build amd64 on i686. {{{