bins/update-openss: use nix-prefetch-github to fetch hash

This commit is contained in:
Aaron Bieber 2023-08-31 05:34:25 -06:00
parent febbbe4aff
commit 8df99b2ed6
No known key found for this signature in database
2 changed files with 12 additions and 1 deletions

View File

@ -1,8 +1,18 @@
#!/bin/sh
ATOM="$(curl -s https://github.com/openssh/openssh-portable/commits/master.atom)"
CURRENT="$(cat pkgs/openssh/version.json)"
COMMIT="$(echo $ATOM | dasel -rxml 'feed.entry.[0].id' | awk -F/ '{print $NF}')"
COMMENT="$(echo $ATOM | dasel -rxml 'feed.entry.[0].title')"
UPDATED="$(echo $ATOM | dasel -rxml 'feed.entry.[0].updated' | awk -FT '{print $1}')"
jo -- version="${UPDATED}" rev="${COMMIT}" comment="${COMMENT}" -s hash=
CURRENT_COMMIT="$(echo $CURRENT | jq -r .rev)"
if [ "${CURRENT_COMMIT}" != "${COMMIT}" ]; then
nix-prefetch-github openssh openssh-portable \
-rev "${COMMIT}" \
--json > pkgs/openssh/version.json
else
echo "No updates."
fi

View File

@ -79,6 +79,7 @@
nil
nix-diff
nix-output-monitor
nix-prefetch-github
shfmt
sops
ssh-to-age