#!/bin/bash # Make sure gpg knows which tty to use, # or it'll complain like `curse not a tty xterm-256color` forever export GPG_TTY=$(tty) gpg-connect-agent updatestartuptty /bye >/dev/null # Garbage clean rm -r ./public/* hugo --gc # Find all pages, change "5" according to site content SIG_FILES=$(find public -maxdepth 5 -name '*.html' -type f) # Sign one page gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign public/index.html # Sign all pages while IFS= read -r line do gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign "$line" done < <(printf '%s\n' "$SIG_FILES") echo "Successfully signed all pages."