Created
September 8, 2015 10:46
-
-
Save aboettger/f5cee42308c48cad5aef to your computer and use it in GitHub Desktop.
get origin of an installed packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' \ | |
| fgrep ':install ok installed' \ | |
| cut -d: -f1 \ | |
| (while read pkg; do | |
inst_version=$(apt-cache policy $pkg \ | |
| fgrep Installed: \ | |
| awk '{ print $2 }'); | |
origin=$(apt-cache policy "$pkg" \ | |
| fgrep " *** ${inst_version}" -C1 \ | |
| tail -n 1 \ | |
| cut -c12-); | |
echo $pkg $origin; | |
done) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment