rpi-update: Extract git hash from artifact build from branch

This allows rpi-update rpi-6.6.y to correctly skip if no changes or run if there are changes.

See: https://forums.raspberrypi.com/viewtopic.php?p=2138683#p2138683
This commit is contained in:
Dom Cobley
2023-10-06 19:11:57 +01:00
parent e9412a1cc1
commit 9d8ad1e2f9

View File

@@ -682,6 +682,8 @@ if [[ "${FW_REV}" == "" ]]; then
if [[ "${ARTIFACT}" == pulls/* ]]; then if [[ "${ARTIFACT}" == pulls/* ]]; then
PULL=${ARTIFACT##*/} PULL=${ARTIFACT##*/}
ARTIFACT=$(eval curl -s "https://api.github.com/repos/raspberrypi/linux/pulls/${PULL}" | awk '/"sha":/ {gsub(/"/, "", $2); gsub(/,/, "", $2); print $2; exit}') ARTIFACT=$(eval curl -s "https://api.github.com/repos/raspberrypi/linux/pulls/${PULL}" | awk '/"sha":/ {gsub(/"/, "", $2); gsub(/,/, "", $2); print $2; exit}')
else
ARTIFACT=$(eval curl -s "https://api.github.com/repos/raspberrypi/linux/actions/artifacts" | grep -A1 "\"head_branch\": \"${FW_REV_IN}\"" | awk '/"head_sha":/ {gsub(/"/, "", $2); gsub(/,/, "", $2); print $2; exit}')
fi fi
else else
ARTIFACT=${FW_REV_IN} ARTIFACT=${FW_REV_IN}