-
Notifications
You must be signed in to change notification settings - Fork 709
Add make target to fetch the default kernel #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,8 @@ extension Application { | |
| @Flag(name: .long, help: "Enable debug logging for the runtime daemon.") | ||
| var debug = false | ||
|
|
||
| @Flag(name: .long, help: "Do not prompt for confirmation before installing runtime dependencies") | ||
| var installDependencies: Bool = false | ||
| @Flag(name: .long, inversion: .prefixedEnableDisable, help: "Specify if the default kernel should be installed or not.") | ||
| var kernelInstall: Bool? | ||
|
|
||
| func run() async throws { | ||
| // Without the true path to the binary in the plist, `container-apiserver` won't launch properly. | ||
|
|
@@ -110,16 +110,23 @@ extension Application { | |
| let defaultKernelURL = kernelDependency.source | ||
| let defaultKernelBinaryPath = ClientDefaults.get(key: .defaultKernelBinaryPath) | ||
|
|
||
| print("No default kernel configured.") | ||
| print("Install the recommended default kernel from [\(kernelDependency.source)]? [Y/n]: ", terminator: "") | ||
| if !installDependencies { | ||
| var shouldInstallKernel = false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a discussion for a follow-up maybe: Better to assume My feeling is that that is too magical. It's simpler to have it just as it is now, with yes/no/default to interactive, and that the following sort of usage is accepted (though flags would be the recommended approach): echo y | container system start |
||
| if kernelInstall == nil { | ||
| print("No default kernel configured.") | ||
| print("Install the recommended default kernel from [\(kernelDependency.source)]? [Y/n]: ", terminator: "") | ||
| guard let read = readLine(strippingNewline: true) else { | ||
| throw ContainerizationError(.internalError, message: "Failed to read user input") | ||
| } | ||
| guard read.lowercased() == "y" || read.count == 0 else { | ||
| print("Please use the `container system kernel set --recommended` command to configure the default kernel") | ||
| return | ||
| } | ||
| shouldInstallKernel = true | ||
| } else { | ||
| shouldInstallKernel = kernelInstall ?? false | ||
| } | ||
| guard shouldInstallKernel else { | ||
| return | ||
| } | ||
| print("Installing kernel...") | ||
| try await KernelSet.downloadAndInstallWithProgressBar(tarRemoteURL: defaultKernelURL, kernelFilePath: defaultKernelBinaryPath) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.