Skip to main content

Add a script for updating vfd

ID
8f390bc
date
2022-03-26 15:35:13+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
ddb90ab
message
Add a script for updating vfd
changed files
1 file, 20 additions

Changed files

update-vfd (0) → update-vfd (610)

diff --git a/update-vfd b/update-vfd
new file mode 100755
index 0000000..426542e
--- /dev/null
+++ b/update-vfd
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Gets the latest version of vfd, the command-line tool I use to build
+# my static books site.
+#
+# See https://github.com/alexwlchan/books.alexwlchan.net
+
+set -o errexit
+set -o nounset
+
+DOWNLOAD_URL=$(curl --silent 'https://api.github.com/repos/alexwlchan/books.alexwlchan.net/releases/latest' \
+  | jq -r ' .assets | map(.browser_download_url) | map(select(test(".*darwin.*")))[0]'
+)
+
+# The --location flag means we follow redirects
+curl --location "$DOWNLOAD_URL" > ~/.cargo/bin/vfd.tar.gz
+tar -xzf ~/.cargo/bin/vfd.tar.gz
+
+mv vfd ~/.cargo/bin/vfd
+chmod +x ~/.cargo/bin/vfd
+vfd --version