From 60d87146fc671b95306cd93aaaad76f480d309b9 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 5 Jan 2015 16:32:28 +0000 Subject: [PATCH] a few tweaks to match the old script better (for now) - progress meter set like the old script - path to firmware printed - update both needed and installed drivers - coda when we don't find anything to install/delete - error out if @ARGV is not a possible driver --- usr.sbin/pkg_add/OpenBSD/FwUpdate.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm b/usr.sbin/pkg_add/OpenBSD/FwUpdate.pm index c7a405b7315..05a4aa1d2e9 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.7 2015/01/05 13:18:31 sthen Exp $ +# $OpenBSD: FwUpdate.pm,v 1.8 2015/01/05 16:32:28 espie Exp $ # # Copyright (c) 2014 Marc Espie # @@ -54,6 +54,7 @@ sub handle_options $state->find_path; } $main::not = $state->{not}; + $state->progress->setup(0, 0, $state); $state->{localbase} = OpenBSD::Paths->localbase; $state->{destdir} = ''; $state->{wantntogo} = 0; @@ -63,6 +64,9 @@ sub handle_options } $state->{fw_repository} = OpenBSD::PackageRepository->new($state->{path}); + if ($state->verbose) { + $state->say("Path to firmware: #1", $state->{path}); + } } sub finish_init @@ -233,9 +237,23 @@ sub process_parameters 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->verbose) { + $state->say($state->opt('d') ? + "No firmware to delete." : + "No devices found which need firmware files to be downloaded."); + exit(0); } } else { for my $driver (@ARGV) { + if (!$possible_drivers{$driver}) { + $state->errsay("#1: unknown driver", $driver); + exit(1); + } my $set = $self->to_add_or_update($state, $driver); if ($state->opt('d')) { if (!$state->is_installed($driver)) { -- 2.20.1