summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2003-11-09 16:13:37 +0000
committerespie <espie@openbsd.org>2003-11-09 16:13:37 +0000
commit1fca00bce3b6a4c1a42d9139900ba1a3a5b94e16 (patch)
tree5c0a5afa97e805e4df5fd10bfab4d87a85e51800
parentadd entry for Pegasos; (diff)
downloadwireguard-openbsd-1fca00bce3b6a4c1a42d9139900ba1a3a5b94e16.tar.xz
wireguard-openbsd-1fca00bce3b6a4c1a42d9139900ba1a3a5b94e16.zip
count errors while installing packages, and exit(1) if errors.
-rw-r--r--usr.sbin/pkg_add/pkg_add10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 968389ff608..e1f375bcb5e 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.12 2003/11/09 15:42:48 espie Exp $
+# $OpenBSD: pkg_add,v 1.13 2003/11/09 16:13:37 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -374,13 +374,17 @@ sub really_add($)
my @todo = (@ARGV);
my $cache={};
+my $errors = 0;
MAINLOOP:
while (my $pkg = shift @todo) {
if (!defined $cache->{$pkg}) {
$cache->{$pkg} = pre_add($pkg);
}
my $handle = $cache->{$pkg};
- next unless defined $handle;
+ if (!defined $handle) {
+ $errors++;
+ next;
+ }
my $plist = $handle->{plist};
@@ -417,3 +421,5 @@ while (my $pkg = shift @todo) {
really_add($handle);
$conflict_list->{$plist->pkgname()} = $handle->{conflicts};
}
+
+exit(1) if $errors;