Esempio n. 1
0
func NewDefaultUpdater(g *libkb.GlobalContext) *updater.Updater {
	options := DefaultUpdaterOptions(g)
	if options == nil {
		g.Log.Info("No updater available for this environment")
		return nil
	}
	source := DefaultUpdateSource(g)
	if source == nil {
		g.Log.Info("No updater source available for this environment")
		return nil
	}
	return updater.NewUpdater(*options, source, g.Env, g.Log)
}
Esempio n. 2
0
func (u *UpdateEngine) Run(ctx *Context) (err error) {
	u.G().Log.Debug("+ UpdateEngine Run")
	defer func() {
		u.G().Log.Debug("- UpdateEngine Run")
	}()

	source, err := NewUpdateSourceFromString(u.G(), u.options.Source)
	if err != nil {
		return
	}

	updr := updater.NewUpdater(u.options, source, u.G().Env, u.G().Log)
	update, err := updr.Update(ctx.UpdateUI, u.options.Force, true)
	if err != nil {
		return
	}
	u.Result = update
	return
}