Skip to content

Commit

Permalink
add install for rclone
Browse files Browse the repository at this point in the history
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
  • Loading branch information
SgtCoDFish committed Jun 9, 2022
1 parent 8c3b77b commit 299a7c3
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion make/tools.mk
Expand Up @@ -23,6 +23,7 @@ CMREL_VERSION=a1e2bad95be9688794fd0571c4c40e88cccf9173
K8S_RELEASE_NOTES_VERSION=0.7.0
GOIMPORTS_VERSION=0.1.8
GOTESTSUM_VERSION=1.7.0
RCLONE_VERSION=1.58.1
YTT_VERSION=0.36.0
YQ_VERSION=4.11.2
CRANE_VERSION=0.8.0
Expand Down Expand Up @@ -62,7 +63,7 @@ ifeq (x86_64, $(HOST_ARCH))
endif

.PHONY: tools
tools: $(BINDIR)/tools/helm $(BINDIR)/tools/kubectl $(BINDIR)/tools/kind $(BINDIR)/tools/cosign $(BINDIR)/tools/ginkgo $(BINDIR)/tools/cmrel $(BINDIR)/tools/release-notes $(BINDIR)/tools/controller-gen k8s-codegen-tools $(BINDIR)/tools/goimports $(BINDIR)/tools/gotestsum $(BINDIR)/tools/ytt $(BINDIR)/tools/yq
tools: $(BINDIR)/tools/helm $(BINDIR)/tools/kubectl $(BINDIR)/tools/kind $(BINDIR)/tools/cosign $(BINDIR)/tools/ginkgo $(BINDIR)/tools/cmrel $(BINDIR)/tools/release-notes $(BINDIR)/tools/controller-gen k8s-codegen-tools $(BINDIR)/tools/goimports $(BINDIR)/tools/gotestsum $(BINDIR)/tools/rclone $(BINDIR)/tools/ytt $(BINDIR)/tools/yq

######
# Go #
Expand Down Expand Up @@ -313,6 +314,32 @@ $(BINDIR)/downloaded/tools/crane@$(CRANE_VERSION): $(DEPENDS_ON_GO) | $(BINDIR)/
GOBIN=$(PWD)/$(dir $@) $(GO) install github.com/google/go-containerregistry/cmd/crane@v$(CRANE_VERSION)
@mv $(subst @$(CRANE_VERSION),,$@) $@

##########
# rclone #
##########

RCLONE_OS := $(HOST_OS)
ifeq (darwin, $(HOST_OS))
# rclone calls macOS "osx" not "darwin"
RCLONE_OS = osx
endif

RCLONE_linux_amd64_SHA256SUM=135a4a0965cb58eafb07941f2013a82282c44c28fea9595587778e969d9ed035
RCLONE_osx_amd64_SHA256SUM=03b104accc26d5aec14088c253ea5a6bba3263ae00fc403737cabceecad9eae9
RCLONE_osx_arm64_SHA256SUM=eb547bd0ef2037118a01003bed6cf00a1d6e6975b6f0a73cb811f882a3c3de72

$(BINDIR)/tools/rclone: $(BINDIR)/downloaded/tools/rclone-v$(RCLONE_VERSION)-$(RCLONE_OS)-$(HOST_ARCH) $(BINDIR)/scratch/RCLONE_VERSION | $(BINDIR)/tools
@cd $(dir $@) && $(LN) $(patsubst $(BINDIR)/%,../%,$<) $(notdir $@)

$(BINDIR)/downloaded/tools/rclone-v$(RCLONE_VERSION)-%: | $(BINDIR)/downloaded/tools
curl -sSfL https://github.com/rclone/rclone/releases/download/v$(RCLONE_VERSION)/rclone-v$(RCLONE_VERSION)-$*.zip > $@.zip
./hack/util/checkhash.sh $@.zip $(RCLONE_$(subst -,_,$*)_SHA256SUM)
@# -p writes to stdout, the second file arg specifies the sole file we
@# want to extract
unzip -p $@.zip $(notdir $@)/rclone > $@
chmod +x $@
rm -f $@.zip

#######
# ytt #
#######
Expand Down

0 comments on commit 299a7c3

Please sign in to comment.