mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
test: add support for caching busybox-x86_64 binary in ~/.cache
While without a working Internet connection today I ran into the issue of not being able to run the tests. This adds a basic caching mechanism to setup-root.sh which saves busybox-x86_64 in ~/.cache, if available. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
b8b200ad75
commit
aeb48ef04b
1 file changed
+23
-4
+23
-4
@@ -23,6 +23,7 @@
|
|||||||
DEST ?= ../tenv-root
|
DEST ?= ../tenv-root
|
||||||
srcdir ?= ../
|
srcdir ?= ../
|
||||||
|
|
||||||
|
CACHE ?= ~/.cache
|
||||||
ARCH ?= x86_64
|
ARCH ?= x86_64
|
||||||
|
|
||||||
FINITBIN ?= ./sbin/finit
|
FINITBIN ?= ./sbin/finit
|
||||||
@@ -79,11 +80,29 @@ $(dirs):
|
|||||||
$(DEST)/bin/$(BBBIN).md5:
|
$(DEST)/bin/$(BBBIN).md5:
|
||||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||||
|
|
||||||
|
.PHONY: $(DEST)/bin/$(BBBIN)
|
||||||
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
||||||
wget -O $@ $(BBURL)
|
@cd $(dir $@)
|
||||||
chmod +x $@
|
@if ! md5sum --status -c $(BBBIN).md5 2>/dev/null; then \
|
||||||
cd $(dir $@); \
|
if [ -d $(CACHE) ]; then \
|
||||||
md5sum -c $(BBBIN).md5
|
echo "Cannot find $(BBBIN), checking $(CACHE) ..."; \
|
||||||
|
cd $(CACHE); \
|
||||||
|
cp $(DEST)/bin/$(BBBIN).md5 .; \
|
||||||
|
if ! md5sum --status -c $(BBBIN).md5; then \
|
||||||
|
echo "No $(BBBIN) available downloading ..."; \
|
||||||
|
wget $(BBURL); \
|
||||||
|
else \
|
||||||
|
echo "Found valid $(BBBIN) in cache!"; \
|
||||||
|
fi; \
|
||||||
|
cp $(BBBIN) $@; \
|
||||||
|
else \
|
||||||
|
echo "Cannot find $(BBBIN), downloading ..."; \
|
||||||
|
wget -O $@ $(BBURL); \
|
||||||
|
fi; \
|
||||||
|
cd $(dir $@); \
|
||||||
|
md5sum -c $(BBBIN).md5; \
|
||||||
|
fi
|
||||||
|
@chmod +x $@
|
||||||
|
|
||||||
$(DEST)/bin/chrootsetup.sh:
|
$(DEST)/bin/chrootsetup.sh:
|
||||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||||
|
|||||||
Reference in new issue
Block a user