parent
a17ec1d727
commit
a52689492d
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
main() {
|
||||
declare hugo_publish_dir=public
|
||||
|
||||
declare stork_config_file=stork.config.json # generated by hugo
|
||||
declare stork_index_file=home.st # generated by stork (json suffix triggers gzip/br compression)
|
||||
|
||||
declare stork_arch=stork-ubuntu-20-04
|
||||
declare stork_releases=https://files.stork-search.net/releases
|
||||
declare stork_version=1.5.0
|
||||
|
||||
declare stork_exec=${stork_arch}-${stork_version}
|
||||
declare stork_url=${stork_releases}/v${stork_version}/${stork_arch}
|
||||
|
||||
# Install Stork if it's not already installed.
|
||||
if [[ ! -f "${stork_exec}" ]]; then
|
||||
echo -e "\nInstalling Stork...\n"
|
||||
wget --no-verbose "${stork_url}" ||
|
||||
{ echo "Error: unable to wget ${stork_url}"; exit 1; }
|
||||
mv "${stork_arch}" "${stork_exec}" ||
|
||||
{ echo "Error: unable to mv ${stork_arch} ${stork_exec}"; exit 1; }
|
||||
chmod +x "${stork_exec}" ||
|
||||
{ echo "Error: unable to chmod ${stork_exec}"; exit 1; }
|
||||
fi
|
||||
|
||||
# Build the Stork index.
|
||||
echo -e "\nBuilding Stork index...\n"
|
||||
./${stork_exec} build --input "${hugo_publish_dir}/${stork_config_file}" --output "${hugo_publish_dir}/${stork_index_file}" ||
|
||||
{ echo "Error: unable to run stork"; exit 1; }
|
||||
}
|
||||
|
||||
set -euo pipefail
|
||||
main "$@"
|
Loading…
Reference in new issue