| package actions | |
| import ( | |
| "context" | |
| "strings" | |
| "cos.googlesource.com/cos/tools.git/src/pkg/dkms" | |
| "github.com/spf13/cobra" | |
| ) | |
| var unbuildCmd = &cobra.Command{ | |
| Use: "unbuild", | |
| Short: "Uninstall a module and remove it from the build tree", | |
| Long: strings.TrimSpace(` | |
| Unbuild removes a module from the DKMS build tree and uninstalls it. | |
| This removes the compiled modules from the build directory, then calls | |
| the CLEAN command for the package from the package's build directory. | |
| If a --gcs-bucket is passed, this will unbuild the package in the bucket as | |
| well. | |
| `), | |
| Args: ParseArgs, | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| if RootGCSBucket == nil { | |
| return dkms.Unbuild(RootPackage) | |
| } else { | |
| return dkms.CachedUnbuild(context.Background(), RootPackage, RootGCSBucket, RootOptions) | |
| } | |
| }, | |
| } | |
| func init() { | |
| rootCmd.AddCommand(unbuildCmd) | |
| } |