Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8431)

Unified Diff: cipd/client/cipd/install_client.go

Issue 2509803002: Add cipd selfupdate command. (Closed)
Patch Set: Add additional early-exit Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cipd/client/cipd/client_test.go ('k') | cipd/client/cipd/install_client_windows.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cipd/install_client.go
diff --git a/cipd/client/cipd/install_client.go b/cipd/client/cipd/install_client.go
new file mode 100644
index 0000000000000000000000000000000000000000..947ecd14894f9009f740aaf0e50c507805c7595b
--- /dev/null
+++ b/cipd/client/cipd/install_client.go
@@ -0,0 +1,29 @@
+// Copyright 2015 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+// +build !windows
+
+package cipd
+
+import (
+ "os"
+
+ "github.com/luci/luci-go/cipd/client/cipd/local"
+ "golang.org/x/net/context"
+)
+
+func (client *clientImpl) installClient(ctx context.Context, fs local.FileSystem, fetchURL, destination string) error {
+ curStat, err := os.Stat(destination)
+ if err != nil {
+ return err
+ }
+
+ return fs.EnsureFile(ctx, destination, func(of *os.File) error {
+ if err := of.Chmod(curStat.Mode()); err != nil {
+ return err
+ }
+ // TODO(iannucci): worry about owner/group?
+ return client.storage.download(ctx, fetchURL, of)
+ })
+}
« no previous file with comments | « cipd/client/cipd/client_test.go ('k') | cipd/client/cipd/install_client_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698