Skip to content

Instantly share code, notes, and snippets.

@milkey-mouse
Created August 5, 2017 18:54
Show Gist options
  • Save milkey-mouse/7815fadd1ef5fa462d877b474f60bce4 to your computer and use it in GitHub Desktop.
Save milkey-mouse/7815fadd1ef5fa462d877b474f60bce4 to your computer and use it in GitHub Desktop.
Script to download an APT package and view its control file
#!/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