36 lines
957 B
Bash
Executable File
36 lines
957 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
. ./common.sh
|
|
|
|
trap error INT TERM
|
|
|
|
start
|
|
|
|
ATOM="$(curl -H "Accept: application/atom+xml" -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}')"
|
|
|
|
CURRENT_COMMIT="$(echo $CURRENT | jq -r .rev)"
|
|
|
|
if [ "${CURRENT_COMMIT}" != "${COMMIT}" ]; then
|
|
nix-prefetch-github openssh openssh-portable \
|
|
--rev "${COMMIT}" \
|
|
--json | \
|
|
jq -r --arg v "${UPDATED}" \
|
|
--arg c "${COMMENT}" \
|
|
'. |= . + {"version": $v, "comment": $c}' \
|
|
> pkgs/openssh/version.json
|
|
FN=$(mktemp)
|
|
echo "Updated to '${COMMIT}': '${COMMENT}'" > ${FN}
|
|
echo >> ${FN}
|
|
echo "${COMMENT}" >> ${FN}
|
|
git add pkgs/openssh/version.json && git commit -F $FN
|
|
else
|
|
echo "No updates."
|
|
fi
|