makedeb
Command Line Tools for Drone CI
Click here to go back to the commit logs for drone-cli-bin.
Hash: bdc824c3577e91a662910d9521f2827ed5dddc8f
Message: Updated update script
diff --git a/.update-check.sh b/.update-check.sh
index 046111b..0d9ca13 100755
--- a/.update-check.sh
+++ b/.update-check.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+set -e
# The following packages are needed to function: curl, jq
source PKGBUILD
@@ -7,26 +8,30 @@ api_data="$(curl -sH "Accept: application/vnd.github.v3+json" "https://api.githu
latest_version="$( echo "${api_data}" | jq -r '.tag_name' | rev | head -c -2 | rev)"
-if [[ "${pkgver}" != "${latest_version}" ]]; then
- echo "Updating PKGBUILD info..."
+if [[ "${pkgver}" == "${latest_version}" ]]; then
+ echo "Package is up to date."
+ exit 1
+fi
- number=1
- for i in $(echo "${api_data}" | jq -r .assets[].name); do
- if [[ "${i}" == "drone_checksums.txt" ]]; then
- break
- elif [[ "${i}" == "" ]]; then
- echo "Couldn't find the checksum file. Aborting..."
- exit 1
- fi
+echo "Updating PKGBUILD info..."
- number="$(( "${number}" + 1 ))"
- done
+number=1
+for i in $(echo "${api_data}" | jq -r .assets[].name); do
+ if [[ "${i}" == "drone_checksums.txt" ]]; then
+ break
+ elif [[ "${i}" == "" ]]; then
+ echo "Couldn't find the checksum file. Aborting..."
+ exit 1
+ fi
- checksum_url="$(echo "${api_data}" | jq -r '.assets[].browser_download_url' | xargs | awk "{print \$$number}")"
- checksum_value="$(curl -Ls "${checksum_url}" | grep 'drone_linux_amd64.tar.gz' | awk '{print $1}')"
+ number="$(( "${number}" + 1 ))"
+done
- sed -i "s|pkgver=.*|pkgver='${latest_version}'|" PKGBUILD
- sed -i "s|sha256sums_x86_64=.*|sha256sums_x86_64=('${checksum_value}')|" PKGBUILD
-fi
+checksum_url="$(echo "${api_data}" | jq -r '.assets[].browser_download_url' | xargs | awk "{print \$$number}")"
+checksum_value="$(curl -Ls "${checksum_url}" | grep 'drone_linux_amd64.tar.gz' | awk '{print $1}')"
+
+sed -i "s|pkgver=.*|pkgver='${latest_version}'|" PKGBUILD
+sed -i "s|sha256sums_x86_64=.*|sha256sums_x86_64=('${checksum_value}')|" PKGBUILD
echo "Done."
+exit 0