support creating the checksums file

This commit is contained in:
Christian Hesse 2025-03-26 09:19:02 +01:00
parent ce39b79f69
commit f8c3659f6a
3 changed files with 17 additions and 2 deletions

3
.gitignore vendored
View file

@ -9,5 +9,8 @@
# html files (as generated from markdown)
*.html
# checksums file as used by $ScriptInstallUpdate
checksums.json
# Mac OS X folder settings file
.DS_Store

View file

@ -9,7 +9,7 @@ WIFI = $(wildcard *.wifi.rsc)
MARKDOWN = $(wildcard *.md doc/*.md doc/mod/*.md)
HTML = $(MARKDOWN:.md=.html)
all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML)
all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML) checksums.json
%.html: %.md Makefile
markdown $< | sed 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' > $@
@ -32,5 +32,8 @@ all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML)
-e '/^# !!/,/^# !!/c # !! Do not edit this file, it is generated from template!' \
< $< > $@
checksums.json: contrib/checksums.sh *.rsc */*.rsc
contrib/checksums.sh
clean:
rm -f $(HTML)
rm -f $(HTML) checksums.json

9
contrib/checksums.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
# generate a checksums file as used by $ScriptInstallUpdate
set -e
md5sum $(find -name '*.rsc' | sort) | \
sed -e "s| \./||" -e 's|.rsc$||' | \
jq --raw-input --null-input '[ inputs | split (" ") | { (.[1]): (.[0]) }] | add' > 'checksums.json'