Skip to content

Sample/reference launcher app for WSL distro Microsoft Store packages.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
Original_LICENSE
Notifications You must be signed in to change notification settings

apple-ouyang/WSL-DistroLauncher

 
 

Repository files navigation

[toc]

Read this in other languages: English, 简体中文

How to run openEuler under WSL

  1. Configuring the Windows environment.
  2. Use the distro.exe I have built already.
  3. Or manually import openEuler into WSL.

Configuring the Windows environment

You can reference the Official doc,or follow the following instructions.

Open PoweShell, you can press Win+Q to search PoweShell.

Copy and paste those commands.

  1. Enable the Windows Subsystem for Linux.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. Enable Virtual Machine feature.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  1. Download the Linux kernel update package,Double-click to run, administrator privileges may be required.
  2. Set WSL 2 as your default version.
wsl --set-default-version 2
  1. Open Microsoft Store,and select your favorite Linux distribution, click get.

    The first time you launch a newly installed Linux distribution, a console window will open and you'll be asked to wait for a minute or two for files to de-compress and be stored on your PC. All future launches should take less than a second.

If you have any of these questions, you can refer to official website document .

Please note that if you have not upgraded Windows to 20H2, WSL will conflict with VMware when enabled, and only one of them can exist.

This will be fixed if you upgrade to 20H2.

Press win+R, type winver, enter, you can see your Windows verison.

image-20210421151135902

Use the distro.exe

Since the UWP has not been uploaded to the Microsoft Store, we can only use this package locally for the time being.

We plan to push the package to the Microsoft App Store in the future.

  1. Download appx.zip.
  2. Decompress it.
  3. Double-click on mydistro.exe to install openEuler.

When the pop-up command window is complete, the installation is complete, you can run openEuler:

  1. Start openEuler in the Windows Start Menu.

image-start_menu

  1. Or you can star it in cmd.
wsl -d openEuler

If something like the screenshot below appears, it starts successfully.

image-openEuler_in_wsl

Manually import openEuler

official documentation

  1. You need to get a root file system that contains all of openEuler's binaries.
    1. Export the container file system using Docker.
    2. Or use Debootstrap to create a root file system (not tried yet).
  2. Import the root file system using the WSL command.

Export the container file system using Docker

referenced document

  1. Download the Docker image of openEuler LTS SP1,Link.
  2. Open the console, go to the folder where you just downloaded the image. Start Ubuntu, and you will find your working directory is still in the same place.
cd D:\Download
wsl -d Ubuntu
  1. Install docker under Ubuntu.
curl -sSL https://get.daocloud.io/docker | sh
  1. Import the image. -i indicates that the tar package is used to import the image.
docker load -i .\openEuler-docker.x86_64.tar.xz
  1. List the current images.
docker images

You should have the following output:

REPOSITORY                 TAG       IMAGE ID       CREATED         SIZE
openEuler-20.03-lts-sp1    latest    6934cec25f28   3 months ago    512MB
  1. Run any command to load the container.
docker run openEuler-20.03-lts-sp1 echo hello, openEuler WSL
  1. Export a snapshot of the Docker container, which is the current file system.

docker ps -ql means to get the container number of the most recently run container, which is just the container number of openEuler.

docker export $(docker ps -ql) > ./openEuler.tar
exit

Import the root file system using the WSL command

Quit Ubuntu, use the WSL command in the console to import the openEuler package, meanwhile specify an openEuler installation directory.

For example, set D:\work\WSL\ openEuler as the WSL installation directory

wsl --import openEuler D:\work\WSL\openEuler .\openEuler.tar
  1. You can start openEuler.
wsl -d openEuler

The process of building a distro.exe

If you just want to run openEuler, you can stop here.

If you're interested in the build process, you can read on.

The general process of building MyDitro.exe

  1. Clone, modify launcher basic information.

  2. Install WSL, Ubuntu.

  3. Export the root file system.

Clone, modify the basic information

Clone the official launcher repository.

git clone https://github.com/Microsoft/WSL-DistroLauncher

Install Visual Studio, and choose to install the "Common Windows Platform Development tool".

Use Visual Studio to open the distrolauncher.sln under the wsl-distrolauncher project.

Double-click to open MyDistro.appxmanifest, and VS will automatically probe the XML format and display a nice screen like this.

image-20210412172319111

If you don't see the above screen but just a full-text interface. Please click the toggle button below, and then double-click on distrolauncher.sln.

image-20210421150031934

Click on the Packaging TAB, click Choose Certificate... , click the Create... Publish Name. I use Huawei, I wanted to use HUAWEI Technologies Co., Ltd, but it got an error, so I just used Huawei. Then enter the password to create the certificate.

Modify the basic information under the Application TAB and modify the Visual Asserts image information.

Asserts Generator can be used for generating images of different sizes.

The logo on the official website is too small, so I found the vector picture of the logo and AI file in the department. I enlarged it, and took Ubuntu startup icon as reference, cut out the text part, and only retained the logo, so as to make the generated logo look better in the startup interface.

All the resulting images can be seen in my project files.

Install Ubuntu under WSL

[Refer to the Configuring the Windows environment](# Configuring the Windows environment)

Export the root file system

[Refer to the manual import section](# 手动导入openEuler)

Change the last step to:

docker export $(docker ps -ql) > ./install.tar

Quit Ubuntu and compress the package.

exit
gzip.exe -k .\install.tar

-k means to keep the package, not delete it.

Build

Copy install.tar.gz to the root of your project.

Right-click "Solution (DistroLauncher)" in the VS Solution directory and click Deploy Solution.

Wait for the build to complete.

In the Solution Explorer on the right, you can see the following screen.

Solution

Right-click "Solution (DistroLauncher)" and click Deploy Solution from the pop-up menu

Wait for the compilation to complete, then the build is complete.

You can see the myditro.exe file in the folder.\x64\Debug\ DistroLauncher-appx \ Appx

Package the Appx folder to publish

About

Sample/reference launcher app for WSL distro Microsoft Store packages.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
Original_LICENSE

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 83.6%
  • Batchfile 13.0%
  • C 3.4%