From 375e174afbaa18aa507e285aa33f7f9a2cf05167 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 21 Aug 2024 07:16:58 -0400 Subject: [PATCH] Use getdusk.sh --- Makefile | 9 +++------ getdusk.sh | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 getdusk.sh diff --git a/Makefile b/Makefile index a11c19c..4cd5d38 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,9 @@ TARGETS = $(ROMNAME) emul_$(CONF).sh all: $(TARGETS) -files/dusk$(DUSKVER).tar.gz: - curl -o $@ $(DUSKURL)/$@ - -$(DUSKDIR): files/dusk$(DUSKVER).tar.gz - cd files && cksum -c SHA512 - tar zxf files/dusk$(DUSKVER).tar.gz +$(DUSKDIR): + @echo "$(DUSKDIR) not present. Downloading and unpacking..." + ./getdusk.sh $(DUSKVER) $(DUSKDIR)/cos/extra.fs: $(DUSKDIR) rc2014.fs cp rc2014.fs $@ diff --git a/getdusk.sh b/getdusk.sh new file mode 100755 index 0000000..de5dacd --- /dev/null +++ b/getdusk.sh @@ -0,0 +1,24 @@ +#/bin/sh +# argument is DUSKVER +DUSKDIR="dusk$1" +DUSKTAR=dusk$1.tar.gz +DUSKURL=http://duskos.org/files/${DUSKTAR} + +fetch() { + echo "Fetching ${DUSKURL}" + wget ${DUSKURL} || \ + curl -O ${DUSKURL} || \ + ftp ${DUSKURL} || \ + (echo "no way to fetch a URL!" && exit 1) +} + +[ -e ${DUSKDIR} ] && exit 0 +cd files +[ -e ${DUSKTAR} ] || fetch +if command -v sha512sum; then + sha512sum -c SHA512 || exit 1 +else + cksum -c SHA512 || exit 1 +fi +cd .. +tar zxf files/${DUSKTAR} -- 2.45.2