2

I want to list all Head packages available from specific ppa.

Example: webupd8 ppa:nilarimogard/webupd8 has following head packages for trusty:

screen

Can I list them by command-line?

2

I've written a function that grabs the Packages list for the repo that would be used on the current release/architecture. It's fairly simple and could be written as a single line... It would just be a very unwieldy line.

function lsppa {
    # expects one argument in the form of ppa:nilarimogard/webupd8

    USAGE="lsppa <ppa:user/ppaname>"

    if [[ "$#" != "1" || ! "$1"  == *"ppa"* ]]; then
      echo "$USAGE"
      return
    fi

    REPO="${1/ppa:/}"
    CODE="$(lsb_release -cs)"
    ARCH="$(dpkg --print-architecture)"
    URL="http://ppa.launchpad.net/$REPO/ubuntu/dists/$CODE/main/binary-$ARCH/Packages"

    awk '/^Package:/ {print $2}' <(wget -qO- "$URL")
}

So after you paste that into a terminal, you can call it like lsppa ppa:nilarimogard/webupd8 and it returns a list as ordered by the packages list.

In this case it might be non-alphabetical and could even contain duplicates (different versions) so you might (you could pass it through sort -u if you want to call:

lsppa ppa:nilarimogard/webupd8 | sort -u | less
  • I added a simple usage check to the function. I hope you don't mind ☺. – Glutanimate Jun 9 '14 at 14:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.