diff options
author | Mike Gerwitz <mtg@gnu.org> | 2019-01-08 00:11:20 -0500 |
---|---|---|
committer | Mike Gerwitz <mtg@gnu.org> | 2019-01-11 23:46:13 -0500 |
commit | b182ea79b3a7ac07f673870edab1bd3d6074c618 (patch) | |
tree | 3ce02ad905ace0498829d52b4b223790b9d63266 /bootstrap | |
parent | 643a9858f125e2fc2c4557a9c0d706b72c09259a (diff) | |
download | thoughts-b182ea79b3a7ac07f673870edab1bd3d6074c618.tar.gz thoughts-b182ea79b3a7ac07f673870edab1bd3d6074c618.tar.bz2 thoughts-b182ea79b3a7ac07f673870edab1bd3d6074c618.zip |
Majority of work on generation of new static site
I didn't originally intend for all of this to be in a single commit. But
here we are. I don't have the time to split these up more cleanly; this
project is taking more time than I originally hoped that it would.
This is a new static site generator. More information to follow in the
near future (hopefully in the form of an article), but repo2html is now
removed. See code comments for additional information; I tried to make it
suitable as a learning resource for others. It is essentially a set of
shell scripts with a fairly robust build for incremental generation.
The site has changed drastically, reflecting that its purpose has changed
over the years: it is now intended for publishing quality works (or at least
I hope), not just a braindump.
This retains most of the text of the original pages verbatim, with the
exception of the About page. Other pages may have their text modified in
commits that follow.
Enhancements to follow in future commits.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..a41c9f8 --- /dev/null +++ b/bootstrap @@ -0,0 +1,77 @@ +#!/bin/bash +# Prepares build environment +# +# Copyright (C) 2019 Mike Gerwitz +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# This will also download any necessary third-party files. Note that all +# downloads are proxied over Tor (using `torify'). +## + +set -euo pipefail + +# Source fonts and license (SIL Open Font License 1.1) +declare -ra fonts=( + https://github.com/adobe-fonts/source-sans-pro/raw/c7ea228c8cd66f65dac985bef98fda12c9cfa713/WOFF/OTF/SourceSansPro-Light.otf.woff + https://github.com/adobe-fonts/source-sans-pro/raw/c7ea228c8cd66f65dac985bef98fda12c9cfa713/WOFF/OTF/SourceSansPro-Regular.otf.woff + https://github.com/adobe-fonts/source-sans-pro/raw/c7ea228c8cd66f65dac985bef98fda12c9cfa713/LICENSE.txt +) + +declare -r tpimagesdir=images/tp +declare -r fontdir=fonts + + +# Download third-party images. This not only keeps them out of the +# repository, but explicitly states in a reproducible manner how the images +# were manipulated (if at all). +get-images() +{ + echo 'retrieving third-party images...' + + ( cd "$tpimagesdir" && ./gen-makefile > Makefile ) + make -C "$tpimagesdir" all check +} + + +# Download and verify fonts and license. +get-fonts() +{ + local font dest + + echo 'retrieving font files...' + for font in "${fonts[@]}"; do + dest="$fontdir/$( basename "$font" )" + + test ! -f "$dest" || continue + torify wget "$font" -O "$dest" + done + + # Verify that we haven't been served bad files. This should only happen + # in the case of network failure or a malicious host, since the above URLs + # reference the commit hash. + echo 'verifying font files...' + ( cd "$fontdir" && sha512sum -c SHA512SUM ) +} + + +# Bootstrap. +main() +{ + get-images + get-fonts +} + + +main "$@" |