2023-08-29 17:53:40 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
ATOM="$(curl -s https://github.com/openssh/openssh-portable/commits/master.atom)"
|
2023-08-31 05:34:25 -06:00
|
|
|
CURRENT="$(cat pkgs/openssh/version.json)"
|
|
|
|
|
2023-08-29 17:53:40 -06:00
|
|
|
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}')"
|
|
|
|
|
2023-08-31 05:34:25 -06:00
|
|
|
CURRENT_COMMIT="$(echo $CURRENT | jq -r .rev)"
|
|
|
|
|
|
|
|
if [ "${CURRENT_COMMIT}" != "${COMMIT}" ]; then
|
|
|
|
nix-prefetch-github openssh openssh-portable \
|
2023-09-06 07:23:30 -06:00
|
|
|
--rev "${COMMIT}" \
|
|
|
|
--json | \
|
2023-09-06 08:07:22 -06:00
|
|
|
jq -r --arg v "${UPDATED}" \
|
|
|
|
--arg c "${COMMENT}" \
|
|
|
|
'. |= . + {"version": $v, "comment": $c}' \
|
2023-09-06 07:23:30 -06:00
|
|
|
> pkgs/openssh/version.json
|
2023-08-31 05:34:25 -06:00
|
|
|
else
|
|
|
|
echo "No updates."
|
|
|
|
fi
|