From 6cc3dd2648af19a110872b09eddb58b775e38b2a Mon Sep 17 00:00:00 2001 From: Ueda Naoaki Date: Wed, 1 Feb 2023 22:13:58 +0900 Subject: Refactoring a process to install --- .gitignore | 2 ++ Makefile | 25 +++++++++++++++---------- 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 '')_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 -- cgit v1.2.3-54-g00ecf