]> git.proxmox.com Git - dab.git/blobdiff - dab
bootstrap: do not pull in xbase-clients by default
[dab.git] / dab
diff --git a/dab b/dab
index 6ca953ac8081e08c556c2221f31e5cb6899e7820..63844c7719c8735352e4aac1d1a4b517ff27b31a 100755 (executable)
--- a/dab
+++ b/dab
@@ -11,8 +11,8 @@ $ENV{'LC_ALL'} = 'C';
 
 my $commands = {
     'init' => '',
-    'bootstrap' => '[--exim] [--minimal]',
-    'finalize' => '[--keepmycnf]',
+    'bootstrap' => '[--exim] [--include <a[,b..]]>] --exclude [<a[,b..]]>] [--minimal]',
+    'finalize' => '[--keepmycnf] [--compressor <gz[ip] (default)|zst[d]|zstd-max>]',
     'veid' => '',
     'basedir' => '',
     'packagefile' => '',
@@ -27,11 +27,6 @@ my $commands = {
 };
 
 sub print_usage {
-    my ($msg) = @_;
-
-    if ($msg) {
-       print STDERR "\nERROR: $msg\n\n";
-    }
     print STDERR "USAGE: dab <command> [parameters]\n\n";
 
     for my $cmd (sort keys %$commands) {
@@ -43,20 +38,26 @@ sub print_usage {
     }
 }
 
-if (scalar (@ARGV) == 0) {
-    print_usage("no command specified");
+sub fatal_usage {
+    my ($msg) = @_;
+
+    print STDERR "\nERROR: $msg\n\n" if $msg;
+    print_usage();
+
     exit (-1);
 }
 
+if (scalar (@ARGV) == 0) {
+    fatal_usage("no command specified");
+}
+
 my $cmdline = join (' ', @ARGV);
 my $cmd = shift @ARGV;
 
 if (!$cmd) {
-    print_usage("no command specified");
-    exit (-1);
+    fatal_usage("no command specified");
 } elsif (!exists $commands->{$cmd}) {
-    print_usage("unknown command '$cmd'");
-    exit (-1);
+    fatal_usage("unknown command '$cmd'");
 } elsif ($cmd eq 'help') {
     print_usage();
     exit (0);
@@ -82,9 +83,8 @@ eval {
 
     } elsif ($cmd eq 'bootstrap') {
        my $opts = {};
-       if (!GetOptions ($opts, 'exim', 'minimal')) {
-           print_usage();
-           exit (-1);
+       if (!GetOptions ($opts, 'exim', 'minimal', 'include=s', 'exclude=s')) {
+           fatal_usage();
        }
        die "command 'bootstrap' expects no arguments.\n" if scalar (@ARGV) != 0;
 
@@ -93,9 +93,8 @@ eval {
 
     } elsif ($cmd eq 'finalize') {
        my $opts = {};
-       if (!GetOptions ($opts, 'keepmycnf')) {
-           print_usage();
-           exit (-1);
+       if (!GetOptions ($opts, 'keepmycnf', 'compressor=s')) {
+           fatal_usage();
        }
        die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
 
@@ -119,8 +118,7 @@ eval {
     } elsif ($cmd eq 'list') {
        my $verbose;
        if (!GetOptions ('verbose' =>\$verbose)) {
-           print_usage();
-           exit (-1);
+           fatal_usage();
        }
        die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
 
@@ -138,15 +136,13 @@ eval {
     } elsif ($cmd eq 'task') {
        my $task = shift @ARGV;
        if (!$task) {
-           print_usage("no task specified");
-           exit (-1);
+           fatal_usage("no task specified");
        }
 
        my $opts = {};
        if ($task eq 'mysql') {
            if (!GetOptions ($opts, 'password=s', 'start')) {
-               print_usage();
-               exit (-1);
+               fatal_usage();
            }
            die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
 
@@ -154,8 +150,7 @@ eval {
 
        } elsif ($task eq 'postgres') {
            if (!GetOptions ($opts, 'version=s', 'start')) {
-               print_usage();
-               exit (-1);
+               fatal_usage();
            }
            die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
 
@@ -163,17 +158,14 @@ eval {
 
        } elsif ($task eq 'php') {
            if (!GetOptions ($opts, 'memlimit=i')) {
-               print_usage();
-               exit (-1);
+               fatal_usage();
            }
            die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
 
            $dab->task_php ($opts);
 
        } else {
-           print_usage("unknown task '$task'");
-           exit (-1);
-
+           fatal_usage("unknown task '$task'");
        }
 
     } elsif ($cmd eq 'install' || $cmd eq 'unpack') {
@@ -221,8 +213,7 @@ eval {
        $dab->cleanup(1);
 
     } else {
-       print_usage("invalid command '$cmd'");
-       exit (-1);
+       fatal_usage("invalid command '$cmd'");
     }
 
 };
@@ -256,14 +247,26 @@ Bootstrap a debian system and allocate a temporary container (we use IDs 90000
 and above).
 
 =over
+
 =item I<--exim>
 
-Use exim as MTA (we use postfix by default)
+Use exim as MTA (dab selects postfix by default)
 
 =item I<--minimal>
 
-Do not install standard packages.
+Do not auto-select packages with standard priority for installation.
+
+=item I<--include <a[,b..]]>
+
+A comma-separated list of packages to always include in bootstrap. Note that no
+transitive dependency resolution is done, you may need to specify those
+yourself.
+
+=item I<--exclude <a[,b..]]>
+
+A comma-separated list of packages to exlcude in bootstrap. Note that no
+transitive dependency resolution is done for others to get excluded, you may
+need to specify those yourself.
 
 =back
 
@@ -327,13 +330,15 @@ Install a postgres database server.
 
 =item I<--version=XXX>
 
-Select Postgres version. Posible values are C<7.4>, C<8.1> and C<8.3> (depends
-on the selected suite).
+Select Postgres version. Posible values are for example C<9.6>, C<11> or C<13>,
+they depend on the selected distribution suite. Defaults to none, which selects
+the unversioned metapackage that pulls in the suites default version, normally
+a good choice to make.
 
 =item I<--start>
 
-Start the postgres server (if you want to execute sql commands during appliance
-generation).
+Start the postgres server immediately. Useful, for example, if you want to
+execute sql commands during appliance generation.
 
 =back
 
@@ -360,6 +365,16 @@ package.
 
 Do not delete file C</root/.my.cfg> (mysql).
 
+=item I<--compressor <gz[ip] (default)|zst[d]|zstd-max>]>
+
+Select the compressor to process the rootfs archive with. C<gzip> is a good
+choice to make the archive also available on older systems, but using C<zstd>
+or even C<zstd-max> results in a higher compression ration while keeping
+decompression very fast and highly efficient. Note that C<zstd-max> uses the
+highest compression ratio without any decompression performance hit possible,
+it will use as many threads as there are onlince CPU threads and may thus
+increase the system load significantly for tens of seconds up to minutes.
+
 =back
 
 =item B<dab list>
@@ -550,13 +565,14 @@ The following files are created inside your working directory:
 =head1 AUTHOR
 
 Dietmar Maurer <dietmar@proxmox.com>
+Thomas Lamprecht <t.lamprecht@proxmox.com>
 
 Many thanks to Proxmox Server Solutions (www.proxmox.com) for sponsoring this
 work.
 
 =head1 COPYRIGHT AND DISCLAIMER
 
-Copyright (C) 2007-2020 Proxmox Server Solutions GmbH
+Copyright (C) 2007-2021 Proxmox Server Solutions GmbH
 
 Copyright: dab is under GNU GPL, the GNU General Public License.