From facd2dd57068f703b623e482c957d942ab716231 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sat, 18 Jun 2022 23:37:19 -0600 Subject: [PATCH] add and document more build options --- README.md | 14 ++++++++++++++ build.sh | 22 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 95c515f..1614ab7 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,20 @@ Eureka also parses a [twtxt](https://twtxt.readthedocs.io/en/latest/) file at `S 6. Edit your `inc/meta.nav.htm` again to reference your new page. 7. Run `./build.sh` again! You will be warned of any orphaned files. +## build options + +Currently these build options are supported, and they must be supplied __in this order__ if used together: +- `-r`: Regenerate all thumbnails +- `-d`: Delete the latest twtxt entry; if used together with `-t`, the new entry replaces the old one +- `-t`: Add the next arg (quoted string) as a twtxt entry + +Combined argument format like `./build.sh -rdt "twt stuff"` is not supported. Use this format instead: +``` +./build.sh -r -d -t "twt stuff" +``` + +## debugging + If you run into issues with your markup crashing `eureka`, edit the `build.sh` file to uncomment the linux debug build line and comment the fast build; this will show you a stack trace of where you are running into buffer overflows, and give you a hint of where your markup is messed up. To see the individual file that has the error, also uncomment the line in `fpinject()` that prints the file names. # markup diff --git a/build.sh b/build.sh index 3a62ab4..77f1144 100755 --- a/build.sh +++ b/build.sh @@ -41,14 +41,32 @@ cc main.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o main # echo "$(du -b ./main | cut -f1) bytes written" # Run +if [ "$1" = "-r" ]; then + regen="true" + shift +fi +if [ "$1" = "-d" ]; then + shift + tmptwtxt=$(mktemp) + tail -n +2 ../www/twtxt.txt > ${tmptwtxt} + cp ${tmptwtxt} ../www/twtxt.txt + rm ${tmptwtxt} + echo "Deleted latest twtxt" +fi if [ "$1" = "-t" ]; then shift && ./tw.sh $@ + echo "Twtxt added" fi ./main exitstatus=$? if [ "${exitstatus}" = "0" ]; then - echo "Generating thumbnails in the background" - (./thumbnailer.sh build > /dev/null 2>&1) & + if [ "${regen}" = "true" ]; then + echo "Clearing thumbnails and regenerating in the background" + (./thumbnailer.sh clean > /dev/null 2>&1; ./thumbnailer.sh build > /dev/null 2>&1) & + else + echo "Generating thumbnails in the background" + (./thumbnailer.sh build > /dev/null 2>&1) & + fi fi # Cleanup