summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile25
2 files changed, 17 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index f740898..a6302f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@ custom.mk
S??tailscale
tailscale
tailscaled
+ver
+downloaded
diff --git a/Makefile b/Makefile
index 7f78c8a..590996a 100644
--- a/Makefile
+++ b/Makefile
@@ -25,18 +25,23 @@ install: tailscaled tailscale install.sh | $(init_file)
$(init_file): SXXtailscale.template
cp -a $< $@
-tailscale tailscaled: $(tailscale.tgz)
- tar --strip-components 1 -xmvzf $< $(basename $<)/$@
+tailscale tailscaled: downloaded
+ tar --strip-components 1 -xmvzf $(tailscale.tgz) $(basename $(tailscale.tgz))/$@
-$$(tailscale.tgz):
+ver:
+ curl -s https://api.github.com/repos/tailscale/tailscale/releases/latest | perl -nle '/"name":\s*"(.+)"/ and print $$1' > $@
+
+.PHONY: ver-updated
+ver-updated:
+ $(MAKE) --always-make ver
+
+TGZ_URL = https://pkgs.tailscale.com/stable/tailscale_$(shell cat ver 2> /dev/null || printf '<ver>')_arm64.tgz
+tailscale.tgz = $(notdir $(TGZ_URL))
+
+downloaded: ver
curl -L $(TGZ_URL) -O
+ touch $@
.PHONY: clean
clean:
- rm -f *.tgz $(init_file) tailscale tailscaled
-
-.SECONDEXPANSION:
-# default is latest
-VER ?= $(shell curl -s https://api.github.com/repos/tailscale/tailscale/releases/latest | perl -nle '/"name":\s*"(.+)"/ and print $$1')
-TGZ_URL = https://pkgs.tailscale.com/stable/tailscale_$(VER)_arm64.tgz
-tailscale.tgz = $(notdir $(TGZ_URL))
+ rm -f *.tgz $(init_file) tailscale tailscaled ver downloaded