Add post on debugging with rr

This commit is contained in:
Jade Lovelace 2022-03-15 13:52:18 -07:00
parent 5a1c98d8a4
commit 7db1a7c496
2 changed files with 169 additions and 22 deletions

34
preview.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail
print_error() {
cat >&2 <<-EOF
Please create a .deploy_config with content:
PREVIEW_HOST=[the host you rsync to]
PREVIEW_DIR=some-subdomain
PREVIEW=https://blah
EOF
}
if [[ ! -e .deploy_config ]]; then
print_error
exit 1
fi
source ./.deploy_config
if [[ -z "${PREVIEW_HOST:-}" || -z "${PREVIEW_DIR:-}" || -z "${PREVIEW:-}" ]]; then
print_error
exit 1
fi
PREVIEW_TEMP=/tmp/zola-preview
rm -rf "$PREVIEW_TEMP"
zola build --drafts --base-url "$PREVIEW" --output-dir "$PREVIEW_TEMP"
# trailing slash: copy contents of directory into destination
rsync --verbose --human-readable --recursive \
--links --times --new-compress --delete-delay \
${EXTRA_OPTS_PREVIEW:-} "$PREVIEW_TEMP/" "${PREVIEW_HOST}:${PREVIEW_DIR}"