Advertisement
Shnatsel

WhatInstalls.sh

Mar 25th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Find out what caused the given package to installed,
  4. # i.e. what other package pulled it in as a dependency.
  5.  
  6. # Usage: ./WhatInstalls.sh package-name
  7.  
  8. set -e
  9. depending_pkgs_file="$(mktemp)"
  10. installed_pkgs_file="$(mktemp)"
  11.  
  12. apt-rdepends -r "$1" | grep ':' | cut -d ' ' -f 5 | sort -u > "$depending_pkgs_file"
  13. dpkg --get-selections | cut -f 1 | sort -u > "$installed_pkgs_file"
  14.  
  15. comm -12 "$depending_pkgs_file" "$installed_pkgs_file"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement