Skip to content

Instantly share code, notes, and snippets.

@dreiss
Created April 27, 2009 22:35
Show Gist options
  • Save dreiss/102793 to your computer and use it in GitHub Desktop.
Save dreiss/102793 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# This script identifies the packages manually installed on your old
# Debian system that are not installed on your new Debian system.
if test "$#" -ne "2" ; then
echo >&2 "usage: $0 /path/to/old/var/lib/dpkg /path/to/old/var/lib/apt"
exit 1
fi
export COLUMNS=256
comm -23 \
<( comm -23 \
<(dpkg-query --admindir $1 -l | awk '{print $2}' | sort) \
<(dpkg-query -l | awk '{print $2}' | sort) \
) \
<( \
sed -n '/^$/!{;H;d;};x;/\nAuto-Installed: 1/s/^\nPackage: \([^\n]*\)\n.*/\1/p' "$2/extended_states" | sort \
) \
| cat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment