From: espie Date: Sun, 5 Jan 2014 10:24:30 +0000 (+0000) Subject: have -DFW_UPDATE set @option firmware on downloaded firmwares. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3f7ff4b1f6b261551964e7f9a72b9f69950d954d;p=openbsd have -DFW_UPDATE set @option firmware on downloaded firmwares. - normal pkg_add -u should ignore them - pkg_delete will ask about deleting them okay landry@ --- diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 53a30d874d3..1057944ddcf 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.134 2013/12/30 09:02:37 espie Exp $ +# $OpenBSD: Add.pm,v 1.135 2014/01/05 10:24:30 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -145,6 +145,10 @@ sub tweak_plist_status my ($plist, $state) = @_; my $pkgname = $plist->pkgname; + if ($state->defines('FW_UPDATE')) { + $plist->has('firmware') or + OpenBSD::PackingElement::Firmware->add($plist); + } return 0 unless $user_tagged->{$pkgname}; if (!$plist->has('manual-installation') && !$state->{automatic}) { OpenBSD::PackingElement::ManualInstallation->add($plist); diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 49d952ad429..3d559fe5f32 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.123 2014/01/02 16:05:42 espie Exp $ +# $OpenBSD: Delete.pm,v 1.124 2014/01/05 10:24:30 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -111,6 +111,14 @@ sub delete_package } } } + if ($plist->has('firmware')) { + if ($state->{interactive}) { + if (!$state->confirm("\nDelete firmware $pkgname", 0)) { + $state->errsay("NOT deleting #1", $pkgname); + return; + } + } + } $state->{problems} = 0; validate_plist($plist, $state); diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 66921ef6191..dce0b1558d7 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.155 2013/12/25 15:59:51 espie Exp $ +# $OpenBSD: Update.pm,v 1.156 2014/01/05 10:24:30 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie # @@ -108,7 +108,8 @@ sub process_handle $state->fatal("can't locate #1", $pkgname); } - if ($plist->has('explicit-update') && $state->{allupdates}) { + if ($plist->has('explicit-update') && $state->{allupdates} || + $plist->has('firmware') && !$state->defines('FW_UPDATE')) { $h->{update_found} = $h; $set->move_kept($h); return 0;