--- apt.old	2010-06-30 09:29:39.000000000 +0200
+++ apt	2010-06-30 09:31:25.000000000 +0200
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 # Copyright (C) 2007, 2008 Christoph Berg <myon@debian.org>
+# Copyright (C) 2009, 2010 Emil Larsson <emil.larsson@qbranch.se>
 #
 # Permission is hereby granted, free of charge, to any person
 # obtaining a copy of this software and associated documentation
@@ -23,10 +24,19 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 # OTHER DEALINGS IN THE SOFTWARE.
 
+my $home = $ENV{BBHOME}."/ext";
 use strict;
 use IPC::Open3;
+use lib $home;
 use Hobbit;
 
+sub file_to_hash ($);
+
+my $no_repo_accept_file = $home."/apt_alien_accepts";
+my $reject_file = $home."/apt_rejects";
+my %no_repo_accept = file_to_hash($no_repo_accept_file);
+my %rejects = file_to_hash($reject_file);
+
 $ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/sbin';
 $ENV{'LC_ALL'} = 'C';
 delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
@@ -59,7 +69,7 @@
 close ERR;
 
 my ($pkg, $inst, $cand, $pin, $pinprio, $in_dist, $dist, $has_repo);
-my (@up, @upgrades, @sec, @security, @holdup, @holdupgrades, @holdsec, @holdsecurity, @no_repo, @no_repo_pinned);
+my (@up, @upgrades, @sec, @security, @holdup, @holdupgrades, @holdsec, @holdsecurity, @no_repo, @no_repo_pinned, @no_repo_accepted, @rejected);
 
 sub try_pkg ()
 {
@@ -67,7 +77,11 @@
 		if (defined $pin and $pinprio > 0) {
 			push @no_repo_pinned, "$pkg ($inst) $pinprio";
 		} else {
-			push @no_repo, "$pkg ($inst)";
+			if (defined($no_repo_accept{$pkg})) {
+				push @no_repo_accepted, "$pkg ($inst)";
+			} else {
+				push @no_repo, "$pkg ($inst)";
+			}
 		}
 	}
 	return if $inst eq $cand;
@@ -151,14 +165,31 @@
 	}
 }
 
+pkgreport('Rejected packages', 'red', @rejected);
 pkgreport('Security updates', 'red', @security, @sec);
 pkgreport('Other updates', 'yellow', @upgrades, @up);
 pkgreport('Security updates on hold', 'green', @holdsecurity, @holdsec);
 pkgreport('Other updates on hold', 'green', @holdupgrades, @holdup);
 pkgreport('Packages not installed from apt repositories', 'yellow', @no_repo);
 pkgreport('Pinned packages not installed from apt repositories', 'green', @no_repo_pinned);
+pkgreport('Accepted packages not installed from apt repositories', 'green', @no_repo_accepted);
 
 $bb->print("\n");
 $bb->color_line($updatecolor, sprintf("Last apt update: %.1f day(s) ago\n", $last_update));
 
 $bb->send;
+
+sub file_to_hash($) {
+  my %hash = ();
+  my $filename = pop(@_);
+  open(my $fh, '<', $filename) or return %hash;
+  while(<$fh>) {
+    unless (/^#/) {
+      my $a = $_;
+      chomp($a);
+      $hash{$a} = 1;
+      print($a);
+    }
+  }
+  return %hash;
+}
