blob: 2e96dcb0bf575a5893d070c8b49a56a4ed41cbd6 [file] [log] [blame]
package actions
import (
"context"
"strings"
"cos.googlesource.com/cos/tools.git/src/pkg/dkms"
"github.com/spf13/cobra"
)
var statusCmd = &cobra.Command{
Use: "status",
Short: "Displays the status of a dkms module",
Long: strings.TrimSpace(`
Displays the status of a DKMS package.
A package can be Added, Built, Installed, or Broken:
Added - the package has been added to the DKMS source tree.
Built - the package is Added and its modules have been built in the DKMS
build tree.
Installed - the package is Added and Built, and its modules have been
installed in the install tree.
Broken - the package is not Added, Built, or Installed. This can happen if the
package is absent from the source tree, it has an invalid dkms.conf, or
there was an unexpected failure when running a command for the package.
In this case, manual intervention is required.
If a --gcs-bucket is provided and the package is built or added only in the
bucket, the package will have a status of Built or Added, respectively.
`),
Args: ParseArgs,
Run: func(cmd *cobra.Command, args []string) {
var status dkms.PackageStatus
if RootGCSBucket == nil {
status = dkms.Status(RootPackage)
} else {
status = dkms.CachedStatus(context.Background(), RootPackage, RootGCSBucket)
}
cmd.Println(status)
},
}
func init() {
rootCmd.AddCommand(statusCmd)
}