installkernel-wsl¶
Script and installkernel hook to copy Linux kernel to the host system and update .wslconfig.
Commands¶
installkernel-wsl¶
Script and hook to copy Linux kernel to the host system and update .wslconfig.
Usage
installkernel-wsl [OPTIONS] COMMAND [COMMAND_ARGS]...
Options
- -d, --debug¶
Enable debug level logging.
Arguments
- COMMAND¶
Required argument
- COMMAND_ARGS¶
Optional argument(s)
Usage as a hook¶
After installation:
mkdir -p /etc/kernel/install.d
ln -sf "$(command -v installkernel-wsl)" /etc/kernel/install.d/99-wsl-kernel.install
Library¶
Main script.
-
installkernel_wsl.utils.copy_kernel_to_win(name: str, src: str, *, fail_immediately: bool =
False) Path¶ Copy the kernel update config file to the WSL config directory.
- Parameters:¶
- name : str¶
The name of the kernel file to copy to Windows.
- src : str¶
The source path of the kernel file to copy.
- fail_immediately : bool¶
Whether to raise a PermissionError immediately if the file cannot be copied due to permission issues, by default
False. IfFalse, a sequential suffix will be added to the filename until a non-existing filename is found.
- Returns:¶
Destination path of the copied kernel file (possibly with a numeric suffix).
- Return type:¶
Path
- Raises:¶
PermissionError – If the file cannot be copied due to permission issues and
fail_immediatelyisTrue.
- installkernel_wsl.utils.get_win_var(var_name: str) str¶
Get a Windows environment variable.
- Returns:¶
The environment variable value printed by
cmd.exe.- Return type:¶
- Raises:¶
ValueError – If
cmd.exedid not print a value for the variable.
- installkernel_wsl.utils.get_windows_home_purewindowspath() PureWindowsPath¶
Get the Windows home path as a PureWindowsPath.
- installkernel_wsl.utils.update_wslconfig(kernel_path_lin: PathLike[str] | str) None¶
Update the .wslconfig file with the new kernel path.
-
installkernel_wsl.utils.wslpath(path: str | PathLike[str], *, absolute: bool =
False, windows: bool =False) str¶ Convert a Windows path to a WSL path.
- Returns:¶
The path string printed by
wslpath.- Return type:¶
- Raises:¶
ValueError – If
wslpathdid not print a value for the path.