2023-08-29 17:53:40 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-01-16 14:39:05 -07:00
|
|
|
set -e
|
|
|
|
|
2024-04-20 13:46:28 -06:00
|
|
|
. ./common.sh
|
|
|
|
|
|
|
|
trap error INT TERM
|
|
|
|
|
|
|
|
start
|
|
|
|
|
2024-01-16 14:39:05 -07:00
|
|
|
ATOM="$(curl -H "Accept: application/atom+xml" -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}" \
|
2024-06-28 09:37:50 -06:00
|
|
|
--json |
|
2023-09-06 08:07:22 -06:00
|
|
|
jq -r --arg v "${UPDATED}" \
|
2024-06-28 09:37:50 -06:00
|
|
|
--arg c "${COMMENT}" \
|
|
|
|
'. |= . + {"version": $v, "comment": $c}' \
|
|
|
|
>pkgs/openssh/version.json
|
2024-05-19 06:44:49 -06:00
|
|
|
FN=$(mktemp)
|
2024-06-28 09:37:50 -06:00
|
|
|
echo "pkgs/openssh: update to '${COMMIT}'" >${FN}
|
|
|
|
echo >>${FN}
|
|
|
|
echo "${COMMENT}" >>${FN}
|
2024-05-19 06:44:49 -06:00
|
|
|
git add pkgs/openssh/version.json && git commit -F $FN
|
2023-08-31 05:34:25 -06:00
|
|
|
else
|
|
|
|
echo "No updates."
|
|
|
|
fi
|