]> git.proxmox.com Git - dab.git/commitdiff
bootstrap: add simple include/exclude mechanism
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 29 Sep 2021 12:56:22 +0000 (14:56 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 29 Sep 2021 12:56:25 +0000 (14:56 +0200)
Similar to the one from debootstrap, but we do not guarantee 100%
compat.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
DAB.pm
dab

diff --git a/DAB.pm b/DAB.pm
index 1f1bb3055b9de5477e3805090470d92ad7c619e8..3c86518d611c63e782cd68f02d5614cc18decc03 100644 (file)
--- a/DAB.pm
+++ b/DAB.pm
@@ -1376,11 +1376,19 @@ sub bootstrap {
     my $standard;
 
     my $mta = $opts->{exim} ? 'exim' : 'postfix';
-
     if ($mta eq 'postfix') {
        push @$important, "postfix";
     }
 
+    if ($opts->{include}) {
+       push @$important, split(',', $opts->{include});
+    }
+
+    my $exclude = {};
+    if ($opts->{exclude}) {
+       $exclude->{$_} = 1 for split(',', $opts->{exclude});
+    }
+
     foreach my $p (sort keys %$pkginfo) {
        next if grep { $p eq $_ } @{$self->{excl}};
        my $pri = $pkginfo->{$p}->{priority};
@@ -1389,6 +1397,7 @@ sub bootstrap {
        next if $p =~ m/(selinux|semanage|policycoreutils)/;
 
        push @$required, $p  if $pri eq 'required';
+       next if $exclude->{$p};
        push @$important, $p if $pri eq 'important';
        push @$standard, $p if $pri eq 'standard' && !$opts->{minimal};
     }
diff --git a/dab b/dab
index 6f30dc30d2b3c5b17fc2f06c6c7a6f30e6323bf3..75b4bafe1103a88c0ba7d995e9007cfff007ec36 100755 (executable)
--- a/dab
+++ b/dab
@@ -11,7 +11,7 @@ $ENV{'LC_ALL'} = 'C';
 
 my $commands = {
     'init' => '',
-    'bootstrap' => '[--exim] [--minimal]',
+    'bootstrap' => '[--exim] [--include <a[,b..]]>] --exclude [<a[,b..]]>] [--minimal]',
     'finalize' => '[--keepmycnf] [--compressor <gz (default)|zst>]',
     'veid' => '',
     'basedir' => '',
@@ -83,7 +83,7 @@ eval {
 
     } elsif ($cmd eq 'bootstrap') {
        my $opts = {};
-       if (!GetOptions ($opts, 'exim', 'minimal')) {
+       if (!GetOptions ($opts, 'exim', 'minimal', 'include=s', 'exclude=s')) {
            fatal_usage();
        }
        die "command 'bootstrap' expects no arguments.\n" if scalar (@ARGV) != 0;