Skip to content

Instantly share code, notes, and snippets.

@mschmitt
Last active August 31, 2022 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschmitt/336e0badce52932f115b8f2d93ac2983 to your computer and use it in GitHub Desktop.
Save mschmitt/336e0badce52932f115b8f2d93ac2983 to your computer and use it in GitHub Desktop.
List the contents of an APT repository (Packages.gz)
#!/usr/bin/perl -an
# List the contents of an APT repository
#
# Input: Unpacked contents of Packages.{xz,gz}
# Output: [package] [version]
#
# curl -s http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz |
# xz -dc | apt_package_and_version | grep '^bash '
#
# Taken from a one-liner in one of my shell scripts. Sorry.
if($F[0]=~/^Package:/){$p=$F[1]};if($F[0]=~/^Version:/){$v=$F[1];print"$p $v\n";}
# https://gist.github.com/mschmitt/336e0badce52932f115b8f2d93ac2983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment