have -DFW_UPDATE set @option firmware on downloaded firmwares.
authorespie <espie@openbsd.org>
Sun, 5 Jan 2014 10:24:30 +0000 (10:24 +0000)
committerespie <espie@openbsd.org>
Sun, 5 Jan 2014 10:24:30 +0000 (10:24 +0000)
- normal pkg_add -u should ignore them
- pkg_delete will ask about deleting them

okay landry@

usr.sbin/pkg_add/OpenBSD/Add.pm
usr.sbin/pkg_add/OpenBSD/Delete.pm
usr.sbin/pkg_add/OpenBSD/Update.pm

index 53a30d8..1057944 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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);
index 49d952a..3d559fe 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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);
index 66921ef..dce0b15 100644 (file)
@@ -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 <espie@openbsd.org>
 #
@@ -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;