| package actions | |
| import ( | |
| "context" | |
| "strings" | |
| "cos.googlesource.com/cos/tools.git/src/pkg/dkms" | |
| "github.com/spf13/cobra" | |
| ) | |
| var installCmd = &cobra.Command{ | |
| Use: "install", | |
| Short: "Installs a module into the install tree", | |
| Long: strings.TrimSpace(` | |
| Installs all of the modules from a DKMS package into the install tree. | |
| If the package is not already added to the DKMS source tree, this will try to | |
| add it. If the package is not already built, this will try to build it. | |
| See the add and build commands for more details. | |
| For each module in the package, this will check if the version being | |
| installed is newer than the version of the module which is already | |
| installed, if applicable. If the module version is older than the one | |
| already installed, this will skip installing that module and emit an info | |
| message. --force-version-override can be passed to bypass the version | |
| check and install the module anyway. | |
| If --modprobe-on-install is passed, then modprobe will be called on | |
| the module after it is copied to the install tree to insert it into the | |
| running kernel. depmod is run first in order to recalculate any module | |
| dependencies, unless --no-depmod is also passed. | |
| `), | |
| Args: ParseArgs, | |
| RunE: func(cmd *cobra.Command, args []string) error { | |
| if RootGCSBucket == nil { | |
| return dkms.Install(RootPackage, RootOptions) | |
| } else { | |
| return dkms.CachedInstall(context.Background(), RootPackage, RootGCSBucket, RootOptions) | |
| } | |
| }, | |
| } | |
| func init() { | |
| rootCmd.AddCommand(installCmd) | |
| } |