summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUeda Naoaki <nao@uedder.com>2023-02-01 22:13:58 +0900
committerUeda Naoaki <nao@uedder.com>2023-02-02 00:17:32 +0900
commit6cc3dd2648af19a110872b09eddb58b775e38b2a (patch)
tree85f3443d06dbab7c5c419c20edf4b9f9e4ba2dca
parent62ccceb58e15fa73db83811a3276a207235a1df4 (diff)
downloadasustor-nas-tailscale-installer-6cc3dd2648af19a110872b09eddb58b775e38b2a.tar.gz
asustor-nas-tailscale-installer-6cc3dd2648af19a110872b09eddb58b775e38b2a.tar.bz2
asustor-nas-tailscale-installer-6cc3dd2648af19a110872b09eddb58b775e38b2a.zip
Refactoring a process to install
-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