summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2015-02-03 09:50:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2015-02-03 09:50:04 +0000
commitc3cd5643255f91e17f010ff6e27efe0a34af8d50 (patch)
treeb3256628cab8b214242b941d7e770ef41466a6ea /usr.sbin/pkg_add/OpenBSD
parent25965d0a52f45570b4ba6588959592830293681a (diff)
Fix -a
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/FwUpdate.pm30
1 files changed, 23 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm b/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
index 2ed4b7facbb..86c12d32951 100644
--- a/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: FwUpdate.pm,v 1.11 2015/01/27 09:35:35 espie Exp $
+# $OpenBSD: FwUpdate.pm,v 1.12 2015/02/03 09:50:03 espie Exp $
#
# Copyright (c) 2014 Marc Espie <espie@openbsd.org>
#
@@ -99,6 +99,12 @@ sub machine_drivers
return keys %{$self->{machine_drivers}};
}
+sub all_drivers
+{
+ my $self = shift;
+ return keys %{$self->{all_drivers}};
+}
+
sub is_needed
{
my ($self, $driver) = @_;
@@ -154,6 +160,7 @@ sub find_machine_drivers
{
my ($self, $state) = @_;
$state->{machine_drivers} = {};
+ $state->{all_drivers} = \%possible_drivers;
my %search = %possible_drivers;
if (open(my $f, '<', '/var/run/dmesg.boot')) {
$self->parse_dmesg($f, \%search, $state->{machine_drivers});
@@ -253,12 +260,21 @@ sub process_parameters
}
}
} else {
- for my $driver ($state->machine_drivers) {
- $self->to_add_or_update($state, $driver);
- }
- for my $driver ($state->installed_drivers) {
- next if $state->is_needed($driver);
- $self->to_add_or_update($state, $driver);
+ if ($state->opt('a')) {
+ for my $driver ($state->all_drivers) {
+ $self->to_add_or_update($state,
+ $driver);
+ }
+ } else {
+ for my $driver ($state->machine_drivers) {
+ $self->to_add_or_update($state,
+ $driver);
+ }
+ for my $driver ($state->installed_drivers) {
+ next if $state->is_needed($driver);
+ $self->to_add_or_update($state,
+ $driver);
+ }
}
}
if (!(defined $state->{setlist}) && $state->{fw_verbose}) {