From 50d8d5edae523866e4f3e7ad762cc3d5653f5e8e Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Thu, 12 Nov 2020 22:36:10 +0100 Subject: [PATCH] check whether dpkg, apt and others are installed (closes: #18) --- mmdebstrap | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mmdebstrap b/mmdebstrap index 9b5032e..efe9169 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -3953,6 +3953,20 @@ sub main() { error "invalid format. Choose from " . (join ', ', @valid_formats); } + foreach my $tool ('dpkg', 'dpkg-deb', 'apt-get', 'apt-cache', 'apt-config', + 'tar') { + my $found = 0; + foreach my $path (split /:/, $ENV{PATH}) { + if (-f "$path/$tool" && -x _ ) { + $found = 1; + last; + } + } + if (!$found) { + error "cannot find $tool"; + } + } + my $check_fakechroot_running = sub { # test if we are inside fakechroot already # We fork a child process because setting FAKECHROOT_DETECT seems to