in DistroLauncher/DistroLauncher.cpp [23:56]
HRESULT InstallDistribution(bool createUser)
{
// Register the distribution.
Helpers::PrintMessage(MSG_STATUS_INSTALLING);
HRESULT hr = g_wslApi.WslRegisterDistribution();
if (FAILED(hr)) {
return hr;
}
// Delete /etc/resolv.conf to allow WSL to generate a version based on Windows networking information.
DWORD exitCode;
hr = g_wslApi.WslLaunchInteractive(L"/bin/rm /etc/resolv.conf", true, &exitCode);
if (FAILED(hr)) {
return hr;
}
// Create a user account.
if (createUser) {
Helpers::PrintMessage(MSG_CREATE_USER_PROMPT);
std::wstring userName;
do {
userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32);
} while (!DistributionInfo::CreateUser(userName));
// Set this user account as the default.
hr = SetDefaultUser(userName);
if (FAILED(hr)) {
return hr;
}
}
return hr;
}