From dd12e0f4d5378044fcab5a95bae726378eca4c29 Mon Sep 17 00:00:00 2001 From: Carlos Ramirez Date: Sun, 23 Jan 2022 00:33:46 +0100 Subject: [PATCH 1/5] Code cleanup. Change wsl.conf using the API instead of calling wsl.exe command [PEN-236] --- DistroLauncher/DistributionInfo.cpp | 90 +++++------------------------ DistroLauncher/DistributionInfo.h | 6 +- DistroLauncher/DistroLauncher.cpp | 36 ++++++++---- 3 files changed, 44 insertions(+), 88 deletions(-) diff --git a/DistroLauncher/DistributionInfo.cpp b/DistroLauncher/DistributionInfo.cpp index 654237d3..b8ee5fe6 100644 --- a/DistroLauncher/DistributionInfo.cpp +++ b/DistroLauncher/DistributionInfo.cpp @@ -5,80 +5,21 @@ #include "stdafx.h" -void RunProcess(LPWSTR cmdline) +HRESULT DistributionInfo::ChangeDefaultUserInWslConf(const std::wstring_view userName) { - // additional information - STARTUPINFOW si; - PROCESS_INFORMATION pi; + DWORD exitCode = 0; - // set the size of the structures - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - ZeroMemory(&pi, sizeof(pi)); + wchar_t commandLine[255]; + _swprintf_p(commandLine, _countof(commandLine), + L"if [ $(grep -c \"\\[user\\]\" /etc/wsl.conf) -eq \"0\" ]; then echo -e \"\\n[user]\\ndefault=%1$s\">>/etc/wsl.conf; else sed -i \"s/\\(default=\\)\\(.*\\)/\\1%1$s/\" /etc/wsl.conf ; fi", + std::wstring(userName).c_str()); - // start the program up - CreateProcessW - ( - nullptr, // the path - cmdline, // Command line - nullptr, // Process handle not inheritable - nullptr, // Thread handle not inheritable - FALSE, // Set handle inheritance to FALSE - 0, // Opens file in a separate console - nullptr, // Use parent's environment block - nullptr, // Use parent's starting directory - &si, // Pointer to STARTUPINFO structure - &pi // Pointer to PROCESS_INFORMATION structure - ); - - // Wait until child process exits. - WaitForSingleObject(pi.hProcess, INFINITE); - - // Close process and thread handles. - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); -} - -int RetrieveWindowsVersion() -{ - wchar_t value[80]; - DWORD size = sizeof(value); - - // ReSharper disable once CppTooWideScope - const auto status = RegGetValueW(HKEY_LOCAL_MACHINE, - L"Software\\Microsoft\\Windows NT\\CurrentVersion", - L"CurrentBuild", - RRF_RT_REG_SZ, - nullptr, - &value, - &size - ); - - if (status == ERROR_SUCCESS) + if (const auto hr = g_wslApi.WslLaunchInteractive(commandLine, true, &exitCode); FAILED(hr) || exitCode != 0) { - const auto valueInt = std::stoi(value); - - return valueInt; + return hr; } - return -1; -} - -void DistributionInfo::ChangeDefaultUserInWslConf(const std::wstring_view userName) -{ - // ReSharper disable once CppTooWideScope - const int version = RetrieveWindowsVersion(); - if (version < 18362) - { - return; - } - - wchar_t buff[255]; - _swprintf_p(buff, _countof(buff), - L"wsl.exe -d %1$s -u root -- if [ $(grep -c \"\\[user\\]\" /etc/wsl.conf) -eq \"0\" ]; then echo -e \"\\n[user]\\ndefault=%2$s\">>/etc/wsl.conf; else sed -i \"s/\\(default=\\)\\(.*\\)/\\1%2$s/\" /etc/wsl.conf ; fi", - Name.c_str(), std::wstring(userName).c_str()); - - RunProcess(buff); + return 0; } bool DistributionInfo::CreateUser(std::wstring_view userName) @@ -88,7 +29,7 @@ bool DistributionInfo::CreateUser(std::wstring_view userName) std::wstring commandLine = L"/usr/sbin/adduser --quiet --gecos '' "; commandLine += userName; auto hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - if ((FAILED(hr)) || (exitCode != 0)) + if (FAILED(hr) || exitCode != 0) { return false; } @@ -97,7 +38,7 @@ bool DistributionInfo::CreateUser(std::wstring_view userName) commandLine = L"/usr/sbin/usermod -aG adm,cdrom,sudo,dip,plugdev "; commandLine += userName; hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode); - if ((FAILED(hr)) || (exitCode != 0)) + if (FAILED(hr) || exitCode != 0) { // Delete the user if the group add command failed. commandLine = L"/usr/sbin/deluser "; @@ -114,7 +55,7 @@ ULONG DistributionInfo::QueryUid(std::wstring_view userName) // Create a pipe to read the output of the launched process. HANDLE readPipe; HANDLE writePipe; - SECURITY_ATTRIBUTES sa{sizeof(sa), nullptr, true}; + SECURITY_ATTRIBUTES sa{sizeof sa, nullptr, true}; auto uid = UID_INVALID; if (CreatePipe(&readPipe, &writePipe, &sa, 0)) { @@ -124,6 +65,7 @@ ULONG DistributionInfo::QueryUid(std::wstring_view userName) HANDLE child; // ReSharper disable once CppTooWideScope + // ReSharper disable once CppTooWideScopeInitStatement auto hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child); if (SUCCEEDED(hr)) @@ -131,7 +73,7 @@ ULONG DistributionInfo::QueryUid(std::wstring_view userName) // Wait for the child to exit and ensure process exited successfully. WaitForSingleObject(child, INFINITE); DWORD exitCode; - if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) + if (GetExitCodeProcess(child, &exitCode) == false || exitCode != 0) { hr = E_INVALIDARG; } @@ -140,11 +82,11 @@ ULONG DistributionInfo::QueryUid(std::wstring_view userName) if (SUCCEEDED(hr)) { // ReSharper disable once CppTooWideScope - char buffer[64]; + char buffer[64]{}; DWORD bytesRead; // Read the output of the command from the pipe and convert to a UID. - if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) + if (ReadFile(readPipe, buffer, sizeof buffer - 1, &bytesRead, nullptr)) { buffer[bytesRead] = ANSI_NULL; try diff --git a/DistroLauncher/DistributionInfo.h b/DistroLauncher/DistributionInfo.h index 06fe2449..8d116885 100644 --- a/DistroLauncher/DistributionInfo.h +++ b/DistroLauncher/DistributionInfo.h @@ -13,10 +13,10 @@ namespace DistributionInfo // // WARNING: This value must not change between versions of your app, // otherwise users upgrading from older versions will see launch failures. - const std::wstring Name = L"WLinux"; + const std::wstring NAME = L"WLinux"; // The title bar for the console window while the distribution is installing. - const std::wstring WindowTitle = L"Pengwin"; + const std::wstring WINDOW_TITLE = L"Pengwin"; // Create and configure a user account. bool CreateUser(std::wstring_view userName); @@ -25,5 +25,5 @@ namespace DistributionInfo ULONG QueryUid(std::wstring_view userName); // Changes the default user in /etc/wsl.conf - void ChangeDefaultUserInWslConf(std::wstring_view userName); + HRESULT ChangeDefaultUserInWslConf(std::wstring_view userName); } diff --git a/DistroLauncher/DistroLauncher.cpp b/DistroLauncher/DistroLauncher.cpp index 3707285c..9713e66c 100644 --- a/DistroLauncher/DistroLauncher.cpp +++ b/DistroLauncher/DistroLauncher.cpp @@ -26,12 +26,13 @@ using namespace Windows::Storage; // Helper class for calling WSL Functions: // https://msdn.microsoft.com/en-us/library/windows/desktop/mt826874(v=vs.85).aspx -WslApiLoader g_wslApi(DistributionInfo::Name); +// ReSharper disable once CppInconsistentNaming +WslApiLoader g_wslApi(DistributionInfo::NAME); static HRESULT InstallDistribution(bool createUser); static HRESULT SetDefaultUser(std::wstring_view userName); -HRESULT InstallDistribution(bool createUser) +HRESULT InstallDistribution(const bool createUser) { // Register the distribution. Helpers::PrintMessage(MSG_STATUS_INSTALLING); @@ -75,19 +76,30 @@ HRESULT SetDefaultUser(std::wstring_view userName) { // Query the UID of the given user name and configure the distribution // to use this UID as the default. - const auto uid = DistributionInfo::QueryUid(userName); + const ULONG uid = DistributionInfo::QueryUid(userName); if (uid == UID_INVALID) { return E_INVALIDARG; } - const auto hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT); + // Set the default user as root, so ChangeDefaultUserInWslConf chan make the change + HRESULT hr = g_wslApi.WslConfigureDistribution(0, WSL_DISTRIBUTION_FLAGS_DEFAULT); if (FAILED(hr)) { return hr; } - DistributionInfo::ChangeDefaultUserInWslConf(userName); + hr = DistributionInfo::ChangeDefaultUserInWslConf(userName); + if (FAILED(hr)) + { + return hr; + } + + hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT); + if (FAILED(hr)) + { + return hr; + } return hr; } @@ -98,6 +110,7 @@ int RetrieveCurrentTheme() DWORD size = sizeof value; // ReSharper disable once CppTooWideScope + // ReSharper disable once CppTooWideScopeInitStatement const auto status = RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", @@ -109,7 +122,7 @@ int RetrieveCurrentTheme() if (status == ERROR_SUCCESS) { - return value; + return static_cast(value); } return -1; @@ -141,7 +154,8 @@ int RetrieveWindowsVersion(); fire_and_forget ShowPengwinUi() { // ReSharper disable once CppTooWideScope - const auto file = + // ReSharper disable once CppTooWideScopeInitStatement + const auto& file = co_await ApplicationData::Current().LocalFolder().TryGetItemAsync(L"MicrosoftStoreEngagementSDKId.txt"); if (! file) @@ -156,10 +170,10 @@ fire_and_forget ShowPengwinUi() } // ReSharper disable once IdentifierTypo -int wmain(int argc, const wchar_t* argv[]) +int wmain(const int argc, const wchar_t* argv[]) { // Update the title bar of the console window. - SetConsoleTitleW(DistributionInfo::WindowTitle.c_str()); + SetConsoleTitleW(DistributionInfo::WINDOW_TITLE.c_str()); // Initialize a vector of arguments. std::vector arguments; @@ -178,7 +192,7 @@ int wmain(int argc, const wchar_t* argv[]) Helpers::PromptForInput(); } - return exitCode; + return static_cast(exitCode); } // Install the distribution if it is not already. @@ -255,7 +269,7 @@ int wmain(int argc, const wchar_t* argv[]) else { Helpers::PrintMessage(MSG_USAGE); - return exitCode; + return static_cast(exitCode); } } From 6fd72ae6b81269f54fc3d1626bd01cb3bbedf749 Mon Sep 17 00:00:00 2001 From: Carlos Ramirez Date: Mon, 24 Jan 2022 00:33:56 +0100 Subject: [PATCH 2/5] Make Windows Terminal profile point to the actual executable instead of alias [PEN-213] --- .../Public/Fragments => ARM64}/pengwin.json | 2 +- Pengwin/Package.appxmanifest | 2 +- Pengwin/Pengwin.wapproj | 368 +++++++++--------- azure-pipelines.yml | 9 + x64/pengwin.json | 46 +++ 5 files changed, 245 insertions(+), 182 deletions(-) rename {Pengwin/Public/Fragments => ARM64}/pengwin.json (98%) create mode 100644 x64/pengwin.json diff --git a/Pengwin/Public/Fragments/pengwin.json b/ARM64/pengwin.json similarity index 98% rename from Pengwin/Public/Fragments/pengwin.json rename to ARM64/pengwin.json index 6a071a85..6dfc31f4 100644 --- a/Pengwin/Public/Fragments/pengwin.json +++ b/ARM64/pengwin.json @@ -4,7 +4,7 @@ "updates": "{7f586916-8357-53d4-bb2b-ca96f639898a}", "commandline": "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pengwin.exe", "icon": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\pengwin.png", - "name": "Pengwin", + "name": "Pengwinarm", "acrylicOpacity": 0.9, "backgroundImage": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\background1.png", "backgroundImageAlignment": "bottomRight", diff --git a/Pengwin/Package.appxmanifest b/Pengwin/Package.appxmanifest index 92ddbdc7..b754df94 100644 --- a/Pengwin/Package.appxmanifest +++ b/Pengwin/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="22.1.3.0" /> Pengwin diff --git a/Pengwin/Pengwin.wapproj b/Pengwin/Pengwin.wapproj index 1018525f..862bc119 100644 --- a/Pengwin/Pengwin.wapproj +++ b/Pengwin/Pengwin.wapproj @@ -1,183 +1,191 @@ + - - 15.0 - - - - Debug - x86 - - - Release - x86 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM - - - Release - ARM - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - AnyCPU - - - Release - AnyCPU - - - - $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ - - - - 4175daa1-10e2-45bf-88bd-6577af555b1b - 10.0.19041.0 - 10.0.17763.0 - en-US - True - ..\DistroLauncher\DistroLauncher.vcxproj - 1135ED70FE5432B6365A160D89058876A18C8C85 - False - SHA256 - False - True - x64|arm64 - 0 - http://timestamp.comodoca.com/%3f__hstc=116687193.ca0320fdf84fdaebb49c623303fc35cd.1574461157682.1575409935578.1578516608285.3&__hssc=116687193.1.1578516608285&__hsfp=100782785 - StoreAndSideload - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - install.tar.gz - - - - - true - install.tar.gz - - - + + 15.0 + + + + Debug + x86 + + + Release + x86 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + AnyCPU + + + Release + AnyCPU + + + + $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ + + + + 4175daa1-10e2-45bf-88bd-6577af555b1b + 10.0.19041.0 + 10.0.17763.0 + en-US + True + ..\DistroLauncher\DistroLauncher.vcxproj + 1135ED70FE5432B6365A160D89058876A18C8C85 + False + SHA256 + False + True + x64|arm64 + 0 + http://timestamp.comodoca.com/%3f__hstc=116687193.ca0320fdf84fdaebb49c623303fc35cd.1574461157682.1575409935578.1578516608285.3&__hssc=116687193.1.1578516608285&__hsfp=100782785 + StoreAndSideload + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + install.tar.gz + + + true + Public\Fragments\pengwin.json + + + + + true + install.tar.gz + + + true + Public\Fragments\pengwin.json + + + \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index af37eaba..528e2fae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,6 +43,15 @@ steps: name: signingCert inputs: secureFile: 'store.pfx' +- task: Bash@3 + inputs: + targetType: 'inline' + script: | + version=$(sed -n -E '/^ +Version=/s/^ +Version="([0-9\.]*)(.*)/\1/p' Pengwin/Package.appxmanifest) + sed -E -i "s/(^.*commandline.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_x64\4/" x64/pengwin.json + cp x64/pengwin.json ARM64/pengwin.json + sed -E -i "s/(^.*commandline.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_ARM64\4/" ARM64/pengwin.json + - task: VSBuild@1 inputs: solution: '$(solution)' diff --git a/x64/pengwin.json b/x64/pengwin.json new file mode 100644 index 00000000..d45c53fb --- /dev/null +++ b/x64/pengwin.json @@ -0,0 +1,46 @@ +{ + "profiles": [ + { + "updates": "{7f586916-8357-53d4-bb2b-ca96f639898a}", + "commandline": "%ProgramFiles%\\WindowsApps\\WhitewaterFoundryLtd.Co.16571368D6CFF_22.1.2.0_x64__kd1vv0z0vy70w\\DistroLauncher\\pengwin.exe", + "icon": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\pengwin.png", + "name": "Pengwin64", + "acrylicOpacity": 0.9, + "backgroundImage": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\background1.png", + "backgroundImageAlignment": "bottomRight", + "backgroundImageOpacity": 0.2, + "backgroundImageStretchMode": "none", + "bellStyle": "none", + "colorScheme": "Pengwin", + "cursorShape": "vintage", + "fontFace": "Cascadia Code", + "useAcrylic": true + } + ], + "schemes": [ + { + "name": "Pengwin", + + "background": "#16001A", + "black": "#0C0C0C", + "blue": "#003DE8", + "brightBlack": "#767676", + "brightBlue": "#3B78FF", + "brightCyan": "#61D6D6", + "brightGreen": "#16C60C", + "brightPurple": "#F500D8", + "brightRed": "#E74856", + "brightWhite": "#F2F2F2", + "brightYellow": "#F9F1A5", + "cursorColor": "#FFFFFF", + "cyan": "#3A96DD", + "foreground": "#E3E3E3", + "green": "#13A10E", + "purple": "#9B1AAD", + "red": "#E01123", + "selectionBackground": "#FFFFFF", + "white": "#CCCCCC", + "yellow": "#C19C00" + } + ] +} From 78ce1ce4adb7d2bd1d4a99cb5077abf0d54983d7 Mon Sep 17 00:00:00 2001 From: Carlos Ramirez Date: Mon, 24 Jan 2022 23:14:48 +0100 Subject: [PATCH 3/5] Use the icon and background from the package instead of the LocalStorage [PEN-213] --- ARM64/pengwin.json | 45 +-------------------------------------------- azure-pipelines.yml | 5 ++++- x64/pengwin.json | 4 ++-- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/ARM64/pengwin.json b/ARM64/pengwin.json index 6dfc31f4..131813f0 100644 --- a/ARM64/pengwin.json +++ b/ARM64/pengwin.json @@ -1,46 +1,3 @@ { - "profiles": [ - { - "updates": "{7f586916-8357-53d4-bb2b-ca96f639898a}", - "commandline": "%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pengwin.exe", - "icon": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\pengwin.png", - "name": "Pengwinarm", - "acrylicOpacity": 0.9, - "backgroundImage": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\background1.png", - "backgroundImageAlignment": "bottomRight", - "backgroundImageOpacity": 0.2, - "backgroundImageStretchMode": "none", - "bellStyle": "none", - "colorScheme": "Pengwin", - "cursorShape": "vintage", - "fontFace": "Cascadia Code", - "useAcrylic": true - } - ], - "schemes": [ - { - "name": "Pengwin", - - "background": "#16001A", - "black": "#0C0C0C", - "blue": "#003DE8", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#F500D8", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#E3E3E3", - "green": "#13A10E", - "purple": "#9B1AAD", - "red": "#E01123", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - } - ] + "copied from x64": 1 } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 528e2fae..1b9884a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -49,8 +49,11 @@ steps: script: | version=$(sed -n -E '/^ +Version=/s/^ +Version="([0-9\.]*)(.*)/\1/p' Pengwin/Package.appxmanifest) sed -E -i "s/(^.*commandline.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_x64\4/" x64/pengwin.json + sed -E -i "s/(^.*icon.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_x64\4/" x64/pengwin.json + sed -E -i "s/(^.*backgroundImage.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_x64\4/" x64/pengwin.json + cp x64/pengwin.json ARM64/pengwin.json - sed -E -i "s/(^.*commandline.*16571368D6CFF_)([0-9\.]+)(_x64)(_.*$)/\1${version}_ARM64\4/" ARM64/pengwin.json + sed -E -i "s/_x64_/_ARM64_/g" ARM64/pengwin.json - task: VSBuild@1 inputs: diff --git a/x64/pengwin.json b/x64/pengwin.json index d45c53fb..14ace26f 100644 --- a/x64/pengwin.json +++ b/x64/pengwin.json @@ -3,10 +3,10 @@ { "updates": "{7f586916-8357-53d4-bb2b-ca96f639898a}", "commandline": "%ProgramFiles%\\WindowsApps\\WhitewaterFoundryLtd.Co.16571368D6CFF_22.1.2.0_x64__kd1vv0z0vy70w\\DistroLauncher\\pengwin.exe", - "icon": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\pengwin.png", + "icon": "%ProgramFiles%\\WindowsApps\\WhitewaterFoundryLtd.Co.16571368D6CFF_22.1.2.0_x64__kd1vv0z0vy70w\\Assets\\pengwin.png", "name": "Pengwin64", "acrylicOpacity": 0.9, - "backgroundImage": "%LOCALAPPDATA%\\Packages\\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\\LocalState\\background1.png", + "backgroundImage": "%ProgramFiles%\\WindowsApps\\WhitewaterFoundryLtd.Co.16571368D6CFF_22.1.2.0_x64__kd1vv0z0vy70w\\Assets\\background1.png", "backgroundImageAlignment": "bottomRight", "backgroundImageOpacity": 0.2, "backgroundImageStretchMode": "none", From ac1efc2677e94d9061dae00cb0b2a65451bf12c7 Mon Sep 17 00:00:00 2001 From: Carlos Ramirez Date: Mon, 24 Jan 2022 23:15:06 +0100 Subject: [PATCH 4/5] Use the icon and background from the package instead of the LocalStorage [PEN-213] --- Pengwin/Package.appxmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pengwin/Package.appxmanifest b/Pengwin/Package.appxmanifest index b754df94..671279f2 100644 --- a/Pengwin/Package.appxmanifest +++ b/Pengwin/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="22.1.4.0" /> Pengwin From 943708095a5a9dccf037efcdbaa68ac0b9b52d28 Mon Sep 17 00:00:00 2001 From: Carlos Ramirez Date: Mon, 24 Jan 2022 23:59:26 +0100 Subject: [PATCH 5/5] Code cleanup and update release notes --- CHANGELOG.md | 9 ++++ Pengwin/Package.appxmanifest | 2 +- .../en-us/baseListing/releaseNotes.txt | 16 +++--- linux_files/setup | 53 +++++++++---------- switch2dev.sh | 17 ------ 5 files changed, 43 insertions(+), 54 deletions(-) delete mode 100644 switch2dev.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 54c8aaaa..3529b46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,13 @@ Existing users can update immediately by running $ pengwin-setup update + +22.1.5: +* Fix an error message shown at launch in WSL 1 about xdpyinfo when vcxsrv is installed. +* Switch Azure CLI installer to bullseye repos. +* Switch Powershell installer to bullseye repos. +* Improve the performance in the pengwin.exe config --default-user . +* Finally fixed the problem that Pengwin didn't launch in Windows Terminal on specific configurations. +* If you have Windows 11, Windows Terminal 1.12, and have Windows Terminal as your default console, now when you open Pengwin from the Start Menu, it will show the correct profile on Windows Terminal. + 22.1.0: * Show a better message in WSL2 when the Virtual Machine Platform Windows feature is not enabled * Keep the previous Debian repo for compatibility with packages expecting buster diff --git a/Pengwin/Package.appxmanifest b/Pengwin/Package.appxmanifest index 671279f2..a8878e93 100644 --- a/Pengwin/Package.appxmanifest +++ b/Pengwin/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="22.1.5.0" /> Pengwin diff --git a/appMetadata/en-us/baseListing/releaseNotes.txt b/appMetadata/en-us/baseListing/releaseNotes.txt index 37391d55..a56410a4 100644 --- a/appMetadata/en-us/baseListing/releaseNotes.txt +++ b/appMetadata/en-us/baseListing/releaseNotes.txt @@ -1,15 +1,16 @@ Existing users can update immediately by running $ pengwin-setup update +22.1.5: +* Fix an error message shown at launch in WSL 1 about xdpyinfo when vcxsrv is installed. +* Switch Azure CLI installer to bullseye repos. +* Switch Powershell installer to bullseye repos. +* Improve the performance in the pengwin.exe config --default-user . +* Finally fixed the problem that Pengwin didn't launch in Windows Terminal on specific configurations. +* If you have Windows 11, Windows Terminal 1.12, and have Windows Terminal as your default console, now when you open Pengwin from the Start Menu, it will show the correct profile on Windows Terminal. + 22.1.2: * Show a better message in WSL2 when the Virtual Machine Platform Windows feature is not enabled -* Keep the previous Debian repo for compatibility with packages expecting buster -* Skip some steps in 00-pengwin.fish for non-interactive sessions -* Add testing repo with a low priority -* Change which by command -v in the scripts, due to which is deprecated and slower -* Change command -v by command -q in fish scripts * Add an alias to the wsl command so that you can type wsl --version instead of wsl.exe --version inside Pengwin -* Remove the version restriction in iproute, due to the latest kernel support the ss -a command without issues in WSL2 -* Improve start menu shortcut generation (short the generated path) * dotnet package use the new repo for bullseye * Bump Python to 3.10.1 also updated all installation types * Fix gopath in go installer @@ -18,6 +19,5 @@ Existing users can update immediately by running $ pengwin-setup update * Install x11-utils as part of VcXsrv installation * Fix a bug that breaks XRDP upon SDKMan installation * Upgrade .NET installer to 6.0 -* Switch to the newer poetry install script * Make the SDKMan install the latest Java by default when using the Java installer in pengwin-setup * Upgrade VcXsrv to 1.20.14.0 diff --git a/linux_files/setup b/linux_files/setup index 1bd6d8d2..7934ad7e 100755 --- a/linux_files/setup +++ b/linux_files/setup @@ -1,37 +1,38 @@ #!/bin/bash function process_arguments() { - while [[ $# -gt 0 ]] - do - case "$1" in - --debug|-d|--verbose|-v) - echo "Running in debug/verbose mode" - set -x - shift + while [[ $# -gt 0 ]]; do + case "$1" in + --debug | -d | --verbose | -v) + echo "Running in debug/verbose mode" + set -x + shift ;; - --silent) - echo "Silent installation" - SILENT=1 - shift + --silent) + echo "Silent installation" + silent=1 + shift ;; - --install) - echo "Base image creation" - INSTALL=1 - shift + --install) + echo "Base image creation" + install=1 + shift ;; - *) - shift - esac - done + *) + shift + ;; + esac + done } +# bashsupport disable=BP2001 function install_repositories() { sudo apt-get -y -q update sudo apt-get -y -q install curl export os=debian - export dist=bullseye + export dist=11 curl -s https://packagecloud.io/install/repositories/whitewaterfoundry/pengwin-base$1/script.deb.sh | sudo -E bash curl -s https://packagecloud.io/install/repositories/whitewaterfoundry/pengwin-setup$1/script.deb.sh | sudo -E bash @@ -50,9 +51,8 @@ function install_packages() { # Update apt repositories sudo apt-get -y -q update - # Check for .dist-upgrade file in /etc/apt and inform user dist-upgrade available if so - if [[ -f "/etc/apt/.dist-upgrade" ]] ; then + if [[ -f "/etc/apt/.dist-upgrade" ]]; then sudo rm /etc/apt/.dist-upgrade sudo apt-get -y -q dist-upgrade fi @@ -61,7 +61,7 @@ function install_packages() { function remove_legacy_repo() { sudo sed -i -e 's|deb https://apt.patrickwu.space/ stable main|# deb https://apt.patrickwu.space/ stable main|g' /etc/apt/sources.list - + } function remove_legacy_regkeys() { @@ -90,18 +90,15 @@ function main() { install_repositories "${dev}" install_packages - if [[ ! ${INSTALL} ]]; then + if [[ ! ${install} ]]; then remove_legacy_regkeys fi fi - if [[ ! ${SILENT} ]]; then + if [[ ! ${silent} ]]; then invoke_setup fi } - main "$@" - -exit 0 diff --git a/switch2dev.sh b/switch2dev.sh deleted file mode 100644 index a6fe311f..00000000 --- a/switch2dev.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -if [[ "$1" == "release" ]]; then - export OLD='-dev' - export NEW='' -else - export OLD='' - export NEW='-dev' -fi - -curl -s "https://packagecloud.io/install/repositories/whitewaterfoundry/pengwin-base${NEW}/script.deb.sh" | sudo env os=debian dist=buster bash -curl -s "https://packagecloud.io/install/repositories/whitewaterfoundry/pengwin-setup${NEW}/script.deb.sh" | sudo env os=debian dist=buster bash - -sudo sed -i "s\$/pengwin-setup${OLD}/\$/pengwin-setup${NEW}/\$g" /etc/apt/sources.list.d/whitewaterfoundry.list -sudo sed -i "s\$/pengwin-base${OLD}/\$/pengwin-base${NEW}/\$g" /etc/apt/sources.list.d/whitewaterfoundry.list - -sudo rm /etc/apt/sources.list.d/whitewaterfoundry_pengwin-*