Skip to content

Instantly share code, notes, and snippets.

@apstndb
Last active March 2, 2020 02:13
Show Gist options
  • Save apstndb/cd9234cdbdb3a37072f32c5b063462fe to your computer and use it in GitHub Desktop.
Save apstndb/cd9234cdbdb3a37072f32c5b063462fe to your computer and use it in GitHub Desktop.
Create google-cloud-sdk repo from apt
curl -s https://packages.cloud.google.com/apt/dists/cloud-sdk/main/binary-amd64/Packages |
gojq -srR 'def ver: split("-")[0];
split("\n\n") |
map(gsub("\n "; " ") |
split("\n") |
map(capture("^(?<key>[A-Z][a-zA-Z-]*): (?<value>.*)$"; "")) |
from_entries) |
group_by(.Package) |
map({key: .[0].Package, value: (sort_by(.Version))}) |
from_entries |
."google-cloud-sdk"[] |
"date && echo \(.Version | ver) && rm -rf usr etc ; curl -s https://packages.cloud.google.com/apt/\(.Filename) | dpkg -x - . && git add usr && git commit -m \(.Version | ver)"' |
sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment