├── .github ├── ISSUE_TEMPLATE │ ├── Bug_Report.yaml │ └── config.yml └── workflows │ └── stale-issues.yml ├── LICENSE ├── Makefile ├── README.md ├── bash_profile ├── solus.ico ├── wsl-distribution.conf ├── wsl.conf ├── wslg-init.service └── wslg-init.sh /.github/ISSUE_TEMPLATE/Bug_Report.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "SolusWSL2 - Bug Report" 3 | description: Report a bug on SolusWSL2 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Please [search for existing issues](https://github.com/sileshn/SolusWSL2/issues) before creating a new one. 9 | 10 | - type: checkboxes 11 | attributes: 12 | label: Requirements 13 | description: | 14 | Tell us whether you have checked and completed the [prerequisite](https://github.com/sileshn/SolusWSL2#requirements) 15 | options: 16 | - label: "Yes" 17 | - label: "No" 18 | 19 | - type: checkboxes 20 | attributes: 21 | label: WSL Version 22 | description: | 23 | Tell us whether you are running WSL 2 and/or WSL 1. You can tell your WSL version by running `wsl -l -v`. SolusWSL2 needs wsl2 to work. 24 | options: 25 | - label: "WSL 2" 26 | - label: "WSL 1" 27 | 28 | - type: input 29 | attributes: 30 | label: Version 31 | description: | 32 | Please run `cmd.exe /c ver` to get the build of Windows you are on. 33 | If you are running Windows Subsystem for Linux from the Microsoft Store, please run `wsl.exe --version` 34 | placeholder: "Microsoft Windows [Version 10.0.19042.867]" 35 | validations: 36 | required: true 37 | 38 | - type: input 39 | attributes: 40 | label: Kernel Version 41 | description: | 42 | Please tell us what version of the Linux kernel you are using, or if you are using a custom kernel. 43 | You can run `wsl.exe --status` if that command is available to you, or by running `cat /proc/version` in your distro. 44 | placeholder: "5.4.72" 45 | validations: 46 | required: false 47 | 48 | - type: textarea 49 | attributes: 50 | label: Repro Steps 51 | description: Please list out the steps to reproduce your bug. 52 | placeholder: Your steps go here. Include relevant environmental variables or any other configuration. 53 | validations: 54 | required: true 55 | 56 | - type: textarea 57 | attributes: 58 | label: Expected Behavior 59 | description: What were you expecting to see? Include any relevant examples or documentation links. 60 | placeholder: If you want to include screenshots, paste them into the text area or follow up with a separate comment. 61 | validations: 62 | required: true 63 | 64 | - type: textarea 65 | attributes: 66 | label: Actual Behavior 67 | description: What happened instead? 68 | placeholder: Include the terminal output, straces of the failing command, etc. as necessary. 69 | validations: 70 | required: true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/workflows/stale-issues.yml: -------------------------------------------------------------------------------- 1 | name: Close inactive issues 2 | on: 3 | schedule: 4 | - cron: "30 1 * * *" 5 | 6 | jobs: 7 | close-issues: 8 | runs-on: ubuntu-latest 9 | permissions: 10 | issues: write 11 | pull-requests: write 12 | steps: 13 | - uses: actions/stale@v4 14 | with: 15 | days-before-issue-stale: 7 16 | days-before-issue-close: 7 17 | stale-issue-label: "stale" 18 | stale-issue-message: "This issue is stale because it has been open for 7 days with no activity." 19 | close-issue-message: "This issue was closed because it has been inactive for 14 days with no activity." 20 | days-before-pr-stale: -1 21 | days-before-pr-close: -1 22 | repo-token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2019 yuk7, 2019-2021 Silesh K Nair 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | OUT_ZIP=SolusWSL2.zip 2 | LNCR_EXE=Solus.exe 3 | 4 | DLR=curl 5 | DLR_FLAGS=-L 6 | LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/`curl https://api.github.com/repos/yuk7/wsldl/releases/latest -s | jq .name -r`/icons.zip 7 | LNCR_ZIP_EXE=Solus.exe 8 | 9 | all: $(OUT_ZIP) 10 | 11 | zip: $(OUT_ZIP) 12 | $(OUT_ZIP): ziproot 13 | @echo -e '\e[1;31mBuilding $(OUT_ZIP)\e[m' 14 | cd ziproot; bsdtar -a -cf ../$(OUT_ZIP) * 15 | 16 | ziproot: Launcher.exe rootfs.tar.gz 17 | @echo -e '\e[1;31mBuilding ziproot...\e[m' 18 | mkdir ziproot 19 | cp Launcher.exe ziproot/${LNCR_EXE} 20 | cp rootfs.tar.gz ziproot/ 21 | 22 | exe: Launcher.exe 23 | Launcher.exe: icons.zip 24 | @echo -e '\e[1;31mExtracting Launcher.exe...\e[m' 25 | unzip icons.zip $(LNCR_ZIP_EXE) 26 | mv $(LNCR_ZIP_EXE) Launcher.exe 27 | 28 | icons.zip: 29 | @echo -e '\e[1;31mDownloading icons.zip...\e[m' 30 | $(DLR) $(DLR_FLAGS) $(LNCR_ZIP_URL) -o icons.zip 31 | 32 | rootfs.tar.gz: rootfs 33 | @echo -e '\e[1;31mBuilding rootfs.tar.gz...\e[m' 34 | cd rootfs; sudo tar -zcpf ../rootfs.tar.gz `sudo ls` 35 | sudo chown `id -un` rootfs.tar.gz 36 | 37 | rootfs: base.tar 38 | @echo -e '\e[1;31mBuilding rootfs...\e[m' 39 | mkdir rootfs 40 | sudo tar -xpf base.tar -C rootfs 41 | @echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." | sudo tee rootfs/etc/resolv.conf > /dev/null 42 | sudo cp wsl.conf rootfs/etc/wsl.conf 43 | sudo cp wsl-distribution.conf rootfs/etc/wsl-distribution.conf 44 | sudo cp solus.ico rootfs/usr/lib/wsl/solus.ico 45 | sudo cp bash_profile rootfs/root/.bash_profile 46 | sudo cp wslg-init.sh rootfs/usr/bin/wslg-init.sh 47 | sudo cp wslg-init.service rootfs/usr/lib/systemd/system/wslg-init.service 48 | sudo chmod +x rootfs 49 | 50 | base.tar: 51 | @echo -e '\e[1;31mExporting base.tar using docker...\e[m' 52 | docker run --net=host --name soluswsl silkeh/solus:ypkg /bin/bash -c "eopkg up -y; eopkg it -y apparmor bzip2 cmake dialog dos2unix efivar elfutils elfutils-devel libelf-devel iptables iproute2 keychain lolcat openssh rsync socat sqlite3 wget xdg-utils; eopkg dc; mkdir -p /usr/local/bin; git clone https://github.com/cmatsuoka/figlet.git; cd figlet; make && make install; cd && rm -rf /figlet; git clone https://github.com/acmel/dwarves.git; cd dwarves; mkdir build && cd build; cmake -DCMAKE_INSTALL_PREFIX=/usr -D__LIB=lib ..; make install; cd && rm -rf dwarves; git clone https://github.com/wslutilities/wslu; cd wslu; make; make install; cd && rm -rf wslu; touch /usr/share/defaults/etc/profile.d/custom.sh; echo 'export BROWSER=wslview' | tee -a /usr/share/defaults/etc/profile.d/custom.sh > /dev/null; touch /etc/environment; rm /usr/share/defaults/etc/profile.d/10-path.sh; mkdir -p /usr/lib/wsl; systemctl mask systemd-firstboot" 53 | docker export --output=base.tar soluswsl 54 | docker rm -f soluswsl 55 | 56 | clean: 57 | @echo -e '\e[1;31mCleaning files...\e[m' 58 | -rm ${OUT_ZIP} 59 | -rm -r ziproot 60 | -rm Launcher.exe 61 | -rm icons.zip 62 | -rm rootfs.tar.gz 63 | -sudo rm -r rootfs 64 | -rm base.tar 65 | -docker rmi silkeh/solus:ypkg -f 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SolusWSL2 2 | Solus on WSL2 (Windows 10 FCU or later) based on [wsldl](https://github.com/yuk7/wsldl) 3 | 4 | [![Screenshot-2023-08-04-032944.png](https://i.postimg.cc/28dP1Gx2/Screenshot-2023-08-04-032944.png)](https://postimg.cc/MvTs4yNQ) 5 | [![Github All Releases](https://img.shields.io/github/downloads/sileshn/SolusWSL2/total.svg?style=flat-square)](https://github.com/sileshn/SolusWSL2/releases) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 6 | [![License](https://img.shields.io/github/license/sileshn/SolusWSL2.svg?style=flat-square)](https://raw.githubusercontent.com/sileshn/SolusWSL2/main/LICENSE) 7 | 8 | ## Features and important information 9 | SolusWSL2 may display errors while installing packages. This is due to [usysconf](https://github.com/getsolus/packages/tree/main/packages/u/usysconf) running post installation triggers. It doesn't affect the normal functioning of SolusWSL2 afaik. 10 | 11 | You need a kernel with apparmor support for proper functioning of SolusWSL2. The standard wsl kernel doesn't include apparmor. You can find more information on how to compile and load a custom kernel [here](https://github.com/Fubuchi/SolusWSL-usysconf-fix?tab=readme-ov-file#compile-wsl2-kernel-with-apparmor-enable). 12 | 13 | SolusWSL2 has the following features during the installation stage. 14 | * Increase virtual disk size from the default 256GB 15 | * Create a new user and set the user as default 16 | * Supports systemd natively if you are running wsl v0.67.6 (more details [here](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/)) and above. You will need the [store version of wsl](https://apps.microsoft.com/store/detail/windows-subsystem-for-linux-preview/9P9TQF7MRM4R) for native systemd support. For previous versions of wsl, systemd is supported using diddledani's [one-script-wsl2-systemd](https://github.com/diddledani/one-script-wsl2-systemd). This is done automatically during initial setup. 17 | 18 | SolusWSL2 includes a wsl.conf file which only has [section headers](https://i.postimg.cc/MZ4DC1Fw/Screenshot-2022-02-02-071533.png). Users can use this file to configure the distro to their liking. You can read more about wsl.conf and its configuration settings [here](https://docs.microsoft.com/en-us/windows/wsl/wsl-config). 19 | 20 | ## Requirements 21 | * For x64 systems: Version 1903 or higher, with Build 18362 or higher. 22 | * For ARM64 systems: Version 2004 or higher, with Build 19041 or higher. 23 | * Builds lower than 18362 do not support WSL 2. 24 | * If you are running Windows 10 version 2004 or higher, you can install all components required to run wsl2 with a single command. This will install ubuntu by default. More details are available [here](https://devblogs.microsoft.com/commandline/install-wsl-with-a-single-command-now-available-in-windows-10-version-2004-and-higher/). 25 | ```cmd 26 | wsl.exe --install 27 | ``` 28 | * If you are running Windows 10 lower then version 2004, follow the steps below. For more details, check [this](https://docs.microsoft.com/en-us/windows/wsl/install-manual) microsoft document. 29 | * Enable Windows Subsystem for Linux feature. 30 | ```cmd 31 | dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart 32 | ``` 33 | * Enable Virtual Machine feature 34 | ```cmd 35 | dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart 36 | ``` 37 | * Download and install the latest Linux kernel update package from [here](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi). 38 | 39 | ## How to install 40 | * Make sure all the steps mentioned under "Requirements" are completed. 41 | * [Download](https://github.com/sileshn/SolusWSL2/releases/latest) installer zip 42 | * Extract all files in zip file to same directory 43 | * Set version 2 as default. Note that this step is required only for manual installation. 44 | ```dos 45 | wsl --set-default-version 2 46 | ``` 47 | * Run Solus.exe to extract rootfs and register to WSL 48 | 49 | **Note:** 50 | Exe filename is using the instance name to register. If you rename it you can register with a diffrent name and have multiple installs. 51 | 52 | ## How to setup 53 | Open Solus.exe and run the following commands. 54 | ```dos 55 | passwd 56 | sed -i 's#\# %wheel ALL=(ALL) ALL#%wheel ALL=(ALL) ALL#g' /etc/sudoers 57 | useradd -m -G wheel -s /bin/bash 58 | passwd 59 | exit 60 | ``` 61 | Execute the command below in a windows cmd terminal from the directory where Solus.exe is installed. 62 | ```dos 63 | >Solus.exe config --default-user 64 | ``` 65 | 66 | ## How to use installed instance 67 | #### exe Usage 68 | ``` 69 | Usage : 70 | 71 | - Open a new shell with your default settings. 72 | Inherit current directory (with exception that %%USERPROFILE%% is changed to $HOME). 73 | 74 | run 75 | - Run the given command line in that instance. Inherit current directory. 76 | 77 | runp 78 | - Run the given command line in that instance after converting its path. 79 | 80 | config [setting [value]] 81 | - `--default-user `: Set the default user of this instance to . 82 | - `--default-uid `: Set the default user uid of this instance to . 83 | - `--append-path `: Switch of Append Windows PATH to $PATH 84 | - `--mount-drive `: Switch of Mount drives 85 | - `--wsl-version <1|2>`: Set the WSL version of this instance to <1 or 2> 86 | - `--default-term `: Set default type of terminal window. 87 | 88 | get [setting [value]] 89 | - `--default-uid`: Get the default user uid in this instance. 90 | - `--append-path`: Get true/false status of Append Windows PATH to $PATH. 91 | - `--mount-drive`: Get true/false status of Mount drives. 92 | - `--wsl-version`: Get the version os the WSL (1/2) of this instance. 93 | - `--default-term`: Get Default Terminal type of this instance launcher. 94 | - `--wt-profile-name`: Get Profile Name from Windows Terminal 95 | - `--lxguid`: Get WSL GUID key for this instance. 96 | 97 | backup [file name] 98 | - `*.tar`: Output backup tar file. 99 | - `*.tar.gz`: Output backup tar.gz file. 100 | - `*.ext4.vhdx`: Output backup ext4.vhdx file. (WSL2 only) 101 | - `*.ext4.vhdx.gz`: Output backup ext4.vhdx.gz file. (WSL2 only) 102 | - `*.reg`: Output settings registry file. 103 | 104 | clean 105 | - Uninstall that instance. 106 | 107 | help 108 | - Print this usage message. 109 | ``` 110 | 111 | #### Just Run exe 112 | ```cmd 113 | >Solus.exe 114 | [root@PC-NAME user]# 115 | ``` 116 | 117 | #### Run with command line 118 | ```cmd 119 | >Solus.exe run uname -r 120 | 4.4.0-43-Microsoft 121 | ``` 122 | 123 | #### Run with command line with path translation 124 | ```cmd 125 | >Solus.exe runp echo C:\Windows\System32\cmd.exe 126 | /mnt/c/Windows/System32/cmd.exe 127 | ``` 128 | 129 | #### Change Default User(id command required) 130 | ```cmd 131 | >Solus.exe config --default-user user 132 | 133 | >Solus.exe 134 | [user@PC-NAME dir]$ 135 | ``` 136 | 137 | #### Set "Windows Terminal" as default terminal 138 | ```cmd 139 | >Solus.exe config --default-term wt 140 | ``` 141 | 142 | ## How to uninstall instance 143 | ```dos 144 | >Solus.exe clean 145 | 146 | ``` 147 | 148 | ## How to backup instance 149 | export to backup.tar.gz (WSL1 or 2) 150 | ```cmd 151 | >Solus.exe backup backup.tar.gz 152 | ``` 153 | export to backup.ext4.vhdx.gz (WSL2 only) 154 | ```cmd 155 | >Solus.exe backup backup.ext4.vhdx.gz 156 | ``` 157 | 158 | ## How to restore instance 159 | 160 | There are 2 ways to do it. 161 | 162 | Rename the backup to rootfs.tar.gz and run Solus.exe 163 | 164 | (or) 165 | 166 | .tar(.gz) 167 | ```cmd 168 | >Solus.exe install backup.tar.gz 169 | ``` 170 | .ext4.vhdx(.gz) 171 | ```cmd 172 | >Solus.exe install backup.ext4.vhdx.gz 173 | ``` 174 | 175 | You may need to run the command below in some circumstances. 176 | ```cmd 177 | >Solus.exe --default-uid 1000 178 | ``` 179 | 180 | ## How to build 181 | #### Prerequisites 182 | 183 | Docker, tar, zip, unzip need to be installed. 184 | 185 | If you want to build using solus unstable profile, checkout the unstable branch. 186 | ```dos 187 | git clone git@gitlab.com:sileshn/SolusWSL2.git 188 | cd SolusWSL2 189 | make 190 | 191 | ``` 192 | Copy the Solus-main.zip file to a safe location and run the command below to clean. 193 | ```dos 194 | make clean 195 | 196 | ``` 197 | 198 | ## How to install & run docker in SolusWSL2 without using docker desktop 199 | Install docker binaries. Note that installing docker from solus repos doesn't work as the latest version in solus is 19.03.14. We need 20.10 versions and above. 200 | ```dos 201 | sudo eopkg it -y wget 202 | wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.6.tgz 203 | tar xzvf docker-20.10.6.tgz 204 | sudo cp docker/* /usr/bin/ 205 | 206 | ``` 207 | You can now delete the downloaded files if needed. 208 | ```dos 209 | rm -rf docker 210 | rm docker-20.10.6.tgz 211 | 212 | ``` 213 | 214 | To manage docker as a non-root user, create and add user to docker group. 215 | ```dos 216 | sudo groupadd docker 217 | sudo usermod -aG docker $USER 218 | 219 | ``` 220 | 221 | Follow [this](https://blog.nillsf.com/index.php/2020/06/29/how-to-automatically-start-the-docker-daemon-on-wsl2/) blog post for further setup instructions. 222 | 223 | [![Screenshot-2021-02-18-120518.png](https://i.postimg.cc/7YqVpBqP/Screenshot-2021-02-18-120518.png)](https://postimg.cc/V5HntWS2) 224 | -------------------------------------------------------------------------------- /bash_profile: -------------------------------------------------------------------------------- 1 | # First run script for SolusWSL2 2 | 3 | blu=$(tput setaf 4) 4 | cyn=$(tput setaf 6) 5 | grn=$(tput setaf 2) 6 | mgn=$(tput setaf 5) 7 | red=$(tput setaf 1) 8 | ylw=$(tput setaf 3) 9 | txtrst=$(tput sgr0) 10 | 11 | test -e /mnt/c/Users/Public/shutdown.cmd && rm /mnt/c/Users/Public/shutdown.cmd 12 | test -e ~/shutdown.cmd && rm ~/shutdown.cmd 13 | figlet -t -k -f /usr/local/share/figlet/mini.flf "Welcome to SolusWSL2" | lolcat 14 | echo -e "\033[33;7mDo not interrupt or close the terminal window till script finishes execution!!!\n\033[0m" 15 | 16 | getent passwd live >/dev/null && (userdel live && rm -rf /home/live) 17 | [ -f /etc/default/useradd ] && (sudo sed -i 's/GROUP=1000/GROUP=users/g' && sudo sed -i 's/CREATE_MAIL_SPOOL=yes/CREATE_MAIL_SPOOL=no/g' /etc/default/useradd) 18 | sudo setcap cap_net_raw+ep /usr/bin/ping 19 | sudo systemctl daemon-reload 20 | sudo systemctl enable wslg-init.service >/dev/null 2>&1 21 | 22 | echo -e ${grn}"Create root password"${txtrst} 23 | passwd 24 | echo " " 25 | echo -e ${grn}"Do you want to create a new user?"${txtrst} 26 | select yn in "Yes" "No"; do 27 | case $yn in 28 | Yes) 29 | echo " " 30 | while read -p "Please enter the username you wish to create : " username; do 31 | if [ "x$username" = "x" ]; then 32 | echo -e ${red}" Blank username entered. Try again!!!"${txtrst} 33 | echo -en "\033[1A\033[1A\033[2K" 34 | username="" 35 | elif grep -q "$username" /etc/passwd; then 36 | echo -e ${red}"Username already exists. Try again!!!"${txtrst} 37 | echo -en "\033[1A\033[1A\033[2K" 38 | username="" 39 | else 40 | useradd -m -G sudo,wheel -s /bin/bash "$username" 41 | echo "%wheel ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/wheel 42 | echo -en "\033[1B\033[1A\033[2K" 43 | passwd $username 44 | sed -i "/\[user\]/a default = $username" /etc/wsl.conf >/dev/null 45 | echo "@echo off" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 46 | echo "wsl.exe --terminate $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 47 | if env | grep "WT_SESSION" >/dev/null 2>&1; then 48 | echo "wt.exe -w 0 nt wsl.exe -d $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 49 | else 50 | echo "cmd /c start \"$WSL_DISTRO_NAME\" wsl.exe --cd ~ -d $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 51 | fi 52 | echo "del C:\Users\Public\shutdown.cmd" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 53 | cp ~/shutdown.cmd /mnt/c/Users/Public && rm ~/shutdown.cmd 54 | 55 | secs=3 56 | printf ${ylw}"\nTo set the new user as the default user, SolusWSL2 will shutdown and restart!!!\n\n"${txtrst} 57 | while [ $secs -gt 0 ]; do 58 | printf "\r\033[KShutting down in %.d seconds. " $((secs--)) 59 | sleep 1 60 | done 61 | 62 | rm ~/.bash_profile 63 | /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -command "Start-Process -Verb Open -FilePath 'shutdown.cmd' -WorkingDirectory 'C:\Users\Public' -WindowStyle Hidden" 64 | exec sleep 0 65 | fi 66 | done 67 | ;; 68 | No) 69 | break 70 | ;; 71 | esac 72 | done 73 | 74 | echo "@echo off" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 75 | echo "wsl.exe --terminate $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 76 | if env | grep "WT_SESSION" >/dev/null 2>&1; then 77 | echo "wt.exe -w 0 nt wsl.exe -d $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 78 | else 79 | echo "cmd /c start \"$WSL_DISTRO_NAME\" wsl.exe --cd ~ -d $WSL_DISTRO_NAME" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 80 | fi 81 | echo "del C:\Users\Public\shutdown.cmd" | sudo tee -a ~/shutdown.cmd >/dev/null 2>&1 82 | cp ~/shutdown.cmd /mnt/c/Users/Public && rm ~/shutdown.cmd 83 | 84 | secs=3 85 | printf ${ylw}"\nSolusWSL2 will shutdown and restart to finish setup!!!\n\n"${txtrst} 86 | while [ $secs -gt 0 ]; do 87 | printf "\r\033[KShutting down in %.d seconds. " $((secs--)) 88 | sleep 1 89 | done 90 | 91 | rm ~/.bash_profile 92 | powershell.exe -command "Start-Process -Verb Open -FilePath 'shutdown.cmd' -WorkingDirectory 'C:\Users\Public' -WindowStyle Hidden" 93 | exec sleep 0 94 | -------------------------------------------------------------------------------- /solus.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sileshn/SolusWSL2/bc809221e5ba9a36c27138c8dca5dbd798c503dc/solus.ico -------------------------------------------------------------------------------- /wsl-distribution.conf: -------------------------------------------------------------------------------- 1 | [shortcut] 2 | icon = /usr/lib/wsl/solus.ico 3 | -------------------------------------------------------------------------------- /wsl.conf: -------------------------------------------------------------------------------- 1 | [automount] 2 | 3 | [network] 4 | 5 | [interop] 6 | 7 | [user] 8 | 9 | #The Boot setting is only available on Windows 11 10 | [boot] 11 | systemd=true 12 | -------------------------------------------------------------------------------- /wslg-init.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Check and recreat wslg symlink 3 | 4 | [Service] 5 | ExecStart=/usr/bin/wslg-init.sh 6 | 7 | [Install] 8 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /wslg-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | timeout 10 bash <<"EOF" 3 | while [[ -L /tmp/.X11-unix ]] 4 | do 5 | sleep 1 6 | done 7 | EOF 8 | 9 | if [[ -d /tmp/.X11-unix ]] && [[ ! -L /tmp/.X11-unix ]]; then 10 | rm -r /tmp/.X11-unix 11 | ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix 12 | fi --------------------------------------------------------------------------------