]>
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 'keyring') {
62 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
63 $aab->populate_keyring();
65 } elsif ($cmd eq 'basedir') {
67 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
68 print $aab->{rootfs
} . "\n";
70 } elsif ($cmd eq 'veid') {
72 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
73 print $aab->{veid
} . "\n";
75 } elsif ($cmd eq 'packagefile') {
77 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
79 print "$aab->{targetname}.tar.gz\n";
81 } elsif ($cmd eq 'finalize') {
85 } elsif ($cmd eq 'install') {
88 foreach my $arg (@ARGV) {
89 if ($arg =~ m/\.pkglist$/) {
91 die "cant open package list '$arg' - $!";
92 while (defined (my $line = <$fh>)) {
94 next if $line =~ m/^\s*$/;
95 next if $line =~ m/\#/;
96 if ($line =~ m/^\s*(\S+)\s*$/) {
99 die "invalid package name in '$arg' - $line\n";
104 push @$required, $arg;
108 $aab->install ($required);
110 } elsif ($cmd eq 'exec') {
112 $aab->ve_exec (@ARGV);
114 } elsif ($cmd eq 'enter') {
118 } elsif ($cmd eq 'clean') {
122 } elsif ($cmd eq 'dist-clean') {
126 } elsif ($cmd eq 'list') {
130 if (!GetOptions
('verbose' =>\
$verbose)) {
135 die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
138 $query .= 'q' if !$verbose;
139 print $aab->run_command(['chroot', $aab->{rootfs
}, 'pacman', $query], undef, 1);
143 print_usage
("invalid command '$cmd'");