blob: e3374510261b5b343f06011c9cda5cac7b525c93 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package bootserver
import (
// Mode determines the arguments to use when booting/paving images.
type Mode int
const (
// ModeNull is a null default that can be error checked against.
ModeNull Mode = iota
// ModePave is a directive to pave when booting.
// ModeNetboot is a directive to netboot when booting.
// ModePaveZedboot is a directive to pave zedboot to partition A (the initial boot partition) when booting.
// String returns the string value of the Mode type.
func (m *Mode) String() string {
switch *m {
case ModePave:
return "pave"
case ModeNetboot:
return "netboot"
case ModePaveZedboot:
return "pave-zedboot"
return ""
// Set assigns a value to the Mode given a string
func (m *Mode) Set(s string) error {
switch s {
case "pave":
*m = ModePave
case "netboot":
*m = ModeNetboot
case "pave-zedboot":
*m = ModePaveZedboot
return fmt.Errorf("%s is not a valid mode", s)
return nil