From e1d0a17751665f5f71ecbcc8a8e52f534dd14d82 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 3 May 2020 15:06:24 +0200 Subject: [PATCH] return immediately if nothing to do in download, extract and essential stages --- mmdebstrap | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mmdebstrap b/mmdebstrap index a8d940b..6d8aeab 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1696,6 +1696,11 @@ sub run_download() { # (essential variant) then we have to compute the package set ourselves. # Same if we want to install priority based variants. if (any { $_ eq $options->{variant} } ('extract', 'custom')) { + if (scalar @pkgs_to_install == 0) { + info "nothing to download -- skipping..."; + return ([], []); + } + if ($options->{dryrun}) { info "simulate downloading packages with apt..."; } else { @@ -1902,6 +1907,11 @@ sub run_extract() { return; } + if (scalar @{$essential_pkgs} == 0) { + info "nothing to extract -- skipping..."; + return; + } + info "extracting archives..."; print_progress 0.0; my $counter = 0; @@ -2137,6 +2147,11 @@ sub run_essential() { my $essential_pkgs = shift; my $chrootcmd = shift; + if (scalar @{$essential_pkgs} == 0) { + info "no essential packages -- skipping..."; + return; + } + if ($options->{mode} eq 'chrootless') { if ($options->{dryrun}) { info "simulate installing packages...";