Created
August 5, 2017 18:54
-
-
Save milkey-mouse/7815fadd1ef5fa462d877b474f60bce4 to your computer and use it in GitHub Desktop.
Script to download an APT package and view its control file
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
#!/bin/bash | |
set -euo pipefail | |
TMPDIR="" | |
function cleanup { | |
[[ ! -z $TMPDIR ]] && rm -r "$TMPDIR" | |
} | |
trap cleanup EXIT | |
if (( $# == 0 )); then | |
echo "usage: apt-examine <package>" | |
echo "Shows the .deb control file from a package." | |
exit 1 | |
else | |
TMPDIR="$(mktemp --directory)" | |
cd "$TMPDIR" | |
apt download $1 1>&2 | |
ar -p *.deb control.tar.gz | tar -zxC . ./control -O | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment