]>
git.proxmox.com Git - aab.git/blob - aab
15 print STDERR
"ERROR: $msg\n";
17 print STDERR
"aab <command> [parameters]\n";
20 $SIG{INT
} = $SIG{TERM
} = $SIG{QUIT
} = $SIG{HUP
} = sub {
21 die "interrupted by signal\n";
24 my $aab = PVE
::AAB-
>new();
26 $aab->writelog("aab: " . join(' ', @ARGV) . "\n");
28 my $cmd = shift @ARGV;
30 print_usage
('missing command');
37 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
40 } elsif ($cmd eq 'bootstrap') {
43 if (!GetOptions
('datadir=s' => \
$datadir,
49 my $here = "$aab->{working_dir}/scripts/init.bash";
50 if (!$datadir && -f
$here) {
51 print "Using current working directory as data directory\n";
52 $datadir = $aab->{working_dir
};
55 PVE
::AAB
::setup_defaults
($datadir) if $datadir;
56 $aab->ve_init() if !$keep;
59 } elsif ($cmd eq 'basedir') {
61 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
62 print $aab->{rootfs
} . "\n";
64 } elsif ($cmd eq 'veid') {
66 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
67 print $aab->{veid
} . "\n";
69 } elsif ($cmd eq 'packagefile') {
71 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
73 print "$aab->{targetname}.tar.gz\n";
75 } elsif ($cmd eq 'finalize') {
79 } elsif ($cmd eq 'install') {
82 foreach my $arg (@ARGV) {
83 if ($arg =~ m/\.pkglist$/) {
85 die "cant open package list '$arg' - $!";
86 while (defined (my $line = <$fh>)) {
88 next if $line =~ m/^\s*$/;
89 next if $line =~ m/\#/;
90 if ($line =~ m/^\s*(\S+)\s*$/) {
93 die "invalid package name in '$arg' - $line\n";
98 push @$required, $arg;
102 $aab->install ($required);
104 } elsif ($cmd eq 'exec') {
106 $aab->ve_exec (@ARGV);
108 } elsif ($cmd eq 'enter') {
112 } elsif ($cmd eq 'clean') {
116 } elsif ($cmd eq 'dist-clean') {
120 } elsif ($cmd eq 'list') {
124 if (!GetOptions
('verbose' =>\
$verbose)) {
129 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
132 $query .= 'q' if !$verbose;
133 print $aab->run_command(['chroot', $aab->{rootfs
}, 'pacman', $query], undef, 1);
137 print_usage
("invalid command '$cmd'");