#!/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"