-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
sigs.sh
49 lines (46 loc) · 1.87 KB
/
sigs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
if [[ "$1" == "" ]]; then
# Build all `md` files
for f in *.md; do
echo "Building: $f"
bn="$(basename "$f" .md)"
"$0" "$bn"
done
echo "Built all documents. Calculating hashes..."
cd export/
sha256sum ./* > sha256sum.txt
b2sum ./* > b2sum.txt
echo "Calculated hashes. Signing generated files..."
for f in ./*; do
echo "Signing: $f"
# verify with GPG
gpg --default-key C3023DBEA3FB38C438BA1EEDCEC60AEDE8B992A2 --armor --detach-sign --sign "$f"
# verify with `minisign -Vm <file> -P RWQ0WYJ07DUokK8V/6LNJ9bf/O/QM9k4FSlDmzgEeXm7lEpw3ecYjXDM`
yes '' | minisign -S -s /home/user/.minisign/minisign.key -m "$f"
done
cd ../
# Sign original *.md files
for f in ./*.md; do
echo "Signing: $f"
# verify with GPG
gpg --default-key C3023DBEA3FB38C438BA1EEDCEC60AEDE8B992A2 --armor --detach-sign --sign "$f"
# verify with `minisign -Vm <file> -P RWQ0WYJ07DUokK8V/6LNJ9bf/O/QM9k4FSlDmzgEeXm7lEpw3ecYjXDM`
yes '' | minisign -S -s /home/user/.minisign/minisign.key -m "$f"
done
sha256sum *.md > sha256sum.txt
gpg --default-key C3023DBEA3FB38C438BA1EEDCEC60AEDE8B992A2 --armor --detach-sign sha256sum.txt
yes '' | minisign -S -s /home/user/.minisign/minisign.key -m sha256sum.txt
b2sum *.md > b2sum.txt
gpg --default-key C3023DBEA3FB38C438BA1EEDCEC60AEDE8B992A2 --armor --detach-sign b2sum.txt
yes '' | minisign -S -s /home/user/.minisign/minisign.key -m b2sum.txt
echo "Signed all files."
echo "Done."
exit
fi
# bn="$1"
# echo "Generating HTML..."
# pandoc --self-contained "$bn".md -o export/"$bn".html --metadata title="The Hitchhiker's Guide to Online Anonymity"
# echo "Generating PDF..."
# pandoc --self-contained "$bn".md -o export/"$bn".pdf --metadata title="The Hitchhiker's Guide to Online Anonymity" -t context
# echo "Generating ODT..."
# pandoc --self-contained "$bn".md -o export/"$bn".odt --metadata title="The Hitchhiker's Guide to Online Anonymity"