Check for existence of debootstrap binary after command line processing
authorMichael Prokop <mika@grml.org>
Fri, 13 Dec 2019 13:10:19 +0000 (14:10 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 13 Dec 2019 13:10:19 +0000 (14:10 +0100)
When invoking grml-debootstrap as user without /usr/sbin inside $PATH,
then the debootstrap binary will not be found and executing
`grml-debootstrap --version` fails with
`debootstrap not installed`.

Closes: https://github.com/grml/grml-debootstrap/issues/147

grml-debootstrap

index 6f9743c..4957e8f 100755 (executable)
@@ -335,10 +335,6 @@ stage() {
 }
 # }}}
 
-# make sure we have what we need {{{
-check4progs "${DEBOOTSTRAP}" || bailout 1
-# }}}
-
 # source main configuration file {{{
 if [ -r /etc/debootstrap/config ] ; then
   # shellcheck disable=SC1091
@@ -626,6 +622,8 @@ fi
 # }}}
 
 # make sure we have what we need {{{
+check4progs "${DEBOOTSTRAP}" || bailout 1
+
 if [ -n "$VIRTUAL" ] ; then
   check4progs kpartx parted qemu-img || bailout 1
 fi