summaryrefslogtreecommitdiff
path: root/archive/bin/workstation-uninstallable
diff options
context:
space:
mode:
Diffstat (limited to 'archive/bin/workstation-uninstallable')
-rwxr-xr-xarchive/bin/workstation-uninstallable43
1 files changed, 43 insertions, 0 deletions
diff --git a/archive/bin/workstation-uninstallable b/archive/bin/workstation-uninstallable
new file mode 100755
index 00000000..acb538c1
--- /dev/null
+++ b/archive/bin/workstation-uninstallable
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+# Run this script to find packages that I might want to uninstall, or
+# at least mark as automatically installed. We find all manually
+# installed packages that aren't part of a standard Debian system and
+# aren't depended on by anything else we have installed. Then we
+# filter out a list of packages we always want, and packages that
+# propellor keeps installed.
+
+use strict;
+use warnings;
+use autodie;
+
+use Array::Utils qw{ array_minus };
+use Path::Class;
+
+# manually installed packages that aren't part of a standard Debian
+# system and aren't depended on by anything else we have installed
+my @installed = split "\n", `aptitude search '~i !~M !~pstandard !~pimportant !~prequired !?reverse-Depends(?installed)' -F'%p' --disable-columns`;
+
+# packages we definitely want to keep
+my @wanted = qw/acpi acpi-support-base/;
+
+# packages propellor installs (roughly)
+my $dir = dir("$ENV{HOME}/src/propellor/src/Propellor/Property/SiteSpecific");
+my $file = $dir->file("SPW.hs");
+my $file_handle = $file->openr();
+while( my $line = $file_handle->getline() ) {
+ if ( $line =~ /[,\[] "([a-z0-9-]+)"$/ ) {
+ push @wanted, $1;
+ }
+}
+
+# these are all the packages I might want to remove from my
+# workstation, or at least `apt-mark auto`
+my @might_want_to_remove_or_mark_auto = array_minus( @installed, @wanted );
+
+# remove task-* packages since I probs. don't want to remove those
+@might_want_to_remove_or_mark_auto = grep { $_ !~ /^task-/ } @might_want_to_remove_or_mark_auto;
+
+# output
+print join "\n", @might_want_to_remove_or_mark_auto;
+print "\n";