func IsAllowedAutoUpdate() bool {

	// Only try to update if downloaded from official sources
	if !config.IsOfficialBuild() {
		return false
	}

	// Avoid updating if installed from package manager
	if runtime.GOOS == "linux" {
		executablePath, err := os.Executable()
		if err != nil {
			logger.Errorf("Cannot get executable path: %s", err)
			return false
		}
		executablePath, err = filepath.EvalSymlinks(executablePath)
		if err != nil {
			logger.Errorf("Cannot get executable path: %s", err)
			return false
		}
		if fsutil.IsPathInDir("/usr", executablePath) || fsutil.IsPathInDir("/opt", executablePath) {
			return false
		}

		if isServerDockerized() {
			return false
		}
	}

	return true
}
// IsAllowedAutoUpdate tries to determine if the stash binary was installed from a
// package manager or if touching the executable is otherwise a bad idea
IsAllowedAutoUpdate tries to determine if the stash binary was installed from a
package manager or if touching the executable is otherwise a bad idea
// IsAllowedAutoUpdate tries to determine if the stash binary was installed from a // package manager or if touching the executable is otherwise a bad idea
func IsAllowedAutoUpdate() bool {
	if !config.IsOfficialBuild() {
		return false
	}
	if runtime.GOOS == "linux" {
		executablePath, err := os.Executable()
		if err != nil {
			logger.Errorf("Cannot get executable path: %s", err)
			return false
		}
		executablePath, err = filepath.EvalSymlinks(executablePath)
		if err != nil {
			logger.Errorf("Cannot get executable path: %s", err)
			return false
		}
		if fsutil.IsPathInDir("/usr", executablePath) || fsutil.IsPathInDir("/opt", executablePath) {
			return false
		}
		if isServerDockerized() {
			return false
		}
	}
	return true
}
func IsAllowedAutoUpdate ( ) bool { if ! config . IsOfficialBuild ( ) { return false } if runtime . GOOS == " " { executablePath , err := os . Executable ( ) if err != nil { logger . Errorf ( " " , err ) return false } executablePath , err = filepath . EvalSymlinks ( executablePath ) if err != nil { logger . Errorf ( " " , err ) return false } if fsutil . IsPathInDir ( " " , executablePath ) || fsutil . IsPathInDir ( " " , executablePath ) { return false } if isServerDockerized ( ) { return false } } return true }
IsAllowedAutoUpdate tries to determine if the stash binary was installed from a
package manager or if touching the executable is otherwise a bad idea
IsAllowedAutoUpdate tries to determine if the stash binary was installed from a package manager or if touching the executable is otherwise a bad idea
// Only try to update if downloaded from official sources // Avoid updating if installed from package manager