├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── addWSLfeature.ps1 ├── install.ps1 └── profile /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | language: bash 3 | addons: 4 | apt: 5 | packages: 6 | - make 7 | - curl 8 | - zip 9 | - unzip 10 | - bsdtar 11 | - check 12 | - texlive-full 13 | before_script: 14 | - sudo apt-get update -qq 15 | - sudo apt-get install make curl zip unzip bsdtar check texlive-full -qq 16 | script: 17 | - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then echo $TRAVIS_PULL_REQUEST_BRANCH; 18 | else echo $TRAVIS_BRANCH; fi) 19 | - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" 20 | - make 21 | notifications: 22 | email: false 23 | deploy: 24 | provider: releases 25 | api_key: 26 | secure: rqMJg/Ss029rKG727wDeHgoyevdex1W5uFNrMZIb6Tk6Iq48RWW09+UzJ6he1zcKZovs3Bnw82NodXIl0oUi00wSJOvbTA4ukzZzAVCEwGs7RgVG0V0/QNrye3HAhN3LLZsEtxsxVguXHITL/cnOxzNxIL26+aPglf4pZNnaF6MsfLcNJAAllj2jk9dD5uSzAn2zs5l9YwBubob5IpcxobUe1XU2O2pY88411ZpdNckk87rkHmb/yDhGi0UGB7OzJtEKivUL5A7uEVdi0678++LNWNVF/zyzYzVe18XTEdJgJxIqXmfN8/P+W51/BEWNuhhnvY/EEjNcrDEbK2lXh8MS1Ep42MgWcB0QvbkOo0V0TF3hPqHpNRWMIwI4eYKZYgCAbu2gUEuB9BpYOtyhUBlR45TyR8bwFWBzYgq8I8liaO+g0nfY0GzUYZUvZBFsy1rx0GdfvjWyHc0Ll347Ea1oJBYHe9e87EUrDwjczEJOxVqq588/M/XI25JUmLWQd5X987VhtV8iiW+5dl95Z2HnJn7cCzksrru8EVZVsVyYur851Xzl7MAVp09zvCiHYmbRWf20/ZqSfb4yZUEdr+PHOxamJEGf1ZbNDeRjpr9wU01FfNfiPtkHaw7zv9Lnc/7/lq/fwY7ZYbUy4bFCRSV5xxon3LgPF880gk7um98= 27 | file: Alpine.zip 28 | on: 29 | repo: binarylandscapes/AlpineWSL 30 | tags: true 31 | all_branches: true 32 | skip_cleanup: true 33 | env: 34 | global: 35 | secure: Pq7Td/zt7EPeUN5opm2BSY072/CSm6q2XfRyk7h5+vFPNdrzr/XbdrLqcCyRskfcqhvlKXYF8Fpd93nDEP8kyNC4MpXR+Ex0EYclxjgUZoz1p+UKz9RcrLbKNzzg+du18l4YBt3V8F6CdfBUwljQDN24cURFD0CSZvzXJ07Daaq277vA20NZBDOyvhDDY2wbaWLSpTWnNMFsM/bYqW3jAM6JRA/JwNQw9DJlM6ClYzAZXBbL52ltBsyi/yRQYgkYTubBkqkIlKOGWuM+KWHd4OICEyRiJSfHN0pKj/74ekuetT3kkqc5WERfDLpB31CA3v6bcuynEEl0gGDs5HXkxNJw6Wv2s+KRRLo8IGw/W/Ik7atOEoWt3YFYjdv9UxuewjnGKvdSeknaC+P4Wpi9CikC8lWBTKKQrhhFgISrxjgvoVJ14tEHH9UABJwxcA7oUMM3HP+D43tsCOiWY2NKf18nxwTsbqXB0Ol1edBBX9zBXCqGEjSztJQs4EtnVGizGbUO/F/4x0yCrhN/xIdUQDQoqNtC2FpIKNZnKFq/lauvS3cOuraOWpVjbeB6rJotDHyXLYLbkBEaRrn09FlB07owwNwYMmv/MFQhj27AHN7rVED9DF5V6jub2iIEFptwGXGsma1EHwIKA6XKxIXcJC1I0/7JWplSF+Yg3ncWH60= 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2020 binarylandscapes 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=Alpine.zip 2 | LNCR_EXE=Alpine.exe 3 | 4 | DLR=curl 5 | DLR_FLAGS=-L 6 | BASE_URL=http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-minirootfs-3.12.0-x86_64.tar.gz 7 | LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/20040300/icons.zip 8 | LNCR_ZIP_EXE=Alpine.exe 9 | 10 | PLANTUML_URL=http://sourceforge.net/projects/plantuml/files/plantuml.jar/download 11 | ACROTEX_URL=http://mirrors.ctan.org/macros/latex/contrib/acrotex.zip 12 | INSTALL_PS_SCRIPT=https://raw.githubusercontent.com/binarylandscapes/AlpineWSL/$(BRANCH)/install.ps1 13 | FEATURE_PS_SCRIPT=https://raw.githubusercontent.com/binarylandscapes/AlpineWSL/$(BRANCH)/addWSLfeature.ps1 14 | 15 | all: $(OUT_ZIP) 16 | 17 | zip: $(OUT_ZIP) 18 | $(OUT_ZIP): ziproot 19 | @echo -e '\e[1;31mBuilding $(OUT_ZIP)\e[m' 20 | cd ziproot; bsdtar -a -cf ../$(OUT_ZIP) * 21 | 22 | ziproot: Launcher.exe rootfs.tar.gz ps_scripts 23 | @echo -e '\e[1;31mBuilding ziproot...\e[m' 24 | mkdir ziproot 25 | cp Launcher.exe ziproot/${LNCR_EXE} 26 | cp rootfs.tar.gz ziproot/ 27 | cp install.ps1 ziproot/ 28 | cp addWSLfeature.ps1 ziproot/ 29 | 30 | ps_scripts: 31 | $(DLR) $(DLR_FLAGS) $(INSTALL_PS_SCRIPT) -o install.ps1 32 | $(DLR) $(DLR_FLAGS) $(FEATURE_PS_SCRIPT) -o addWSLfeature.ps1 33 | 34 | exe: Launcher.exe 35 | Launcher.exe: icons.zip 36 | @echo -e '\e[1;31mExtracting Launcher.exe...\e[m' 37 | bsdtar -xvf icons.zip $(LNCR_ZIP_EXE) 38 | mv $(LNCR_ZIP_EXE) Launcher.exe 39 | 40 | icons.zip: 41 | @echo -e '\e[1;31mDownloading icons.zip...\e[m' 42 | $(DLR) $(DLR_FLAGS) $(LNCR_ZIP_URL) -o icons.zip 43 | 44 | rootfs.tar.gz: rootfs 45 | @echo -e '\e[1;31mBuilding rootfs.tar.gz...\e[m' 46 | cd rootfs; sudo tar -zcpf ../rootfs.tar.gz `sudo ls` 47 | sudo chown `id -un` rootfs.tar.gz 48 | 49 | rootfs: base.tar.gz profile 50 | @echo -e '\e[1;31mBuilding rootfs...\e[m' 51 | mkdir rootfs 52 | sudo tar -zxpf base.tar.gz -C rootfs 53 | sudo cp -f /etc/resolv.conf rootfs/etc/resolv.conf 54 | sudo cp -f profile rootfs/etc/profile 55 | sudo chroot rootfs /sbin/apk update 56 | sudo chroot rootfs /sbin/apk add \ 57 | bash \ 58 | bash-completion \ 59 | alpine-sdk \ 60 | coreutils \ 61 | wget \ 62 | curl \ 63 | zip \ 64 | unzip \ 65 | git-lfs \ 66 | subversion \ 67 | cdrkit \ 68 | neofetch \ 69 | openssh \ 70 | nano 71 | sudo chroot rootfs /sbin/apk add \ 72 | gcc \ 73 | ghc \ 74 | gmp \ 75 | libffi \ 76 | musl-dev \ 77 | sed \ 78 | linux-headers \ 79 | zlib-dev \ 80 | jpeg-dev 81 | sudo chroot rootfs /sbin/apk add \ 82 | python3 \ 83 | py3-pip \ 84 | python3-dev \ 85 | cython \ 86 | py3-numpy \ 87 | py3-numpy-dev \ 88 | graphviz \ 89 | openjdk8 \ 90 | ghostscript \ 91 | ttf-dejavu 92 | sudo chroot rootfs /sbin/apk add \ 93 | texlive-full > /dev/null 94 | sudo chroot rootfs /sbin/apk add \ 95 | openssl \ 96 | icu \ 97 | krb5 \ 98 | zlib \ 99 | libsecret \ 100 | gnome-keyring \ 101 | desktop-file-utils \ 102 | xprop \ 103 | xvfb 104 | sudo chroot rootfs \ 105 | /usr/bin/$(DLR) $(DLR_FLAGS) $(PLANTUML_URL) \ 106 | -o /usr/local/plantuml.jar 107 | sudo -H chroot rootfs /usr/bin/python3 -m pip install --upgrade \ 108 | pip \ 109 | wheel 110 | sudo -H chroot rootfs /usr/bin/python3 -m pip install --upgrade \ 111 | sphinx \ 112 | sphinx-autobuild \ 113 | sphinx-jinja \ 114 | netaddr \ 115 | gitpython \ 116 | seqdiag \ 117 | sphinxcontrib-seqdiag \ 118 | nwdiag \ 119 | sphinxcontrib-nwdiag \ 120 | blockdiag \ 121 | sphinxcontrib-blockdiag \ 122 | actdiag \ 123 | sphinxcontrib-actdiag \ 124 | sphinx-git \ 125 | sphinx_rtd_theme \ 126 | plantuml \ 127 | sphinxcontrib-plantuml \ 128 | reportlab \ 129 | colorama \ 130 | xlsxwriter \ 131 | pandas==1.0.4 \ 132 | vscod 133 | sudo -H chroot rootfs /usr/bin/python3 -m pip install --upgrade \ 134 | tablib \ 135 | ciscoconfparse \ 136 | nety \ 137 | sphinxcontrib-jupyter \ 138 | sphinxcontrib_ansibleautodoc \ 139 | sphinxcontrib-confluencebuilder \ 140 | pyyaml \ 141 | yamlreader \ 142 | sphinxcontrib-drawio \ 143 | sphinxcontrib-drawio-html 144 | sudo -H chroot rootfs /usr/bin/python3 -m pip install --upgrade \ 145 | sphinx-markdown-builder \ 146 | sphinxcontrib-fulltoc 147 | sudo chroot rootfs \ 148 | /usr/bin/$(DLR) $(DLR_FLAGS) $(ACROTEX_URL) \ 149 | -o /tmp/acrotex.zip 150 | sudo chroot rootfs /usr/bin/unzip \ 151 | /tmp/acrotex.zip -d /usr/share/texmf-dist/tex/latex/ 152 | sudo chroot rootfs /usr/bin/mktexlsr 153 | sudo chroot rootfs /bin/rm -f \ 154 | /tmp/acrotex.zip 155 | sudo chroot rootfs /bin/ln -s \ 156 | /usr/share/fonts/ttf-dejavu \ 157 | /usr/share/fonts/dejavu 158 | sudo chroot rootfs /sbin/apk add \ 159 | ruby \ 160 | ruby-dev 161 | sudo -H chroot rootfs /usr/bin/gem install \ 162 | travis --no-document 163 | echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." | sudo tee rootfs/etc/resolv.conf 164 | sudo rm -rf `sudo find rootfs/var/cache/apk/ -type f` 165 | sudo chmod +x rootfs 166 | 167 | base.tar.gz: 168 | @echo -e '\e[1;31mDownloading base.tar.gz...\e[m' 169 | $(DLR) $(DLR_FLAGS) $(BASE_URL) -o base.tar.gz 170 | 171 | clean: 172 | @echo -e '\e[1;31mCleaning files...\e[m' 173 | -rm ${OUT_ZIP} 174 | -rm -r ziproot 175 | -rm Launcher.exe 176 | -rm icons.zip 177 | -rm rootfs.tar.gz 178 | -sudo rm -r rootfs 179 | -rm base.tar.gz 180 | -rm install.ps1 181 | -rm addWSLfeature.ps1 182 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AlpineWSL 2 | 3 | Alpine Linux on WSL (Windows 10 1903 or later) 4 | based on [wsldl](https://github.com/yuk7/wsldl) 5 | but adds the following capabilities: 6 | 7 | * Git-LFS (Allows for files over 4GB that Windows OS has limited) 8 | * Sphinx and multiple supporting packages like PlantUML and Graphwiz and Latex support 9 | * MKISOFS Capability 10 | 11 | ![screenshot](https://raw.githubusercontent.com/wiki/yuk7/wsldl/img/Arch_Alpine_Cent.png) 12 | 13 | [![Build Status](https://img.shields.io/travis/binarylandscapes/AlpineWSL.svg?style=flat-square)](https://travis-ci.org/binarylandscapes/AlpineWSL) 14 | [![Github All Releases](https://img.shields.io/github/downloads/binarylandscapes/AlpineWSL/total.svg?style=flat-square)](https://github.com/binarylandscapes/AlpineWSL/releases/latest) 15 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 16 | ![License](https://img.shields.io/github/license/binarylandscapes/AlpineWSL.svg?style=flat-square) 17 | 18 | ## [Download](https://github.com/binarylandscapes/AlpineWSL/releases/latest) 19 | 20 | ## Requirements 21 | 22 | * Windows 10 1903 April 2018 Update x64 or later. 23 | * Windows Subsystem for Linux feature is enabled. 24 | * Windows Terminal installed from (https://aka.ms/windowsterminal) 25 | 26 | --- 27 | **IMPORTANT** 28 | 29 | Be aware that if installing any WSL instance on Windows 10 1803+, your system automatically is configured with NTFS "Case Sensitive" enabled for any folder created by the WSL instance. This may have issues with Windows usage of files in those folders. 30 | 31 | [Per-directory case sensitivity and WSL](https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/) 32 | 33 | [Improved per-directory case sensitivity support in WSL](https://devblogs.microsoft.com/commandline/improved-per-directory-case-sensitivity-support-in-wsl/) 34 | 35 | If you are currently on Windows 10 2004 for the Insiders Program and planning to use WSL 2 and get the following error message "HRESULT:0x800701bc", then you will need to update your WSL Linux Kernel per (https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel) 36 | 37 | --- 38 | 39 | ## References 40 | 41 | * [Microsoft WSL Documentation](https://docs.microsoft.com/en-us/windows/wsl/about) 42 | 43 | ## Install 44 | 45 | ### 1. [Download](https://github.com/binarylandscapes/AlpineWSL/releases/latest) Alpine.zip 46 | 47 | ### 2. Extract zip file to a new Alpine directory containing all files (Recommend C:\TEMP or Downloads folder) 48 | 49 | ### 3. Run ```addWSLfeature.ps1``` as an Administrator to add Windows Subsystem for Linux feature and reboot, if not already done 50 | 51 | ### 4. Run ```install.ps1``` as the desired user (this is not an all users installation) to 52 | 53 | * Checks for and prompts to remove previous AlpineWSL distro (if distro location matches script parameters) 54 | * Copies files from zip to ```C:\Users\\.wsl\\``` for install location 55 | * Installs, silently 56 | * Completes system\user configuration for Git, Git-LFS and Sphinx. **Will prompt for password of distro user, this is also your sudo password** 57 | * Creates a desktop shortcut 58 | * Performs cleanup 59 | 60 | Note - Exe filename is using to the instance name to register. If you rename it, you can register with a different name and have multiple installs. 61 | 62 | ```cmd 63 | `install.ps1 [parameter ]` 64 | 65 | Parameters: 66 | - `--distroName `: Sets the name of exe file, this must match the filename of the actual exe 67 | - `--user <$env:UserName.ToLower()>`: Sets the username for this distro and Git to your Windows user name that opened Powershell 68 | - `--email `: Sets the email for Git config. This is forced prompted to enter during script 69 | ``` 70 | 71 | ## How-to-Use (for Installed Instance) 72 | 73 | ### exe Usage (Based off wsldl) 74 | 75 | ```cmd 76 | Usage: 77 | 78 | 79 | - Open a new shell with your default settings. 80 | 81 | run 82 | - Run the given command line in that distro. Inherit current directory. 83 | 84 | runp 85 | - Run the path translated command line in that distro. 86 | 87 | config [setting [value]] 88 | - `--default-user `: Set the default user for this distro to 89 | - `--default-uid `: Set the default user uid for this distro to 90 | - `--append-path `: Switch of Append Windows PATH to $PATH 91 | - `--mount-drive `: Switch of Mount drives 92 | - `--default-term `: Set default terminal window 93 | 94 | get [setting] 95 | - `--default-uid`: Get the default user uid in this distro 96 | - `--append-path`: Get on/off status of Append Windows PATH to $PATH 97 | - `--mount-drive`: Get on/off status of Mount drives 98 | - `--wsl-version`: Get WSL Version 1/2 for this distro 99 | - `--default-term`: Get Default Terminal for this distro launcher 100 | - `--lxguid`: Get WSL GUID key for this distro 101 | 102 | backup [contents] 103 | - `--tgz`: Output backup.tar.gz to the current directory using tar command 104 | - `--reg`: Output settings registry file to the current directory 105 | 106 | clean 107 | - Uninstall the distro. 108 | 109 | help 110 | - Print this usage message. 111 | ``` 112 | 113 | #### Set "Windows Terminal" as default terminal 114 | 115 | ```cmd 116 | .exe config --default-term wt 117 | ``` 118 | 119 | ### How to uninstall instance 120 | 121 | ```cmd 122 | .exe clean 123 | 124 | ``` 125 | 126 | ### Helpful tips 127 | 128 | * The commands `bash` or `wsl` will open your default distro of WSL as well 129 | 130 | * If you forgot your password, `wsl --distribution --user root` will open the distro as root. So you can use passwd to reset. Then close all terminals and reopen Alpine normally under your user account with new password. 131 | 132 | * If you need to virtually "reboot" the WSL distro or distros, as an Administrator open Services and restart the running LxssManager service. 133 | 134 | 135 | ### WSL Command Line Reference 136 | 137 | See [Microsoft WSL Reference Documentation](https://docs.microsoft.com/en-us/windows/wsl/reference) 138 | 139 | ```cmd 140 | Usage: wsl.exe [Argument] [Options...] [CommandLine] 141 | ``` 142 | 143 | #### Arguments to run Linux binaries 144 | 145 | If no command line is provided, wsl.exe launches the default shell. 146 | 147 | `--exec, -e `: Execute the specified command without using the default Linux shell. 148 | 149 | `-- `: Pass the remaining command line as is. 150 | 151 | Options: 152 | 153 | `--distribution, -d `: Run the specified distribution. 154 | 155 | `--user, -u `: Run as the specified user. 156 | 157 | #### Arguments to manage Windows Subsystem for Linux 158 | 159 | `--export `: Exports the distribution to a tar file. 160 | The filename can be - for standard output. 161 | 162 | `--import `: Imports the specified tar file as a new distribution. 163 | The filename can be - for standard input. 164 | 165 | `--list, -l [Options]`: Lists distributions. 166 | 167 | Options: 168 | 169 | `--all`: List all distributions, including distributions that are currently 170 | being installed or uninstalled. 171 | 172 | `--running`: List only distributions that are currently running. 173 | 174 | `--verbose`: Lists which version of WSL for distributions. 175 | 176 | `--set-default, -s `: Sets the distribution as the default. 177 | 178 | `--set-default-version `: Sets the default WSL version for newly created distributions. 179 | 180 | `--set-version `: Sets the WSL version for distribution. 181 | 182 | `--terminate, -t `: Terminates the distribution. 183 | 184 | `--unregister `: Unregisters the distribution. 185 | 186 | `--upgrade `: Upgrades the distribution to the WslFs file system format. 187 | 188 | `--help`: Display usage information. 189 | 190 | ## How-to-Build 191 | 192 | AlpineWSL can build on GNU/Linux or WSL. 193 | 194 | `curl`, `bsdtar`, `tar`(gnu) and `sudo` is required for build. 195 | 196 | ```shell 197 | $ make 198 | ``` 199 | -------------------------------------------------------------------------------- /addWSLfeature.ps1: -------------------------------------------------------------------------------- 1 | Start-Transcript -path C:\TEMP\addWSLfeature.log -append 2 | $wslState = Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 3 | if ($wslState.State -eq "Disabled") { 4 | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 5 | Write-Host -ForegroundColor Yellow ("`nWindows Subsystem for Linux (WSL) is enabled, system will now restart") 6 | } 7 | Write-Host -ForegroundColor Green ("`nWindows Subsystem for Linux (WSL) is enabled") 8 | Stop-Transcript 9 | -------------------------------------------------------------------------------- /install.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [parameter(Mandatory=$false)][string]$user = $env:UserName.ToLower(), 3 | [parameter(Mandatory=$true)][string]$email = "username@domain.com" 4 | ) 5 | 6 | Start-Transcript -path C:\TEMP\install-wsl.log -append 7 | 8 | # Set distro name 9 | $wslDistro = (Get-ChildItem -Path .\Alpine*.exe).Name 10 | $distroName = $wslDistro.Split('.')[0] 11 | $wslPath = "C:\Users\$user\.wsl\$distroName" 12 | $TargetFile = "$wslPath\$wslDistro" 13 | $ShortcutFile = "C:\Users\$user\Desktop\$distroName WSL.lnk" 14 | 15 | # Uninstall previous WSL distro if present 16 | If (Test-Path $wslPath) { 17 | Write-Host -ForegroundColor Yellow ("`nUninstalling previous Windows Subsystem for Linux (WSL), $distroName Linux") 18 | Start-Process $wslPath\$wslDistro -ArgumentList "clean" -NoNewWindow -Wait 19 | Get-ChildItem -Path $wslPath -Recurse | Remove-Item -force -recurse 20 | Remove-Item -Force $wslPath 21 | Remove-Item -Force $ShortcutFile 22 | Write-Host -ForegroundColor Yellow ("`nPrevious Windows Subsystem for Linux (WSL), $distroName Linux FOUND and REMOVED.") 23 | } 24 | Else { 25 | Write-Host -ForegroundColor Yellow ("`nPrevious Windows Subsystem for Linux (WSL), $distroName Linux NOT found.") 26 | } 27 | 28 | # Install WSL Distro 29 | Write-Host -ForegroundColor Yellow ("`nInstalling Windows Subsystem for Linux (WSL), $distroName Linux to $wslPath") 30 | Invoke-Command -ScriptBlock { Copy-Item -Recurse -Path .\ -Destination $args[0] -Force } -ArgumentList $wslPath 31 | 32 | Start-Process wsl.exe -ArgumentList "--set-default-version 2" -NoNewWindow -Wait 33 | Start-Process $wslPath\$wslDistro -NoNewWindow -Wait 34 | Start-Process $wslPath\$wslDistro -ArgumentList "run cd /usr/share/texmf-dist/tex/latex/acrotex; sudo latex acrotex.ins" -NoNewWindow -Wait # would like to add this to makefile 35 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo mktexlsr" -NoNewWindow -Wait # would like to add this to makefile 36 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo git config --system core.autocrlf false" -NoNewWindow -Wait 37 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo git config --system core.symlinks false" -NoNewWindow -Wait 38 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo git config --system rebase.autosquash true" -NoNewWindow -Wait 39 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo git config --system lfs.activitytimeout 0" -NoNewWindow -Wait 40 | Start-Process $wslPath\$wslDistro -ArgumentList "run sudo git config --system credential.helper 'cache --timeout 30000'" -NoNewWindow -Wait 41 | Start-Process $wslPath\$wslDistro -ArgumentList "run git lfs install" -NoNewWindow -Wait 42 | Write-Host -ForegroundColor Green ("`nInstallation of Windows Subsystem for Linux (WSL), $distroName Linux is complete") 43 | 44 | # Configure user for WSL Distro 45 | Write-Host -ForegroundColor Yellow ("`nConfiguring user:$user for Windows Subsystem for Linux (WSL), $distroName Linux") 46 | Write-Host -ForegroundColor Yellow ("`nSet password for $user when prompted") 47 | Start-Process $wslPath\$wslDistro -ArgumentList "run adduser $user --shell bash --uid 1000" -NoNewWindow -Wait 48 | Start-Process $wslPath\$wslDistro -ArgumentList "run echo '$user ALL=(ALL) ALL' >> /etc/sudoers" -NoNewWindow -Wait 49 | Start-Process $wslPath\$wslDistro -ArgumentList "config --default-uid 1000" -NoNewWindow -Wait 50 | Start-Process $wslPath\$wslDistro -ArgumentList "config --default-term wt" -NoNewWindow -Wait 51 | Start-Process $wslPath\$wslDistro -ArgumentList "run echo export PLANTUML=/usr/local/plantuml.jar >> ~/.bash_profile" -NoNewWindow -Wait # would like to add this to makefile 52 | Start-Process $wslPath\$wslDistro -ArgumentList "run echo neofetch >> ~/.bash_profile" -NoNewWindow -Wait # would like to add this to makefile 53 | Start-Process $wslPath\$wslDistro -ArgumentList "run echo from pprint import pprint >> ~/.pyrc" -NoNewWindow -Wait # would like to add this to makefile 54 | Start-Process $wslPath\$wslDistro -ArgumentList "run echo export DISPLAY=:1 >> ~/.bash_profile" -NoNewWindow -Wait # would like to add this to makefile 55 | Start-Process $wslPath\$wslDistro -ArgumentList "run git config --global user.name $user" -NoNewWindow -Wait 56 | Start-Process $wslPath\$wslDistro -ArgumentList "run git config --global user.email '$email'" -NoNewWindow -Wait 57 | 58 | # Create desktop shortcut for user 59 | $WScriptShell = New-Object -ComObject WScript.Shell 60 | $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) 61 | $Shortcut.TargetPath = $TargetFile 62 | $Shortcut.Save() 63 | 64 | # Cleanup 65 | Remove-Item -Force $wslPath\rootfs.tar.gz 66 | Remove-Item -Force $wslPath\addWSLfeature.ps1 67 | Remove-Item -Force $wslPath\install.ps1 68 | 69 | Write-Host -ForegroundColor Green ("`nUser Configuration of user:$user for Windows Subsystem for Linux (WSL), $distroName Linux is complete") 70 | 71 | Stop-Transcript 72 | -------------------------------------------------------------------------------- /profile: -------------------------------------------------------------------------------- 1 | export CHARSET=UTF-8 2 | export LANG=C.UTF-8 3 | export PAGER=less 4 | export PS1='\h:\w\$ ' 5 | umask 022 6 | 7 | for script in /etc/profile.d/*.sh ; do 8 | if [ -r $script ] ; then 9 | . $script 10 | fi 11 | done --------------------------------------------------------------------------------