Beispiel #1
0
func (u *Update) getPath() (string, error) {
	if u.TargetPath == "" {
		return osext.Executable()
	} else {
		return u.TargetPath, nil
	}
}
Beispiel #2
0
func defaultChecksum() string {
	path, err := osext.Executable()
	if err != nil {
		return ""
	}

	checksum, err := update.ChecksumForFile(path)
	if err != nil {
		return ""
	}

	return hex.EncodeToString(checksum)
}
Beispiel #3
0
func writeGlobalGitConfig(domain, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.https://git.%s.sslCAInfo", domain), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}
	if err := gitConfig(fmt.Sprintf("credential.https://git.%s.helper", domain), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
Beispiel #4
0
func WriteGlobalGitConfig(gitURL, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.%s.sslCAInfo", gitURL), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}
	if err := gitConfig(fmt.Sprintf("credential.%s.helper", gitURL), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
Beispiel #5
0
func WriteGlobalGitConfig(gitURL, caFile string) error {
	if err := gitConfig(fmt.Sprintf("http.%s.sslCAInfo", gitURL), caFile); err != nil {
		return err
	}
	self, err := osext.Executable()
	if err != nil {
		return err
	}

	// Ensure the path uses `/`s
	// Git on windows can't handle `\`s
	self = filepath.ToSlash(self)

	if err := gitConfig(fmt.Sprintf("credential.%s.helper", gitURL), self+" git-credentials"); err != nil {
		return err
	}
	return nil
}
Beispiel #6
0
func (u *Updater) backgroundRun() {
	if u == nil {
		return
	}
	if !u.wantUpdate() {
		return
	}
	self, err := osext.Executable()
	if err != nil {
		// fail update, couldn't figure out path to self
		return
	}
	// TODO(titanous): logger isn't on Windows. Replace with proper error reports.
	l := exec.Command("logger", "-tflynn")
	c := exec.Command(self, "update")
	if w, err := l.StdinPipe(); err == nil && l.Start() == nil {
		c.Stdout = w
		c.Stderr = w
	}
	c.Start()
}