sign-blog.sh
· 632 B · Bash
Sin formato
#!/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."
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." |
24 |