From 1a2836577b10be791c479d2c07743455cc6f5dcf Mon Sep 17 00:00:00 2001 From: nhkeni Date: Sun, 27 Aug 2023 13:05:13 -0400 Subject: [PATCH] check the checksum for Lua in "make fetch-lua" Works for MacOS and linux. --- submodules/CHKSUMS | 7 +++++++ sys/unix/Makefile.top | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 submodules/CHKSUMS diff --git a/submodules/CHKSUMS b/submodules/CHKSUMS new file mode 100644 index 000000000..44ae314a0 --- /dev/null +++ b/submodules/CHKSUMS @@ -0,0 +1,7 @@ +# checksums for fetched submodules +# NetHack 3.7 CHKSUMS $NHDT-Date: 1693155877 2023/08/27 17:04:37 $ $NHDT-Branch: keni-luacksum $ +# check: +# shasum -a 256 -c -s THISFILE < FILETOCHECK +# generate: +# shasum -a 256 FILETOCHECK >>THISFILE +7d5ea1b9cb6aa0b59ca3dde1c6adcb57ef83a1ba8e5432c0ecd06bf439b3ad88 lua-5.4.6.tar.gz diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 28397830e..a4f164af0 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -307,7 +307,17 @@ fetch-lua: fetch-Lua fetch-Lua: ( mkdir -p lib && cd lib && \ + shac1=`command -v shasum`; \ + shac2=`command -v sha256sum`; \ + if [ ! -z $$shac1 ]; then \ + shac="$$shac1 -a 256"; elif [ ! -z $$shac2 ]; then \ + shac=$$shac2; else echo "CAUTION: no way to check integrity"; \ + fi; \ curl -R -O https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz && \ + if [ ! -z "$$shac" ]; then \ + echo Checking integrity with $$shac; \ + $$shac -w -c ../submodules/CHKSUMS < lua-$(LUA_VERSION).tar.gz; \ + fi; \ tar zxf lua-$(LUA_VERSION).tar.gz && \ rm -f lua-$(LUA_VERSION).tar.gz ) # remove include/nhlua.h in case it was created for some other Lua version