3
# Copyright © 2006 Roger Leigh <rleigh@debian.org>
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation, either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program. If not, see
17
# <http://www.gnu.org/licenses/>.
19
#######################################################################
23
use Sbuild::Utility qw(setup cleanup);
28
print STDERR "Usage: $0 <chroot> apt-get|apt-cache args\n";
32
usage() if ($#ARGV < 2);
34
my $command = $ARGV[1];
35
if ($command eq "apt-get") {
36
$command = $Sbuild::Conf::apt_get;
37
} elsif ($command eq "apt-cache") {
38
$command = $Sbuild::Conf::apt_cache;
40
print STDERR "Bad command $command. Allowed commands: apt-get or apt-cache\n";
44
$Sbuild::Conf::cwd = "/";
46
!setup($ARGV[0]) or die "Chroot setup failed";
50
my $cmd = join(' ', @ARGV);
52
$ENV{'DEBIAN_FRONTEND'} = "noninteractive";
53
my $status = run_apt_command($command, $cmd, "root", 1);