最后活跃于 1731734966

https://blog.vinfall.com/posts/2022/10/pgp-signed-site/#conclusion

sign-blog.sh 原始文件
1#!/bin/bash
2
3# Make sure gpg knows which tty to use,
4# or it'll complain like `curse not a tty xterm-256color` forever
5export GPG_TTY=$(tty)
6gpg-connect-agent updatestartuptty /bye >/dev/null
7
8# Garbage clean
9rm -r ./public/*
10hugo --gc
11# Find all pages, change "5" according to site content
12SIG_FILES=$(find public -maxdepth 5 -name '*.html' -type f)
13
14# Sign one page
15gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign public/index.html
16
17# Sign all pages
18while IFS= read -r line
19do
20 gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign "$line"
21done < <(printf '%s\n' "$SIG_FILES")
22
23echo "Successfully signed all pages."
24