mirror of
https://github.com/troglobit/finit.git
synced 2026-09-30 13:02:37 +07: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:
+23
-4
@@ -23,6 +23,7 @@
|
||||
DEST ?= ../tenv-root
|
||||
srcdir ?= ../
|
||||
|
||||
CACHE ?= ~/.cache
|
||||
ARCH ?= x86_64
|
||||
|
||||
FINITBIN ?= ./sbin/finit
|
||||
@@ -79,11 +80,29 @@ $(dirs):
|
||||
$(DEST)/bin/$(BBBIN).md5:
|
||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||
|
||||
.PHONY: $(DEST)/bin/$(BBBIN)
|
||||
$(DEST)/bin/$(BBBIN): $(DEST)/bin/$(BBBIN).md5
|
||||
wget -O $@ $(BBURL)
|
||||
chmod +x $@
|
||||
cd $(dir $@); \
|
||||
md5sum -c $(BBBIN).md5
|
||||
@cd $(dir $@)
|
||||
@if ! md5sum --status -c $(BBBIN).md5 2>/dev/null; then \
|
||||
if [ -d $(CACHE) ]; then \
|
||||
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:
|
||||
cp $(srcdir)/tenv/$(notdir $@) $@
|
||||
|
||||
Reference in New Issue
Block a user