From ee3215ac76ef0e41ca654ed87309e32fedaf0abe Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 27 Oct 2019 10:56:47 +0000 Subject: [PATCH] build: make replacement of new rclone binary atomic on build This avoids the "text file busy" message when trying to replace the binary of a running rclone. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 929623287..7a67a6d27 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,8 @@ endif rclone: go build -v --ldflags "-s -X github.com/rclone/rclone/fs.Version=$(TAG)" $(BUILDTAGS) mkdir -p `go env GOPATH`/bin/ - cp -av rclone`go env GOEXE` `go env GOPATH`/bin/ + cp -av rclone`go env GOEXE` `go env GOPATH`/bin/rclone`go env GOEXE`.new + mv -v `go env GOPATH`/bin/rclone`go env GOEXE`.new `go env GOPATH`/bin/rclone`go env GOEXE` test_all: go install --ldflags "-s -X github.com/rclone/rclone/fs.Version=$(TAG)" $(BUILDTAGS) github.com/rclone/rclone/fstest/test_all