summaryrefslogtreecommitdiff
path: root/scripts/fetch-intro.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/fetch-intro.sh')
-rwxr-xr-xscripts/fetch-intro.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/fetch-intro.sh b/scripts/fetch-intro.sh
new file mode 100755
index 0000000..54db7a9
--- /dev/null
+++ b/scripts/fetch-intro.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Installs a picture for the intro page: web/intro.jpg
+#
+# Nothing so specific is shipped with the repo — the page works with the title alone.
+# Give this script a local image (best) or a URL:
+#
+# ./scripts/fetch-intro.sh ~/pictures/session.jpg
+# ./scripts/fetch-intro.sh https://example.org/strug.jpg
+#
+# Whatever you choose must be yours to use: web/intro.jpg is not covered by this
+# project's licence, and it is gitignored so it never ends up in a commit.
+set -eu
+[ $# -ge 1 ] || { sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//'; exit 1; }
+src=$1
+dest=web/intro.jpg
+case "$src" in
+ http://*|https://*)
+ curl -L --fail -A "Mozilla/5.0" -o "$dest" "$src"
+ ;;
+ *)
+ [ -f "$src" ] || { echo "no such file: $src" >&2; exit 1; }
+ cp "$src" "$dest"
+ ;;
+esac
+echo "installed $dest ($(wc -c <"$dest") bytes) — rebuild the binary to embed it"