Vinfall revised this gist . Go to revision
1 file changed, 23 insertions
sign-blog.sh(file created)
@@ -0,0 +1,23 @@ | |||
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 | |
5 | + | export GPG_TTY=$(tty) | |
6 | + | gpg-connect-agent updatestartuptty /bye >/dev/null | |
7 | + | ||
8 | + | # Garbage clean | |
9 | + | rm -r ./public/* | |
10 | + | hugo --gc | |
11 | + | # Find all pages, change "5" according to site content | |
12 | + | SIG_FILES=$(find public -maxdepth 5 -name '*.html' -type f) | |
13 | + | ||
14 | + | # Sign one page | |
15 | + | gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign public/index.html | |
16 | + | ||
17 | + | # Sign all pages | |
18 | + | while IFS= read -r line | |
19 | + | do | |
20 | + | gpg --local-user {GPG_FINGERPRINT} --armor --detach-sign "$line" | |
21 | + | done < <(printf '%s\n' "$SIG_FILES") | |
22 | + | ||
23 | + | echo "Successfully signed all pages." |
Newer
Older