Exemplo n.º 1
0
func (x *cmdBooted) Execute(args []string) error {
	if len(args) > 0 {
		return ErrExtraArgs
	}

	if release.OnClassic {
		fmt.Fprintf(Stdout, i18n.G("Ignoring 'booted' on classic"))
		return nil
	}

	bootloader, err := partition.FindBootloader()
	if err != nil {
		return fmt.Errorf(i18n.G("cannot mark boot successful: %s"), err)
	}

	if err := partition.MarkBootSuccessful(bootloader); err != nil {
		return err
	}

	ovld, err := overlord.New()
	if err != nil {
		return err
	}
	return boot.UpdateRevisions(ovld)
}
Exemplo n.º 2
0
func (m *DeviceManager) ensureBootOk() error {
	m.state.Lock()
	defer m.state.Unlock()

	if release.OnClassic {
		return nil
	}

	if !m.bootOkRan {
		bootloader, err := partition.FindBootloader()
		if err != nil {
			return fmt.Errorf(i18n.G("cannot mark boot successful: %s"), err)
		}
		if err := partition.MarkBootSuccessful(bootloader); err != nil {
			return err
		}
		m.bootOkRan = true
	}

	return snapstate.UpdateBootRevisions(m.state)
}