353
353
system @root, 'dpkg', '--unpack', @deb_files;
354
354
die("$progname: dpkg --unpack failed\n") if ( ($?>>8) != 0 );
355
355
system @root, shellwords($install_tool), '-f', 'install';
356
if ( ($?>>8) != 0 ) {
357
# Restore system to previous state, since apt wasn't able to resolve a
358
# proper way to get the build-dep packages installed
358
# $install_tool succeeded. Did the packages get installed? It's
359
# possible that they didn't because $install_tool may have realized
360
# that installation was impossible, and it could have given up,
362
for (my $i = 0; $i < @pkg_names; $i++) {
363
my $pkg = $pkg_names[$i];
365
spawn(exec => ['dpkg-query', '-W', '-f', '${db:Status-Status}', $pkg],
366
to_string => \$status,
367
error_to_file => '/dev/null',
370
if ($status ne 'installed' || ($? >> 8)) {
371
# Restore system to previous state, since $install_tool wasn't
372
# able to resolve a proper way to get the build-dep packages
374
warn "$progname: Unable to install $pkg";
378
unlink $deb_files[$i];
382
die "$progname: Unable to install all build-dep packages\n";
386
# Restore system to previous state, since $install_tool wasn't able to
387
# resolve a proper way to get the build-dep packages installed
359
388
system @root, 'dpkg', '--remove', @pkg_names;
360
die("$progname: apt-get install call failed\n");
389
die("$progname: Unable to install all build-dep packages\n");
364
foreach my $file (@deb_files) {
392
foreach my $file (@deb_files) {