diff options
| author | OEM Taipei Bot <[email protected]> | 2025-01-15 09:04:39 +0000 |
|---|---|---|
| committer | OEM Taipei Bot <[email protected]> | 2025-01-15 09:04:39 +0000 |
| commit | 9674dc3fb7afce01150c10d07f05b8cee6991f45 (patch) | |
| tree | a2c8d411de89449ff9f0d005b7fb3d8e8679ace6 | |
| parent | 00ca0864900007e2a275015bd8240369fc66770e (diff) | |
| parent | 1c4b489ec014ad916cc90a4bdcc7cd5c33c66761 (diff) | |
Merge #479438 from ~fourdollars/pc-enablement/+git/oem-scripts:master
Approved by:
Kai-Chuan Hsieh (kchsieh)
| -rw-r--r-- | debian/install | 1 | ||||
| -rwxr-xr-x | list-packages.sh | 68 |
2 files changed, 69 insertions, 0 deletions
diff --git a/debian/install b/debian/install index 9f4aa8e..6a7b8e4 100644 --- a/debian/install +++ b/debian/install @@ -23,3 +23,4 @@ c3-v2-api.py /usr/bin put-dell-embargo.sh /usr/bin trigger_sanity_c3.py /usr/bin onesshup.sh /usr/bin +list-packages.sh /usr/bin diff --git a/list-packages.sh b/list-packages.sh new file mode 100755 index 0000000..67371c8 --- /dev/null +++ b/list-packages.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -euo pipefail + +OPTS="$(getopt -o a:c:h --long arch:,codename:,help -n 'list-packages.sh' -- "$@")" + +ARCH=$(dpkg --print-architecture) +CODENAME=$(lsb_release -c -s) +PPA= +eval set -- "${OPTS}" + +help() { + cat <<ENDLINE +USAGE: + + This command will list published packages for the specified arch in a given PPA. + + $0 ppa:whatever/you-like [OPTIONS] + +OPTIONS: + + -a | --arch + If not specified, it will use the output of \`dpkg --print-architecture\`. + -c | --codename ${CODENAME} + If not specified, it will use the output of \`lsb_release -c -s\`. +ENDLINE +} + +while :; do + case "$1" in + ('-h'|'--help') + help + exit ;; + ('-a'|'--arch') + ARCH="$2" + shift 2;; + ('-c'|'--codename') + CODENAME="$2" + shift 2;; + ('--') shift; break ;; + (*) break ;; + esac +done + +if [ "$#" -ne 1 ]; then + help + exit 1 +fi + +PPA="$1" + +if [[ "$PPA" =~ ^ppa: ]]; then + GROUP=$(echo "${PPA//[:\/]/ }" | awk '{print $2}') + ARCHIVE=$(echo "${PPA//[:\/]/ }" | awk '{print $3}') +else + echo "Please give a valid PPA name. '$PPA' is not a valid PPA name." + help + exit 1 +fi + +lp-api get "~$GROUP/+archive/ubuntu/$ARCHIVE" ws.op==getPublishedBinaries "distro_arch_series==https://api.launchpad.net/devel/ubuntu/$CODENAME/$ARCH" pocket==Release status==Published order_by_date==true > /tmp/payload.json +jq -r .entries.[].binary_package_name < /tmp/payload.json +link=$(jq -r .next_collection_link < /tmp/payload.json) +while [ "$link" != "null" ]; do + lp-api get "$link" > /tmp/payload.json + jq -r .entries.[].binary_package_name < /tmp/payload.json + link=$(jq -r .next_collection_link < /tmp/payload.json) +done |
