diff -Nru wslu-2.0.0/appveyor.yml wslu-2.3.2/appveyor.yml --- wslu-2.0.0/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/appveyor.yml 2019-09-23 16:12:26.000000000 +0000 @@ -0,0 +1,21 @@ +version: 2.3.1.{build} +branches: + only: + - master + - develop +only_commits: + files: + - src/**/* + - Makefile +image: Windows Server 2019 +build: Script +clone_folder: C:\project\wslu +install: + - git submodule update --init --recursive + - ps: wsl -u root apt-get update + - ps: wsl -u root DEBIAN_FRONTEND=noninteractive apt-get upgrade -y + - ps: wsl -u root DEBIAN_FRONTEND=noninteractive apt-get install -y bc make imagemagick +build_script: + - ps: wsl make +test_script: + - ps: wsl make test diff -Nru wslu-2.0.0/.circleci/config.yml wslu-2.3.2/.circleci/config.yml --- wslu-2.0.0/.circleci/config.yml 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/.circleci/config.yml 2019-09-23 16:12:26.000000000 +0000 @@ -33,14 +33,15 @@ make sudo make link pkgbuilds: - machine: true + docker: + - image: patrick330602/fake_wsl_env steps: - checkout - run: name: Install Pre-requisites command: | - sudo apt-get update -qq - sudo apt-get install -qq apt-utils build-essential rpm + apt-get update -qq + apt-get install -qq apt-utils build-essential rpm sudo - run: name: Build Package command: | @@ -56,14 +57,15 @@ root: /tmp/pkgs paths: . nightlypkgbuilds: - machine: true + docker: + - image: patrick330602/fake_wsl_env steps: - checkout - run: name: Install Pre-requisites command: | - sudo apt-get update -qq - sudo apt-get install -qq apt-utils build-essential rpm + apt-get update -qq + apt-get install -qq apt-utils build-essential rpm sudo - run: name: Build Package command: | @@ -80,11 +82,14 @@ - image: circleci/ruby:2.3-jessie steps: - attach_workspace: - at: /tmp/pkgs + at: /tmp/pkgs - run: name: Install packageloud cli command: gem install package_cloud - run: + name: Push deb package for debian bullseye + command: package_cloud push whitewaterfoundry/wslu/debian/bullseye /tmp/pkgs/*.deb --skip-errors + - run: name: Push deb package for debian buster command: package_cloud push whitewaterfoundry/wslu/debian/buster /tmp/pkgs/*.deb --skip-errors - run: @@ -100,9 +105,15 @@ name: Push rpm package for fedora 29 command: package_cloud push whitewaterfoundry/wslu/fedora/29 /tmp/pkgs/*.rpm --skip-errors - run: + name: Push rpm package for fedora 30 + command: package_cloud push whitewaterfoundry/wslu/fedora/30 /tmp/pkgs/*.rpm --skip-errors + - run: name: Push rpm package for enterprise linux 7 command: package_cloud push whitewaterfoundry/wslu/el/7 /tmp/pkgs/*.rpm --skip-errors - run: + name: Push rpm package for enterprise linux 8 + command: package_cloud push whitewaterfoundry/wslu/el/8 /tmp/pkgs/*.rpm --skip-errors + - run: name: Push rpm package for scientific linux 7 command: package_cloud push whitewaterfoundry/wslu/scientific/7 /tmp/pkgs/*.rpm --skip-errors - run: @@ -117,6 +128,9 @@ - run: name: Push rpm package for opensuse 15 command: package_cloud push whitewaterfoundry/wslu/opensuse/15.0 /tmp/pkgs/*.rpm --skip-errors + - run: + name: Push rpm package for oracle 7 + command: package_cloud push whitewaterfoundry/wslu/ol/7 /tmp/pkgs/*.rpm --skip-errors workflows: version: 2 tests: @@ -137,7 +151,7 @@ jobs: - pkgbuilds - deploypkg: - requires: + requires: - pkgbuilds nightlybuild: triggers: diff -Nru wslu-2.0.0/configure.sh wslu-2.3.2/configure.sh --- wslu-2.0.0/configure.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/configure.sh 2019-09-23 16:12:26.000000000 +0000 @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash # configure.sh # configure script for wslu # @@ -23,7 +23,7 @@ if [ "$tmp" == "" ]; then echo "/mnt/" else - echo $tmp + echo "$tmp" fi else echo "/mnt/" @@ -43,14 +43,13 @@ function prsh_check { PATH="$(interop_prefix)c/Windows/System32/WindowsPowerShell/v1.0/:$PATH" -powershell.exe -NoProfile -NonInteractive -Command Get-History -if [[ $? -eq 0 ]]; then +if powershell.exe -NoProfile -NonInteractive -Command Get-History; then echo "powershell.exe can be invoked." else echo "powershell.exe failed to launch." exit 1 fi -ppep="`powershell.exe Get-ExecutionPolicy 2>&1 | tail -n1 | sed 's/\r$//'`" +ppep="$(powershell.exe -NoProfile -NonInteractive -Command Get-ExecutionPolicy 2>&1 | tail -n1 | sed 's/\r$//')" echo -e "Powershell Execution Policy: $ppep" if [[ "$ppep" = "Restricted" ]]; then cat << EOF @@ -73,8 +72,12 @@ } function pkg_inst { -distro="$(cat /etc/os-release | head -n1 | sed -e 's/NAME=\"//g')" +distro="$(head -n1 /etc/os-release | sed -e 's/NAME=\"//g')" case $distro in + *Pengwin*) + sudo dpkg --force-depends --remove wslu + sudo apt install -y git gzip make + ;; *WLinux*|Ubuntu*|*Debian*|*Kali*) sudo apt purge -y wslu sudo apt install -y git bc gzip make imagemagick @@ -89,13 +92,13 @@ Arch*) sudo pacman -Syyu git bc gzip make bash-completion imagemagick ;; - Scientific*) + *Oracle*|Scientific*) sudo yum install -y git bc gzip make bash-completion imagemagick ;; *Fedora*) sudo dnf install -y git bc gzip make bash-completion ImageMagick ;; - *Generic*) [ "fedora" == "$(cat /etc/os-release | grep -e "LIKE=" | sed -e 's/ID_LIKE=//g')" ] && sudo dnf install -y git || exit 1;; + *Generic*) [ "fedora" == "$(grep -e "LIKE=" /etc/os-release | sed -e 's/ID_LIKE=//g')" ] && sudo dnf install -y git || exit 1;; *) exit 1;; esac } diff -Nru wslu-2.0.0/CONTRIBUTING.md wslu-2.3.2/CONTRIBUTING.md --- wslu-2.0.0/CONTRIBUTING.md 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/CONTRIBUTING.md 2019-09-23 16:12:26.000000000 +0000 @@ -8,11 +8,8 @@ Run the following to get started: ```bash -git clone https://github.com/wslutilities/wslu -git checkout develop -git submodule init -git submodule update -./configure.sh -a +git clone --recursive --branch develop https://github.com/wslutilities/wslu.git +./configure.sh make sudo make link ``` @@ -45,7 +42,6 @@ - `-e, --env` -- Environment Check, check whether it is using Fake WSL Environment, normal Linux or WSL. - `-p, --prsh` -- Check Status of `powershell.exe`. - `-P, --pkg` -- Install Needed Packages required by your system for building. -- `-a, --all` -- Do everything at the top. ### Build & Install @@ -53,6 +49,7 @@ run `make clean` to clean `out` folder. run `make test` to run tests. run `make install` to install to `/usr/bin/`. Requires to run as `sudo`. +run `make link` to link files from the repo to `/usr/bin/`. Requires to run as `sudo`. run `make uninstall` to uninstall. Requires to run as `sudo`. run `cd extras/scripts && ./builder-docs.sh` to build docs to `gendocs`. diff -Nru wslu-2.0.0/debian/changelog wslu-2.3.2/debian/changelog --- wslu-2.0.0/debian/changelog 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/changelog 2019-10-24 14:15:20.000000000 +0000 @@ -1,3 +1,51 @@ +wslu (2.3.2-0ubuntu2~18.04.0) bionic; urgency=medium + + * Backport to Bionic (LP: #1849679) + + -- Balint Reczey Thu, 24 Oct 2019 16:15:20 +0200 + +wslu (2.3.2-0ubuntu2) focal; urgency=medium + + * Suppress pulseaudio error on starting shell when pulseaudio-utils is installed + (LP: #1844671) + + -- Balint Reczey Thu, 24 Oct 2019 16:04:32 +0200 + +wslu (2.3.2-0ubuntu1) eoan; urgency=medium + + [ Sebastien Bacher ] + * debian/postinst, debian/prerm: + - register also the www-browser alternative, the non-x-variant is + used by xdg-open when DISPLAY is unset + + [ Balint Reczey ] + * New upstream release + - Fix support for Windows user names with space + * Add autopkgtest + * Fix saving configuration when the Windows user name contains space + * Refresh patches + + -- Balint Reczey Wed, 16 Oct 2019 11:58:38 +0200 + +wslu (2.3.0-1ubuntu1) eoan; urgency=medium + + * debian/control: Set Vcs-* fields + * New upstream release + - Stop changing terminal font when running wsl* commands (LP: #1836208) + * Refresh patches + * debian/rules: Run tests in WSL only + + -- Balint Reczey Thu, 01 Aug 2019 12:54:30 +0200 + +wslu (2.0.0-0ubuntu3) eoan; urgency=medium + + * Set DISPLAY=:0 when an X11 server is running (LP: #1836552) + * Use PulseAudio if it is running on Windows (LP: #1836552) + * Set up sound, too, when starting GUI programs via Windows desktop shortcuts + (LP: #1836552) + + -- Balint Reczey Mon, 15 Jul 2019 12:05:41 +0200 + wslu (2.0.0-0ubuntu2~18.04.1) bionic; urgency=medium * Set DISPLAY=:0 when an X11 server is running (LP: #1836552) diff -Nru wslu-2.0.0/debian/control wslu-2.3.2/debian/control --- wslu-2.0.0/debian/control 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/control 2019-10-24 14:15:20.000000000 +0000 @@ -7,6 +7,8 @@ imagemagick, inkscape Standards-Version: 4.3.0.3 +Vcs-Git: https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/wslu -b ubuntu/master +Vcs-Browser: https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/wslu Homepage: https://wslu.patrickwu.space/ Package: wslu diff -Nru wslu-2.0.0/debian/patches/0001-Skip-interop-check-in-scripts.patch wslu-2.3.2/debian/patches/0001-Skip-interop-check-in-scripts.patch --- wslu-2.0.0/debian/patches/0001-Skip-interop-check-in-scripts.patch 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/0001-Skip-interop-check-in-scripts.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -From: Balint Reczey -Date: Mon, 18 Mar 2019 12:54:24 +0100 -Subject: Skip interop check in scripts - -Interoperability changes are not persistent between sessions and scripts -are still useful without interoperability set. - -The check is also failing the tests when the package is built on Linux ---- - src/wslu-header | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/wslu-header b/src/wslu-header -index c632b8c..b770315 100644 ---- a/src/wslu-header -+++ b/src/wslu-header -@@ -28,7 +28,7 @@ LANG=C - set +x - - # checking interopability --cat /proc/sys/fs/binfmt_misc/WSLInterop | grep enabled >/dev/null || (echo "WSL Interopability is disabled. Please enable it before using WSL."; exit 1) -+#cat /proc/sys/fs/binfmt_misc/WSLInterop | grep enabled >/dev/null || (echo "WSL Interopability is disabled. Please enable it before using WSL."; exit 1) - - # variables - ## color diff -Nru wslu-2.0.0/debian/patches/0002-Makefile-Honor-DESTDIR.patch wslu-2.3.2/debian/patches/0002-Makefile-Honor-DESTDIR.patch --- wslu-2.0.0/debian/patches/0002-Makefile-Honor-DESTDIR.patch 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/0002-Makefile-Honor-DESTDIR.patch 2019-10-24 14:15:20.000000000 +0000 @@ -7,7 +7,7 @@ 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile -index 6a8201a..187f045 100644 +index dadbd3e..43647f6 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,10 @@ link: diff -Nru wslu-2.0.0/debian/patches/0003-Fix-one-test-failing-on-Windows.patch wslu-2.3.2/debian/patches/0003-Fix-one-test-failing-on-Windows.patch --- wslu-2.0.0/debian/patches/0003-Fix-one-test-failing-on-Windows.patch 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/0003-Fix-one-test-failing-on-Windows.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Balint Reczey -Date: Mon, 18 Mar 2019 16:28:33 +0100 -Subject: Fix one test failing on Windows - ---- - tests/wslupath.bats | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/wslupath.bats b/tests/wslupath.bats -index 8549dda..fc29155 100644 ---- a/tests/wslupath.bats -+++ b/tests/wslupath.bats -@@ -43,7 +43,7 @@ - - @test "wslupath - No parameter - Linux DirPath" { - run out/wslupath "/mnt/c/Windows" -- [ "${lines[0]}" = "c:\\Windows" ] -+ [ "${lines[0]}" = "C:\\Windows" ] - } - - @test "wslupath - /w DoubleDash - Windows Double DirPath" { diff -Nru wslu-2.0.0/debian/patches/0004-Print-error-message-when-convert-is-not-found.patch wslu-2.3.2/debian/patches/0004-Print-error-message-when-convert-is-not-found.patch --- wslu-2.0.0/debian/patches/0004-Print-error-message-when-convert-is-not-found.patch 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/0004-Print-error-message-when-convert-is-not-found.patch 2019-10-24 14:15:20.000000000 +0000 @@ -7,14 +7,14 @@ 1 file changed, 11 insertions(+) diff --git a/src/wslusc.sh b/src/wslusc.sh -index e70a45d..7bafd19 100644 +index 2c3926e..ee5c589 100644 --- a/src/wslusc.sh +++ b/src/wslusc.sh -@@ -70,6 +70,17 @@ if [[ "$cname" != "" ]]; then - +@@ -98,6 +98,17 @@ if [[ "$cname" != "" ]]; then if [[ "$ext" != "ico" ]]; then - if [[ "$ext" == "svg" ]] || [[ "$ext" == "png" ]]; then -+ if ! type convert > /dev/null 2>&1; then + if [[ "$ext" == "svg" ]]; then + echo "${info} Converting $ext icon to ico..." ++ if ! type convert > /dev/null; then + echo "The 'convert' command is needed for converting the icon." + if [ -x /usr/lib/command-not-found ]; then + echo " It can be installed with:" >&2 @@ -25,6 +25,6 @@ + fi + exit 22 + fi - echo "${info} Converting $ext icon to ico..." - convert "$script_location/$icon_filename" -resize 256X256 "$script_location/${icon_filename%.$ext}.ico" + convert "$script_location/$icon_filename" -trim -background none -resize 256X256 -define 'icon:auto-resize=16,24,32,64,128,256' "$script_location/${icon_filename%.$ext}.ico" + rm "$script_location/$icon_filename" icon_filename="${icon_filename%.$ext}.ico" diff -Nru wslu-2.0.0/debian/patches/0005-Set-up-sound-too-when-starting-GUI-programs-via-Wind.patch wslu-2.3.2/debian/patches/0005-Set-up-sound-too-when-starting-GUI-programs-via-Wind.patch --- wslu-2.0.0/debian/patches/0005-Set-up-sound-too-when-starting-GUI-programs-via-Wind.patch 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/0005-Set-up-sound-too-when-starting-GUI-programs-via-Wind.patch 2019-10-24 14:15:20.000000000 +0000 @@ -8,15 +8,15 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wslusc.sh b/src/wslusc.sh -index 5b0ae0a..45b3b11 100644 +index ee5c589..39f757d 100644 --- a/src/wslusc.sh +++ b/src/wslusc.sh -@@ -98,7 +98,7 @@ if [[ "$cname" != "" ]]; then +@@ -134,7 +134,7 @@ if [[ "$cname" != "" ]]; then fi if [[ "$is_gui" == "1" ]]; then -- winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs bash.exe -c \"cd ~; export DISPLAY=:0; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" -+ winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs bash.exe -c \"cd ~; . /usr/share/wslu/wsl-integration.sh; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" +- winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs $distro_location_win $distro_param \"cd ~; export DISPLAY=:0; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" ++ winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs $distro_location_win $distro_param \"cd ~; . /usr/share/wslu/wsl-integration.sh; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" else - winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\bash.exe';\$s.Arguments='-c \"cd ~; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" + winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='$distro_location_win';\$s.Arguments='$distro_param \"cd ~; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" fi diff -Nru wslu-2.0.0/debian/patches/0006-Fix-empty-.config-wslu-baseexec.patch wslu-2.3.2/debian/patches/0006-Fix-empty-.config-wslu-baseexec.patch --- wslu-2.0.0/debian/patches/0006-Fix-empty-.config-wslu-baseexec.patch 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/debian/patches/0006-Fix-empty-.config-wslu-baseexec.patch 2019-10-24 14:15:20.000000000 +0000 @@ -0,0 +1,23 @@ +From: Balint Reczey +Date: Wed, 16 Oct 2019 11:40:51 +0200 +Subject: Fix empty ~/.config/wslu/baseexec + +Previous versions of wslu could create an empty file and this is not +a valid configuration. +--- + src/wslu-header | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/wslu-header b/src/wslu-header +index da17420..6f893c6 100644 +--- a/src/wslu-header ++++ b/src/wslu-header +@@ -112,7 +112,7 @@ if [ ! -f ~/.config/wslu/oemcp ]; then + "$(interop_prefix)"c/Windows/System32/reg.exe query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage" /v OEMCP 2>&1 | sed -n 3p | sed -e 's|\r||g' | grep -o '[[:digit:]]*' > ~/.config/wslu/oemcp + fi + +-if [ ! -f ~/.config/wslu/baseexec ]; then ++if [ ! -f ~/.config/wslu/baseexec ] || [ -z "$(cat ~/.config/wslu/baseexec)" ]; then + wslutmpbuild=$(reg.exe query "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion" /v CurrentBuild | tail -n 2 | head -n 1 | sed -e 's|\r||g') + wslutmpbuild=${wslutmpbuild##* } + wslutmpbuild="$(( $wslutmpbuild + 0 ))" diff -Nru wslu-2.0.0/debian/patches/0007-Fix-setting-.config-wslu-baseexec-when-the-Windows-u.patch wslu-2.3.2/debian/patches/0007-Fix-setting-.config-wslu-baseexec-when-the-Windows-u.patch --- wslu-2.0.0/debian/patches/0007-Fix-setting-.config-wslu-baseexec-when-the-Windows-u.patch 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/debian/patches/0007-Fix-setting-.config-wslu-baseexec-when-the-Windows-u.patch 2019-10-24 14:15:20.000000000 +0000 @@ -0,0 +1,24 @@ +From: Balint Reczey +Date: Wed, 16 Oct 2019 11:43:44 +0200 +Subject: Fix setting ~/.config/wslu/baseexec when the Windows user name + contains space + +--- + src/wslu-header | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/wslu-header b/src/wslu-header +index 6f893c6..05533bf 100644 +--- a/src/wslu-header ++++ b/src/wslu-header +@@ -120,7 +120,9 @@ if [ ! -f ~/.config/wslu/baseexec ] || [ -z "$(cat ~/.config/wslu/baseexec)" ]; + wslu_distro_regpath=$("$(interop_prefix)"c/Windows/System32/reg.exe query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Lxss" /s /f DistributionName 2>&1 | grep -B1 -e "$WSL_DISTRO_NAME" | head -n1 | sed -e 's|\r||g') + wslu_distro_packagename=$($(interop_prefix)c/Windows/System32/reg.exe query "$wslu_distro_regpath" /v PackageFamilyName | tail -n 2 | head -n 1 | sed -e 's|\r||g') + wslu_distro_packagename=${wslu_distro_packagename##* } +- find $(wslpath "$(double_dash_p $(winps_exec "Write-Output \$Env:LOCALAPPDATA" | tr -d "\r"))\\Microsoft\\WindowsApps\\$wslu_distro_packagename") -name "*.exe" > ~/.config/wslu/baseexec ++ distro_path_win=$(winps_exec 'Write-Output $Env:LOCALAPPDATA' | tr -d '\r')\\Microsoft\\WindowsApps\\$wslu_distro_packagename ++ distro_path=$(wslpath "$distro_path_win") ++ find "$distro_path" -name "*.exe" > ~/.config/wslu/baseexec + else + echo "$(wslpath "C:\\Windows\\System32\\wsl.exe")" > ~/.config/wslu/baseexec + fi diff -Nru wslu-2.0.0/debian/patches/series wslu-2.3.2/debian/patches/series --- wslu-2.0.0/debian/patches/series 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/patches/series 2019-10-24 14:15:20.000000000 +0000 @@ -1,5 +1,5 @@ -0001-Skip-interop-check-in-scripts.patch 0002-Makefile-Honor-DESTDIR.patch -0003-Fix-one-test-failing-on-Windows.patch 0004-Print-error-message-when-convert-is-not-found.patch 0005-Set-up-sound-too-when-starting-GUI-programs-via-Wind.patch +0006-Fix-empty-.config-wslu-baseexec.patch +0007-Fix-setting-.config-wslu-baseexec-when-the-Windows-u.patch diff -Nru wslu-2.0.0/debian/postinst wslu-2.3.2/debian/postinst --- wslu-2.0.0/debian/postinst 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/postinst 2019-10-24 14:15:20.000000000 +0000 @@ -6,4 +6,5 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] ; then update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/wslview 30 + update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/wslview 30 fi diff -Nru wslu-2.0.0/debian/prerm wslu-2.3.2/debian/prerm --- wslu-2.0.0/debian/prerm 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/prerm 2019-10-24 14:15:20.000000000 +0000 @@ -6,5 +6,6 @@ if [ "$1" = "remove" ] ; then update-alternatives --remove x-www-browser /usr/bin/wslview + update-alternatives --remove www-browser /usr/bin/wslview fi diff -Nru wslu-2.0.0/debian/rules wslu-2.3.2/debian/rules --- wslu-2.0.0/debian/rules 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/rules 2019-10-24 14:15:20.000000000 +0000 @@ -15,7 +15,7 @@ mkdir -p extras/bats/libexec && ln -s /usr/bin/bats extras/bats/libexec/ &&\ dh_auto_test ; \ else \ - env PATH=out:$$PATH:$$src TERM=xterm; bats tests/header.bats ; \ + echo "Skipping tests, they pass in WSL only with WSLInterop enabled"; \ fi override_dh_clean: diff -Nru wslu-2.0.0/debian/tests/commands wslu-2.3.2/debian/tests/commands --- wslu-2.0.0/debian/tests/commands 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/debian/tests/commands 2019-10-24 14:15:20.000000000 +0000 @@ -0,0 +1,9 @@ +#!/bin/sh + +if (test ! -f /proc/sys/fs/binfmt_misc/WSLInterop || ! grep -q enabled /proc/sys/fs/binfmt_misc/WSLInterop); then + echo "Skipping tests, they pass in WSL only with WSLInterop enabled" + exit 77 +fi + +ln -s /usr/bin out || true +bats tests/*.bats diff -Nru wslu-2.0.0/debian/tests/control wslu-2.3.2/debian/tests/control --- wslu-2.0.0/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/debian/tests/control 2019-10-24 14:15:20.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: commands +Depends: @, @builddeps@ +Restrictions: skippable diff -Nru wslu-2.0.0/debian/wsl-integration.sh wslu-2.3.2/debian/wsl-integration.sh --- wslu-2.0.0/debian/wsl-integration.sh 2019-07-15 11:32:03.000000000 +0000 +++ wslu-2.3.2/debian/wsl-integration.sh 2019-10-24 14:15:20.000000000 +0000 @@ -6,7 +6,7 @@ # set up audio if pulse server is reachable only via tcp if which pactl > /dev/null \ - && (! pactl info > /dev/null 2>&1 || pactl info | grep -q 'Default Sink: auto_null' ) \ + && (! pactl info > /dev/null 2>&1 || pactl info 2> /dev/null | grep -q 'Default Sink: auto_null' ) \ && env PULSE_SERVER=tcp:localhost pactl info > /dev/null 2>&1; then export PULSE_SERVER=tcp:localhost fi Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslfetch.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslfetch.1.gz differ Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslsys.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslsys.1.gz differ Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslupath.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslupath.1.gz differ Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslusc.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslusc.1.gz differ Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslvar.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslvar.1.gz differ Binary files /tmp/tmptSdhH3/AY5md9A4uk/wslu-2.0.0/docs/wslview.1.gz and /tmp/tmptSdhH3/JM4eQv10OT/wslu-2.3.2/docs/wslview.1.gz differ diff -Nru wslu-2.0.0/extras/build/alpine/APKBUILD wslu-2.3.2/extras/build/alpine/APKBUILD --- wslu-2.0.0/extras/build/alpine/APKBUILD 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/build/alpine/APKBUILD 2019-09-23 16:12:26.000000000 +0000 @@ -1,6 +1,6 @@ # Maintainer: Patrick Wu pkgname=wslu -pkgver=2.0.0 +pkgver=2.3.2 pkgrel=0 pkgdesc="A collection of utilities for Windows 10 Linux Subsystems" url="https://github.com/wslutilities/wslu" @@ -10,8 +10,8 @@ makedepends="make" install="" subpackages="" -source="${pkgname}-${pkgver}.tar.gz::https://github.com/wslutilities/wslu/archive/v2.0.0.tar.gz" -builddir="$srcdir/wslu-2.0.0" +source="${pkgname}-${pkgver}.tar.gz::https://github.com/wslutilities/wslu/archive/v2.3.0.tar.gz" +builddir="$srcdir/wslu-2.3.0" build() { cd "$builddir" make diff -Nru wslu-2.0.0/extras/build/arch/PKGBUILD wslu-2.3.2/extras/build/arch/PKGBUILD --- wslu-2.0.0/extras/build/arch/PKGBUILD 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/build/arch/PKGBUILD 2019-09-23 16:12:26.000000000 +0000 @@ -1,7 +1,7 @@ # Maintainer: Patrick Wu pkgname=wslu -pkgver=2.0.0 +pkgver=2.3.2 pkgrel=0 pkgdesc="A collection of utilities for Windows 10 Linux Subsystems" arch=('any') diff -Nru wslu-2.0.0/extras/build/debian/postinst wslu-2.3.2/extras/build/debian/postinst --- wslu-2.0.0/extras/build/debian/postinst 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/build/debian/postinst 2019-09-23 16:12:26.000000000 +0000 @@ -8,16 +8,23 @@ if [ "$tmp" == "" ]; then echo "/mnt/" else - echo $tmp + echo "$tmp" fi else echo "/mnt/" fi } +function winps_exec { +PATH="$(interop_prefix)c/Windows/System32/WindowsPowerShell/v1.0/:$(interop_prefix)c/Windows/System32/:$PATH" +chcp.com $("$(interop_prefix)"c/Windows/System32/reg.exe query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage" /v OEMCP 2>&1 | sed -n 3p | sed -e 's|\r||g' | grep -o '[[:digit:]]*') >/dev/null +"$(interop_prefix)"c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -Command "$@" +chcp.com 65001 >/dev/null +PATH=$(getconf PATH) +} + function prsh_check { -PATH="$(interop_prefix)c/Windows/System32/WindowsPowerShell/v1.0/:$PATH" -ppep="`powershell.exe Get-ExecutionPolicy 2>&1 | tail -n1 | sed 's/\r$//'`" +ppep="$(winps_exec Get-ExecutionPolicy 2>&1 | tail -n1 | sed 's/\r$//')" echo -e "Powershell Execution Policy: $ppep" if [[ "$ppep" = "Restricted" ]]; then cat << EOF @@ -36,10 +43,9 @@ le to invoke this command from WSL. EOF fi -PATH=$(getconf PATH) + } -function env_check { if [ -f /etc/fake-wsl-release ] then cat << EOF @@ -62,6 +68,3 @@ else prsh_check fi -} - -env_check \ No newline at end of file diff -Nru wslu-2.0.0/extras/build/rpm/wslu.spec wslu-2.3.2/extras/build/rpm/wslu.spec --- wslu-2.0.0/extras/build/rpm/wslu.spec 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/build/rpm/wslu.spec 2019-09-23 16:12:26.000000000 +0000 @@ -14,6 +14,7 @@ Version: BUILDVERPLACEHOLDERNIGHTLYBUILDPLACEHOLDER Release: 1 Source: wslu-BUILDVERPLACEHOLDER.tar.gz +BuildArch: noarch Requires: bc ImageMagick Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives @@ -21,7 +22,6 @@ License: GPLv3 %description This is a collection of utilities for Windows 10 Linux Subsystem, such as converting WSL path to Windows path or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher. -%global debug_package %{nil} %prep %setup %build @@ -58,6 +58,6 @@ %doc /usr/share/man/man1/ %changelog -* Fri Mar 15 2019 patrick330602 +* Wed Jul 31 2019 patrick330602 - Please check https://github.com/wslutilities/wslu/releases/latest for changelog diff -Nru wslu-2.0.0/extras/scripts/builder-deb.sh wslu-2.3.2/extras/scripts/builder-deb.sh --- wslu-2.0.0/extras/scripts/builder-deb.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/scripts/builder-deb.sh 2019-09-23 16:12:26.000000000 +0000 @@ -43,7 +43,7 @@ chmod 755 "$BUILD_DIR"/DEBIAN/{postinst,prerm} # export md5 hashes -cd $BUILD_DIR +cd "$BUILD_DIR" || exit 1 find . -type f ! -regex '.*.hg.*' ! -regex '.*?debian-binary.*' ! -regex '.*?DEBIAN.*' -printf '%P ' | xargs md5sum > DEBIAN/md5sums # setting permissions @@ -52,9 +52,9 @@ # build [[ -d "$CURRENT_DIR"/../../target ]] || mkdir "$CURRENT_DIR"/../../target -cd "$CURRENT_DIR"/../../target/ +cd "$CURRENT_DIR"/../../target/ || exit 1 sudo dpkg -b "$BUILD_DIR"/ wslu-"${BUILD_VER}".deb # Cleanup everything rm -rf "$BUILD_DIR" -cd "$CURRENT_DIR" +cd "$CURRENT_DIR" || exit 1 diff -Nru wslu-2.0.0/extras/scripts/builder-docs.sh wslu-2.3.2/extras/scripts/builder-docs.sh --- wslu-2.0.0/extras/scripts/builder-docs.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/scripts/builder-docs.sh 2019-09-23 16:12:26.000000000 +0000 @@ -28,10 +28,13 @@ [[ -d "$OUTPATH" ]] || mkdir "$OUTPATH" for file in "${SOURCES[@]}"; do - NAME_CAP="$(echo $file | tr '[:lower:]' '[:upper:]')" - + NAME_CAP="$(echo "$file" | tr '[:lower:]' '[:upper:]')" + + # rename the filename + mv wslu.wiki/"$file".md wslu.wiki/"$file" + # generate base files using ronn - ronn --manual=$NAME_CAP --organization="Patrick Wu" --date="$BUILD_TIME" wslu.wiki/"$file".md + ronn --manual="$NAME_CAP" --organization="Patrick Wu" --date="$BUILD_TIME" wslu.wiki/"$file" # cleanup folder for file modification rm wslu.wiki/"$file".html @@ -49,4 +52,4 @@ done # cleanup temp files -rm -rf wslu.wiki \ No newline at end of file +rm -rf wslu.wiki diff -Nru wslu-2.0.0/extras/scripts/builder-rpm.sh wslu-2.3.2/extras/scripts/builder-rpm.sh --- wslu-2.0.0/extras/scripts/builder-rpm.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/extras/scripts/builder-rpm.sh 2019-09-23 16:12:26.000000000 +0000 @@ -39,25 +39,23 @@ # Modifying the files sed -i s/BUILDVERPLACEHOLDER/"$BUILD_VER"/g ~/rpm_wslu/SPECS/wslu-"$BUILD_VER".spec -sed -i s/NIGHTLYBUILDPLACEHOLDER/$EXTRAS/g ~/rpm_wslu/SPECS/wslu-"$BUILD_VER".spec -sed -i "s|HOMEPLACEHOLDER|$HOME|g" ~/rpm_wslu/SPECS/wslu-"$BUILD_VER".spec +sed -i s/NIGHTLYBUILDPLACEHOLDER/"$EXTRA"/g ~/rpm_wslu/SPECS/wslu-"$BUILD_VER".spec +sed -i "s|HOMEPLACEHOLDER|""$HOME""|g" ~/rpm_wslu/SPECS/wslu-"$BUILD_VER".spec # Build tarball -cd ~/rpm_wslu/SOURCES +cd ~/rpm_wslu/SOURCES || exit 1 tar -czvf wslu-"$BUILD_VER".tar.gz wslu-"$BUILD_VER" rm -rf wslu-"$BUILD_VER" # Build -cd ~/rpm_wslu/SPECS -sudo rpmbuild -ba --target x86_64 wslu-"$BUILD_VER".spec -sudo rpmbuild -ba --target arm64 wslu-"$BUILD_VER".spec +cd ~/rpm_wslu/SPECS || exit 1 +sudo rpmbuild -ba --target noarch wslu-"$BUILD_VER".spec # Copy packages [[ -d "$CURRENT_DIR"/../../target ]] || mkdir "$CURRENT_DIR"/../../target -cp ~/rpm_wslu/RPMS/x86_64/*.rpm "$CURRENT_DIR"/../../target/ -cp ~/rpm_wslu/RPMS/arm64/*.rpm "$CURRENT_DIR"/../../target/ +cp ~/rpm_wslu/RPMS/noarch/*.rpm "$CURRENT_DIR"/../../target/ cp ~/rpm_wslu/SRPMS/*.rpm "$CURRENT_DIR"/../../target/ # Cleanup everything sudo rm -rf ~/rpm_wslu/ -cd "$CURRENT_DIR" +cd "$CURRENT_DIR" || exit 1 diff -Nru wslu-2.0.0/.github/FUNDING.yml wslu-2.3.2/.github/FUNDING.yml --- wslu-2.0.0/.github/FUNDING.yml 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/.github/FUNDING.yml 2019-09-23 16:12:26.000000000 +0000 @@ -0,0 +1,5 @@ +# These are supported funding model platforms + +open_collective: wslu +ko_fi: patrickwu +custom: ['https://www.paypal.me/callmepk/'] diff -Nru wslu-2.0.0/Makefile wslu-2.3.2/Makefile --- wslu-2.0.0/Makefile 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/Makefile 2019-09-23 16:12:26.000000000 +0000 @@ -46,6 +46,5 @@ rm -rf $(OUTPATH) test: - PATH="$$CURRENT_PATH/src:$$CURRENT_PATH/out:$$PATH" + PATH="$$CURPATH/src:$$CURPATH/out:$$PATH" extras/bats/libexec/bats tests/header.bats tests/wslsys.bats tests/wslusc.bats tests/wslupath.bats tests/wslvar.bats tests/wslfetch.bats tests/wslview.bats - diff -Nru wslu-2.0.0/README.hans.md wslu-2.3.2/README.hans.md --- wslu-2.0.0/README.hans.md 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/README.hans.md 2019-09-23 16:12:26.000000000 +0000 @@ -4,14 +4,13 @@ # wslu - 一套Windows 10 Linux子系统工具组 -[![GitHub license](https://flat.badgen.net/github/license/wslutilities/wslu?icon=github&label=&color=cyan)](https://github.com/wslutilities/wslu/blob/master/LICENSE) -[![GitHub (pre-)release](https://flat.badgen.net/github/release/wslutilities/wslu?icon=github&label=)](https://github.com/wslutilities/wslu) -[![Circle CI master](https://flat.badgen.net/circleci/github/wslutilities/wslu/master?label=master&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/master) -[![Circle CI develop](https://flat.badgen.net/circleci/github/wslutilities/wslu/develop?label=develop&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/develop) -[![Donate](https://flat.badgen.net/badge/Donate/Paypal/purple)](https://www.paypal.me/callmepk/) -[![Backers on Open Collective](https://flat.badgen.net/opencollective/backers/wslu)](CONTRIBUTING.md#financial-contributions) -[![Chat On Gitter](https://flat.badgen.net/badge/chat/on%20gitter/cyan)](https://gitter.im/wslutilities/wslu) -[![Twitter](https://flat.badgen.net/twitter/follow/wslutilities)](https://twitter.com/wslutilities) +[![GitHub license](https://img.shields.io/github/license/wslutilities/wslu?style=flat-square&label=许可协议&color=blue&logo=github)](https://github.com/wslutilities/wslu/blob/master/LICENSE) +[![GitHub (pre-)release](https://img.shields.io/github/v/release/wslutilities/wslu?include_prereleases&label=版本&logo=github&style=flat-square)](https://github.com/wslutilities/wslu) +[![GitLab](https://img.shields.io/static/v1?label=gitlab&logo=gitlab&color=E24329&message=已镜像&style=flat-square)](https://gitlab.com/callmepk/wslu) +[![码云](https://img.shields.io/static/v1?label=码云&color=C71D23&message=已镜像&style=flat-square)](https://gitee.com/mirrors/wslu) +[![Gitter](https://img.shields.io/gitter/room/wslutilities/wslu?color=ED1965&logo=gitter&style=flat-square)](https://gitter.im/wslutilities/wslu) +[![Twitter Follow](https://img.shields.io/twitter/follow/wslutilities?style=flat-square&logo=twitter&color=1DA1F2&label=关注) +](https://twitter.com/wslutilities) [English](README.md) | 简体中文 | [繁體中文](README.hant.md) @@ -39,17 +38,35 @@ **wslupath** ⚠ *已弃用* 可以转换不同类型路径的工具。 +## 状态 + +| | 服务 | Master | Develop | +| ------ | ------ |:------:|:-------:| +| 证书检查 | FOSSA | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu%2develop?ref=badge_shield) | - | +| 代码质量 | CodeFactor | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/master)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/master) | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/develop)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/develop) | +| 测试 | AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/master?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/develop?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/master) | +| 部署 | CircleCI | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/master)](https://circleci.com/gh/wslutilities/wslu/tree/master) | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/develop)](https://circleci.com/gh/wslutilities/wslu/tree/develop) | + ## 安装 -### WLinux/Fedora Remix +### Pengwin/Fedora Remix 已内置。 -### 基于Debian的分发版(Ubuntu/Debian/Kali Linux) +### Ubuntu + +最新版本已内置。针对旧版本的安装,请安装依赖于 wslu 的 ubuntu-wsl: + +``` +sudo apt update +sudo apt install ubuntu-wsl +``` + +### 基于Debian的分发版(Debian/Kali Linux) 你可以从 Releases 界面下载`.deb`进行安装:`sudo dpkg -i wslu*`。 -#### Ubuntu/Debian +#### Debian 你可以用以下命令进行安装: @@ -57,7 +74,7 @@ curl -s https://packagecloud.io/install/repositories/whitewaterfoundry/wslu/script.deb.sh | sudo bash ``` -### 基于RPM的分发版(OpenSUSE/SLES/WLinux企业版) +### 基于RPM的分发版(OpenSUSE/SLES/Pengwin企业版/Oracle Linux) 你可以用以下命令进行安装: @@ -92,7 +109,18 @@ -本应用使用了 [GPLv3](LICENSE) 许可。 +This project uses [GPLv3](LICENSE) License. + +Logo of WSL Utilities is licensed under [CC BY-NC 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/). + +### Assets + +Tux logo used in `\src\etc\wsl.ico` was originally made by Larry Ewing in the Gimp and re-illustrated in vector by Garrett LeSage, using Inkscape. + +Some of `wslfetch` ASCII Arts comes from [`neofetch`](https://github.com/dylanaraps/neofetch/) with [MIT](https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md) License and [`screenFetch`](https://github.com/KittyKatt/screenFetch/) with [GPLv3](https://github.com/KittyKatt/screenFetch/blob/master/COPYING) License. + +Pengwin Logo used in `wslfetch` ASCII art is ASCII version of the artwork by [Dennis D. Bednarz](https://twitter.com/DennisBednarz), with use permission from Whitewater Foundry. + -在`\src\etc\wsl.ico`使用的 Tux 图标由 Larry Ewing 用 Gimp 创造,由 Garrett LeSage 使用 Inkscape 进行矢量重绘。 +WLinux Logo used in `wslfetch` ASCII art is ASCII version of the artwork by Larry Ewing. diff -Nru wslu-2.0.0/README.hant.md wslu-2.3.2/README.hant.md --- wslu-2.0.0/README.hant.md 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/README.hant.md 2019-09-23 16:12:26.000000000 +0000 @@ -4,14 +4,13 @@ # wslu - 一套Windows 10 Linux子系統工具組 -[![GitHub license](https://flat.badgen.net/github/license/wslutilities/wslu?icon=github&label=&color=cyan)](https://github.com/wslutilities/wslu/blob/master/LICENSE) -[![GitHub (pre-)release](https://flat.badgen.net/github/release/wslutilities/wslu?icon=github&label=)](https://github.com/wslutilities/wslu) -[![Circle CI master](https://flat.badgen.net/circleci/github/wslutilities/wslu/master?label=master&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/master) -[![Circle CI develop](https://flat.badgen.net/circleci/github/wslutilities/wslu/develop?label=develop&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/develop) -[![Donate](https://flat.badgen.net/badge/Donate/Paypal/purple)](https://www.paypal.me/callmepk/) -[![Backers on Open Collective](https://flat.badgen.net/opencollective/backers/wslu)](CONTRIBUTING.md#financial-contributions) -[![Chat On Gitter](https://flat.badgen.net/badge/chat/on%20gitter/cyan)](https://gitter.im/wslutilities/wslu) -[![Twitter](https://flat.badgen.net/twitter/follow/wslutilities)](https://twitter.com/wslutilities) +[![GitHub license](https://img.shields.io/github/license/wslutilities/wslu?style=flat-square&label=許可協議&color=blue&logo=github)](https://github.com/wslutilities/wslu/blob/master/LICENSE) +[![GitHub (pre-)release](https://img.shields.io/github/v/release/wslutilities/wslu?include_prereleases&label=版本&logo=github&style=flat-square)](https://github.com/wslutilities/wslu) +[![GitLab](https://img.shields.io/static/v1?label=gitlab&logo=gitlab&color=E24329&message=已映象&style=flat-square)](https://gitlab.com/callmepk/wslu) +[![碼雲](https://img.shields.io/static/v1?label=碼雲&color=C71D23&message=已映象&style=flat-square)](https://gitee.com/mirrors/wslu) +[![Gitter](https://img.shields.io/gitter/room/wslutilities/wslu?color=ED1965&logo=gitter&style=flat-square)](https://gitter.im/wslutilities/wslu) +[![Twitter Follow](https://img.shields.io/twitter/follow/wslutilities?style=flat-square&logo=twitter&color=1DA1F2&label=跟隨) +](https://twitter.com/wslutilities) [English](README.md) | [简体中文](README.hans.md) | 繁體中文 @@ -39,12 +38,31 @@ **wslupath** ⚠ *已棄用* 可以轉換不同類型路徑的工具。 +## 狀態 + +| | 服務 | Master | Develop | +| ------ | ------ |:------:|:-------:| +| 證書檢查 | FOSSA | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu%2develop?ref=badge_shield) | - | +| 程式碼質量 | CodeFactor | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/master)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/master) | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/develop)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/develop) | +| 測試 | AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/master?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/develop?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/master) | +| 部署 | CircleCI | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/master)](https://circleci.com/gh/wslutilities/wslu/tree/master) | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/develop)](https://circleci.com/gh/wslutilities/wslu/tree/develop) | + + ## 安裝 -### WLinux/Fedora Remix +### Pengwin/Fedora Remix 已內建。 +### Ubuntu + +最新版本已內建。針對舊版本的安裝,請安裝依賴於 wslu 的 ubuntu-wsl: + +``` +sudo apt update +sudo apt install ubuntu-wsl +``` + ### 基於Debian的分發版(Ubuntu/Debian/Kali Linux) 你可以從 Releases 介面下載`.deb`進行安裝:`sudo dpkg -i wslu*`。 @@ -57,7 +75,7 @@ curl -s https://packagecloud.io/install/repositories/whitewaterfoundry/wslu/script.deb.sh | sudo bash ``` -### 基於RPM的分發版(OpenSUSE/SLES/WLinux企業版) +### 基於RPM的分發版(OpenSUSE/SLES/Pengwin企業版/Oracle Linux) 你可以用以下命令進行安裝: @@ -92,6 +110,17 @@ -本應用使用了 [GPLv3](LICENSE) 許可。 +This project uses [GPLv3](LICENSE) License. + +Logo of WSL Utilities is licensed under [CC BY-NC 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/). + +### Assets + +Tux logo used in `\src\etc\wsl.ico` was originally made by Larry Ewing in the Gimp and re-illustrated in vector by Garrett LeSage, using Inkscape. + +Some of `wslfetch` ASCII Arts comes from [`neofetch`](https://github.com/dylanaraps/neofetch/) with [MIT](https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md) License and [`screenFetch`](https://github.com/KittyKatt/screenFetch/) with [GPLv3](https://github.com/KittyKatt/screenFetch/blob/master/COPYING) License. + +Pengwin Logo used in `wslfetch` ASCII art is ASCII version of the artwork by [Dennis D. Bednarz](https://twitter.com/DennisBednarz), with use permission from Whitewater Foundry. + -在`\src\etc\wsl.ico`使用的 Tux 圖示由 Larry Ewing 用 Gimp 創造,由 Garrett LeSage 使用 Inkscape 進行向量重繪。 \ No newline at end of file +WLinux Logo used in `wslfetch` ASCII art is ASCII version of the artwork by Larry Ewing. \ No newline at end of file diff -Nru wslu-2.0.0/README.md wslu-2.3.2/README.md --- wslu-2.0.0/README.md 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/README.md 2019-09-23 16:12:26.000000000 +0000 @@ -4,14 +4,12 @@ # wslu - A collection of utilities for WSL -[![GitHub license](https://flat.badgen.net/github/license/wslutilities/wslu?icon=github&label=&color=cyan)](https://github.com/wslutilities/wslu/blob/master/LICENSE) -[![GitHub (pre-)release](https://flat.badgen.net/github/release/wslutilities/wslu?icon=github&label=)](https://github.com/wslutilities/wslu) -[![Circle CI master](https://flat.badgen.net/circleci/github/wslutilities/wslu/master?label=master&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/master) -[![Circle CI develop](https://flat.badgen.net/circleci/github/wslutilities/wslu/develop?label=develop&icon=circleci)](https://circleci.com/gh/wslutilities/wslu/tree/develop) -[![Donate](https://flat.badgen.net/badge/Donate/Paypal/purple)](https://www.paypal.me/callmepk/) -[![Backers on Open Collective](https://flat.badgen.net/opencollective/backers/wslu)](CONTRIBUTING.md#financial-contributions) -[![Chat On Gitter](https://flat.badgen.net/badge/chat/on%20gitter/cyan)](https://gitter.im/wslutilities/wslu) -[![Twitter](https://flat.badgen.net/twitter/follow/wslutilities)](https://twitter.com/wslutilities) +[![GitHub license](https://img.shields.io/github/license/wslutilities/wslu?style=flat-square&label=license&color=blue&logo=github)](https://github.com/wslutilities/wslu/blob/master/LICENSE) +[![GitHub (pre-)release](https://img.shields.io/github/v/release/wslutilities/wslu?include_prereleases&logo=github&style=flat-square)](https://github.com/wslutilities/wslu) +[![GitLab](https://img.shields.io/static/v1?label=gitlab&logo=gitlab&color=E24329&message=mirrored&style=flat-square)](https://gitlab.com/callmepk/wslu) +[![Gitee](https://img.shields.io/static/v1?label=gitee&color=C71D23&message=mirrored&style=flat-square)](https://gitee.com/mirrors/wslu) +[![Gitter](https://img.shields.io/gitter/room/wslutilities/wslu?color=ED1965&logo=gitter&style=flat-square)](https://gitter.im/wslutilities/wslu) +[![Twitter Follow](https://img.shields.io/twitter/follow/wslutilities?style=flat-square&logo=twitter&color=1DA1F2&label=follow)](https://twitter.com/wslutilities) English | [简体中文](README.hans.md) | [繁體中文](README.hant.md) @@ -39,17 +37,36 @@ **wslupath** ⚠ *Deprecated* A WSL tool to convert path styles. +## Status + +| | Service | Master | Develop | +| ------ | ------ |:------:|:-------:| +| License Check | FOSSA | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpatrick330602%2Fwslu%2develop?ref=badge_shield) | - | +| Code Quality | CodeFactor | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/master)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/master) | [![CodeFactor Grade Master](https://img.shields.io/codefactor/grade/github/wslutilities/wslu/develop)](https://www.codefactor.io/repository/github/wslutilities/wslu/overview/develop) | +| Testing | AppVeyor | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/master?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/master) | [![Build status](https://ci.appveyor.com/api/projects/status/gcttf7igb0s40xak/branch/develop?svg=true)](https://ci.appveyor.com/project/patrick330602/wslu/branch/develop) | +| Deployment | CircleCI | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/master)](https://circleci.com/gh/wslutilities/wslu/tree/master) | [![CircleCI](https://img.shields.io/circleci/build/gh/wslutilities/wslu/develop)](https://circleci.com/gh/wslutilities/wslu/tree/develop) | + + ## Installation -### WLinux/Fedora Remix +### Pengwin/Fedora Remix Preinstalled in WLinux and Fedora Remix for WSL. -### For Debian-based systems(Ubuntu/Debian/Kali Linux) +### Ubuntu + +Preinstalled in the latest apps. On older installations please install ubuntu-wsl that depends on wslu: + +``` +sudo apt update +sudo apt install ubuntu-wsl +``` + +### For other Debian-based systems(Debian/Kali Linux) You can download the `.deb` package from release and install it using `sudo dpkg -i wslu*`. -#### Ubuntu/Debian +#### Debian You can use the following command for easy installation: @@ -57,7 +74,7 @@ curl -s https://packagecloud.io/install/repositories/whitewaterfoundry/wslu/script.deb.sh | sudo bash ``` -### For RPM-based systems(OpenSUSE/SLES/WLinux Enterprise) +### For RPM-based systems(OpenSUSE/SLES/Pengwin Enterprise/Oracle Linux) You can use the following command for easy installation: @@ -94,4 +111,14 @@ This project uses [GPLv3](LICENSE) License. +Logo of WSL Utilities is licensed under [CC BY-NC 4.0 International License](http://creativecommons.org/licenses/by-nc/4.0/). + +### Assets + Tux logo used in `\src\etc\wsl.ico` was originally made by Larry Ewing in the Gimp and re-illustrated in vector by Garrett LeSage, using Inkscape. + +Some of `wslfetch` ASCII Arts comes from [`neofetch`](https://github.com/dylanaraps/neofetch/) with [MIT](https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md) License and [`screenFetch`](https://github.com/KittyKatt/screenFetch/) with [GPLv3](https://github.com/KittyKatt/screenFetch/blob/master/COPYING) License. + +Pengwin Logo used in `wslfetch` ASCII art is ASCII version of the artwork by [Dennis D. Bednarz](https://twitter.com/DennisBednarz), with use permission from Whitewater Foundry. + +WLinux Logo used in `wslfetch` ASCII art is ASCII version of the artwork by Larry Ewing. diff -Nru wslu-2.0.0/.shellcheck.yaml wslu-2.3.2/.shellcheck.yaml --- wslu-2.0.0/.shellcheck.yaml 1970-01-01 00:00:00.000000000 +0000 +++ wslu-2.3.2/.shellcheck.yaml 2019-09-23 16:12:26.000000000 +0000 @@ -0,0 +1,4 @@ +ignored: + - SC2148 + - SC2154 + - SC1117 \ No newline at end of file diff -Nru wslu-2.0.0/src/wslfetch.sh wslu-2.3.2/src/wslfetch.sh --- wslu-2.0.0/src/wslfetch.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/src/wslfetch.sh 2019-09-23 16:12:26.000000000 +0000 @@ -1,4 +1,4 @@ -version=38 +version=44 is_line=0 is_splash=0 @@ -6,7 +6,7 @@ for args; do case $args in - -h|--help) help $0 "$help_short"; exit;; + -h|--help) help "$0" "$help_short"; exit;; -v|--version) echo "wslu v$wslu_version; wslfetch v$version"; exit;; -s|--splash) is_splash=1;; -l|--line) is_line=1;; @@ -14,242 +14,271 @@ done hostname=$( @@ -18,77 +18,114 @@ # along with this program. If not, see . # Version -wslu_version=2.0.0 +wslu_version=2.3.2 # Speed up script by not using unicode. LC_ALL=C LANG=C # force bash to not showing code manually. -set +x + # checking interopability -cat /proc/sys/fs/binfmt_misc/WSLInterop | grep enabled >/dev/null || (echo "WSL Interopability is disabled. Please enable it before using WSL."; exit 1) +grep enabled /proc/sys/fs/binfmt_misc/WSLInterop >/dev/null || (echo "WSL Interopability is disabled. Please enable it before using WSL."; exit 1) # variables ## color -black=`echo -e '\e[30m'` -red=`echo -e '\e[31m'` -green=`echo -e '\e[32m'` -brown=`echo -e '\e[33m'` -blue=`echo -e '\e[34m'` -purple=`echo -e '\e[35m'` -cyan=`echo -e '\e[36m'` -yellow=`echo -e '\e[1;33m'` -white=`echo -e '\e[1;37m'` -dark_gray=`echo -e '\e[1;30m'` -light_red=`echo -e '\e[1;31m'` -light_green=`echo -e '\e[1;32m'` -light_blue=`echo -e '\e[1;34m'` -light_purple=`echo -e '\e[1;35m'` -light_cyan=`echo -e '\e[1;36m'` -light_gray=`echo -e '\e[37m'` -orange=`echo -e '\e[38;5;202m'` -light_orange=`echo -e '\e[38;5;214m'` -bold=`echo -e '\033[1m'` -reset=`echo -e '\033(B\033[m'` +black=$(echo -e '\e[30m') +red=$(echo -e '\e[31m') +green=$(echo -e '\e[32m') +brown=$(echo -e '\e[33m') +blue=$(echo -e '\e[34m') +purple=$(echo -e '\e[35m') +cyan=$(echo -e '\e[36m') +yellow=$(echo -e '\e[1;33m') +white=$(echo -e '\e[1;37m') +dark_gray=$(echo -e '\e[1;30m') +light_red=$(echo -e '\e[1;31m') +light_green=$(echo -e '\e[1;32m') +light_blue=$(echo -e '\e[1;34m') +light_purple=$(echo -e '\e[1;35m') +light_cyan=$(echo -e '\e[1;36m') +light_gray=$(echo -e '\e[37m') +orange=$(echo -e '\e[38;5;202m') +light_orange=$(echo -e '\e[38;5;214m') +bold=$(echo -e '\033[1m') +reset=$(echo -e '\033(B\033[m') ## indicator info="${green}[info]${reset}" +input_info="${cyan}[input]${reset}" error="${red}[error]${reset}" warn="${orange}[warn]${reset}" debug="${orange}${bold}[debug]${reset}" +## Windows build number constant +readonly BN_SPR_CREATORS=15063 #1703, Redstone 2, Creators Update +readonly BN_FAL_CREATORS=16299 #1709, Redstone 3, Fall Creators Update +readonly BN_APR_EIGHTEEN=17134 #1803, Redstone 4, April 2018 Update +readonly BN_OCT_EIGHTEEN=17763 #1809, Redstone 5, October 2018 Update +readonly BN_MAY_NINETEEN=18362 #1903, 19H1, May 2019 Update + # functions function help { - echo -e "`basename "$1"` - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux + app_name=$(basename "$1") + echo -e "$app_name - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux Usage: $2 -For more help for `basename "$1"`, visit the following site: https://github.com/wslutilities/wslu/wiki/`basename "$1"`" +For more help for $app_name, visit the following site: https://github.com/wslutilities/wslu/wiki/$app_name" } function double_dash_p { - echo "$(echo $@ | sed -e 's|\\|\\\\|g')" + echo "${@//\\/\\\\}" } function interop_prefix { if [ -f /etc/wsl.conf ]; then - tmp=$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf) + tmp=$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}') if [ "$tmp" == "" ]; then echo "/mnt/" else - echo $tmp + echo "$tmp" fi else echo "/mnt/" fi } +function chcp_com { + "$(interop_prefix)"c/Windows/System32/chcp.com "$@" >/dev/null +} + function winps_exec { - $(interop_prefix)c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -Command $@ + chcp_com $(cat ~/.config/wslu/oemcp) + "$(interop_prefix)"c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive -Command "$@" + chcp_com 65001 } +# first run, saving some information +if [ ! -d ~/.config/wslu ]; then + mkdir -p ~/.config/wslu +fi +if [ ! -f ~/.config/wslu/oemcp ]; then + "$(interop_prefix)"c/Windows/System32/reg.exe query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage" /v OEMCP 2>&1 | sed -n 3p | sed -e 's|\r||g' | grep -o '[[:digit:]]*' > ~/.config/wslu/oemcp +fi + +if [ ! -f ~/.config/wslu/baseexec ]; then + wslutmpbuild=$(reg.exe query "HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion" /v CurrentBuild | tail -n 2 | head -n 1 | sed -e 's|\r||g') + wslutmpbuild=${wslutmpbuild##* } + wslutmpbuild="$(( $wslutmpbuild + 0 ))" + if [ $wslutmpbuild -ge $BN_MAY_NINETEEN ]; then + wslu_distro_regpath=$("$(interop_prefix)"c/Windows/System32/reg.exe query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Lxss" /s /f DistributionName 2>&1 | grep -B1 -e "$WSL_DISTRO_NAME" | head -n1 | sed -e 's|\r||g') + wslu_distro_packagename=$($(interop_prefix)c/Windows/System32/reg.exe query "$wslu_distro_regpath" /v PackageFamilyName | tail -n 2 | head -n 1 | sed -e 's|\r||g') + wslu_distro_packagename=${wslu_distro_packagename##* } + find $(wslpath "$(double_dash_p $(winps_exec "Write-Output \$Env:LOCALAPPDATA" | tr -d "\r"))\\Microsoft\\WindowsApps\\$wslu_distro_packagename") -name "*.exe" > ~/.config/wslu/baseexec + else + echo "$(wslpath "C:\\Windows\\System32\\wsl.exe")" > ~/.config/wslu/baseexec + fi +fi + # when --debug, debug. if [ "$1" == "--debug" ]; then echo "${debug}Debug Mode Enabled." @@ -97,18 +134,20 @@ fi # basic distro detection -distro="$(cat /etc/os-release | head -n1 | sed -e 's/NAME=\"//g')" +distro="$(head -n1 /etc/os-release | sed -e 's/NAME=\"//g')" case $distro in - *WLinux*) distro="wlinux";; - Ubuntu*) distro="ubuntu";; - *Debian*) distro="debian";; - *Kali*) distro="kali";; - openSUSE*) distro="opensuse";; - SLES*) distro="sles";; - Alpine*) distro="alpine";; - Arch*) distro="archlinux";; - Scientific*) distro="scilinux";; - *Fedora*) distro="fedora";; - *Generic*) [ "fedora" == "$(cat /etc/os-release | grep -e "LIKE=" | sed -e 's/ID_LIKE=//g')" ] && distro="fedora" || distro="unknown";; - *) distro="unknown";; + *Pengwin*) distro="pengwin";; + *WLinux*) distro="wlinux";; + Ubuntu*) distro="ubuntu";; + *Debian*) distro="debian";; + *Kali*) distro="kali";; + openSUSE*) distro="opensuse";; + SLES*) distro="sles";; + Alpine*) distro="alpine";; + Arch*) distro="archlinux";; + *Oracle*) distro="oracle";; + Scientific*) distro="scilinux";; + *Fedora*) distro="fedora";; + *Generic*) [ "fedora" == "$(grep -e "LIKE=" /etc/os-release | sed -e 's/ID_LIKE=//g')" ] && distro="oldfedora" || distro="unknown";; + *) distro="unknown";; esac diff -Nru wslu-2.0.0/src/wslupath.sh wslu-2.3.2/src/wslupath.sh --- wslu-2.0.0/src/wslupath.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/src/wslupath.sh 2019-09-23 16:12:26.000000000 +0000 @@ -11,31 +11,31 @@ help_short="wslupath (-dOr) [-D|-A|-T|-S|-W|-s|-su|-H|-P|...NAME...]\nwslupath (-h|-v|-R)" function path_double_dash { - new_path="$(echo $@ | sed -e 's|\\|\\\\|g')" - echo $new_path + new_path="${*//\\/\\\\}" + echo "$new_path" } function general_converter { - target="$@" + target="$*" if [[ $target =~ ^[A-Z]:(\\[^:\\]+)*(\\)?$ ]]; then p=$(wslpath -u "${target}") elif [[ $target =~ ^$(interop_prefix)[A-Za-z](/[^/]+)*(/)?$ ]]; then p=$(wslpath -w "${target}") else - echo "${error} No proper path form detected: $@." + echo "${error} No proper path form detected: ""$*""." exit 20 fi - echo $p + echo "$p" } function style_path { case $style in - 1)p="$(general_converter $@)";; - 2)p="$@";; - 3)p="$(path_double_dash $@)";; + 1)p="$(general_converter "$@")";; + 2)p="$*";; + 3)p="$(path_double_dash "$@")";; esac - echo $p + echo "$p" } if [[ $# -eq 0 ]]; then @@ -51,42 +51,42 @@ ## system location -D|--desktop) - set_path="$(style_path $(wslvar -l 'Desktop'))" + set_path="$(style_path "$(wslvar -l 'Desktop')")" break;; -A|--appdata) - set_path="$(style_path $(wslvar -s APPDATA))" + set_path="$(style_path "$(wslvar -s APPDATA)")" break;; -T|--temp) - set_path="$(style_path $(wslvar -s TMP))" + set_path="$(style_path "$(wslvar -s TMP)")" break;; -S|--sysdir) - set_path="$(style_path $(wslvar -s windir)\\System32)" + set_path="$(style_path "$(wslvar -s windir)"\\System32)" break;; -W|--windir) - set_path="$(style_path $(wslvar -s windir))" + set_path="$(style_path "$(wslvar -s windir)")" break;; -s|--start-menu) - set_path="$(style_path $(wslvar -l 'Start Menu'))" + set_path="$(style_path "$(wslvar -l 'Start Menu')")" break;; -su|--startup) - set_path="$(style_path $(wslvar -l 'Startup'))" + set_path="$(style_path "$(wslvar -l 'Startup')")" break;; -H|--home) - set_path="$(style_path $(wslvar HOMEDRIVE)$(wslvar HOMEPATH))" + set_path="$(style_path "$(wslvar HOMEDRIVE)""$(wslvar HOMEPATH)")" break;; -P|--program-files) - set_path="$(style_path $(wslvar -s ProgramFiles))" + set_path="$(style_path "$(wslvar -s ProgramFiles)")" break;; - -h|--help) help $0 "$help_short"; exit;; + -h|--help) help "$0" "$help_short"; exit;; -v|--version)echo "wslu v$wslu_version; wslupath v$version"; exit;; -R|--avail-reg) echo "Available registery input:" wslvar -L exit;; *) if [[ "$reg_path" == "1" ]]; then - set_path="$(style_path $(wslvar -l $args))" + set_path="$(style_path "$(wslvar -l "$args")")" else - set_path="$(style_path $args)" + set_path="$(style_path "$args")" fi break;; esac @@ -97,5 +97,5 @@ echo "${error}No path input. Aborted." exit 21 else - echo $set_path + echo "$set_path" fi diff -Nru wslu-2.0.0/src/wslusc.sh wslu-2.3.2/src/wslusc.sh --- wslu-2.0.0/src/wslusc.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/src/wslusc.sh 2019-09-23 16:12:26.000000000 +0000 @@ -1,77 +1,110 @@ -version="28" +version="37" cname="" -iconpath="$(double_dash_p $(wslvar -s USERPROFILE))\\wslu\\wsl.ico" -is_icon=0 +iconpath="" is_gui=0 +is_interactive=0 customname="" customenv="" -help_short="wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--help|--version) [COMMAND]" +help_short="wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--interactive|--help|--version) [COMMAND]" while [ "$1" != "" ]; do case "$1" in - -i|--icon)shift;is_icon=1;iconpath=$1;shift;; + -I|--interactive)is_interactive=1;shift;; + -i|--icon)shift;iconpath=$1;shift;; -n|--name)shift;customname=$1;shift;; -e|--env)shift;customenv=$1;shift;; -g|--gui)is_gui=1;shift;; - -h|--help) help $0 "$help_short"; exit;; + -h|--help) help "$0" "$help_short"; exit;; -v|--version) echo "wslu v$wslu_version; wslusc v$version"; exit;; - *) cname=$@;break;; + *) cname="$*";break;; esac done + +# interactive mode +if [[ $is_interactive -eq 1 ]]; then + echo "${info} Welcome to wslu shortcut creator interactive mode." + read -r -e -i "$cname" -p "${input_info} Command to execute: " input + cname="${input:-$cname}" + read -r -e -i "$customname" -p "${input_info} Shortcut name [optional, ENTER for default]: " input + customname="${input:-$customname}" + read -r -e -i "$is_gui" -p "${input_info} Is it a GUI application? [if yes, input 1; if no, input 0]: " input + is_gui=$(( ${input:-$is_gui} + 0 )) + read -r -e -i "$customenv" -p "${input_info} Pre-executed command [optional, ENTER for default]: " input + customenv="${input:-$customenv}" + read -r -e -i "$iconpath" -p "${input_info} Custom icon Linux path (support ico/png/xpm/svg) [optional, ENTER for default]: " input + iconpath="${input:-$iconpath}" +fi + if [[ "$cname" != "" ]]; then - tpath=$(double_dash_p $(wslvar -s TMP)) - dpath=$(wslpath $(wslvar -l Desktop)) - script_location="$(wslpath $(wslvar -s USERPROFILE))/wslu" - localfile_path="/usr/share/wslu" - script_location_win="$(double_dash_p $(wslvar -s USERPROFILE))\\wslu" - - new_cname=$(basename $(echo "$cname" | awk '{print $1}')) + tpath=$(double_dash_p "$(wslvar -s TMP)") # Windows Temp, Win Double Sty. + dpath=$(wslpath "$(wslvar -l Desktop)") # Windows Desktop, Win Sty. + script_location="$(wslpath "$(wslvar -s USERPROFILE)")/wslu" # Windows wslu, Linux WSL Sty. + localfile_path="/usr/share/wslu" # WSL wslu source file location, Linux Sty. + script_location_win="$(double_dash_p "$(wslvar -s USERPROFILE)")\\wslu" # Windows wslu, Win Double Sty. + distro_location_win="$(double_dash_p "$(wslpath -w "$(cat ~/.config/wslu/baseexec)")")" # Distro Location, Win Double Sty. + + # change param according to the exec. + distro_param="run" + if [[ $distro_location_win == *wsl.exe ]]; then + distro_param="-e" + fi + + # handling no name given case + new_cname=$(basename "$(echo "$cname" | awk '{print $1}')") + # handling name given case if [[ "$customname" != "" ]]; then new_cname=$customname fi - + # Check default icon location if [[ ! -f $script_location/wsl.ico ]]; then echo "${warn} Default wslusc icon \"wsl.ico\" not found in Windows directory. Copying right now..." - [[ -d $script_location ]] || mkdir $script_location - if [[ $localfile_path/wsl.ico ]]; then - cp $localfile_path/wsl.ico $script_location - echo "${info} Default wslusc icon \"wsl.ico\" copied. Located at $script_location." + [[ -d $script_location ]] || mkdir "$script_location" + if [[ -f $localfile_path/wsl.ico ]]; then + cp "$localfile_path"/wsl.ico "$script_location" + echo "${info} Default wslusc icon \"wsl.ico\" copied. Located at \"$script_location\"." else - echo "${error} runHidden.vbs not found. Failed to copy." + echo "${error} wsl.ico not found. Failed to copy." exit 30 fi fi # Check presence of runHidden.vbs if [[ ! -f $script_location/runHidden.vbs ]]; then echo "${warn} runHidden.vbs not found in Windows directory. Copying right now..." - [[ -d $script_location ]] || mkdir $script_location + [[ -d $script_location ]] || mkdir "$script_location" if [[ -f $localfile_path/runHidden.vbs ]]; then - cp $localfile_path/runHidden.vbs $script_location - echo "${info} runHidden.vbs copied. Located at $script_location." + cp "$localfile_path"/runHidden.vbs "$script_location" + echo "${info} runHidden.vbs copied. Located at \"$script_location\"." else echo "${error} runHidden.vbs not found. Failed to copy." exit 30 fi fi - if [[ "$is_icon" == "1" ]]; then - icon_filename="$(basename $iconpath)" + # handling icon + if [[ "$iconpath" != "" ]]; then + icon_filename="$(basename "$iconpath")" ext="${iconpath##*.}" if [[ ! -f $iconpath ]]; then - iconpath="$(double_dash_p $(wslvar -s USERPROFILE))\\wslu\\wsl.ico" + iconpath="$(double_dash_p "$(wslvar -s USERPROFILE)")\\wslu\\wsl.ico" echo "${warn} Icon not found. Reset to default icon..." else echo "${info} You choose to use custom icon: $iconpath. Processing..." - cp $iconpath $script_location + cp "$iconpath" "$script_location" if [[ "$ext" != "ico" ]]; then - if [[ "$ext" == "svg" ]] || [[ "$ext" == "png" ]]; then + if [[ "$ext" == "svg" ]]; then + echo "${info} Converting $ext icon to ico..." + convert "$script_location/$icon_filename" -trim -background none -resize 256X256 -define 'icon:auto-resize=16,24,32,64,128,256' "$script_location/${icon_filename%.$ext}.ico" + rm "$script_location/$icon_filename" + icon_filename="${icon_filename%.$ext}.ico" + elif [[ "$ext" == "png" ]] || [[ "$ext" == "xpm" ]]; then echo "${info} Converting $ext icon to ico..." convert "$script_location/$icon_filename" -resize 256X256 "$script_location/${icon_filename%.$ext}.ico" + rm "$script_location/$icon_filename" icon_filename="${icon_filename%.$ext}.ico" else echo "${error} wslusc only support creating shortcut using .png/.svg/.ico icon. Aborted." @@ -80,18 +113,21 @@ fi iconpath="$script_location_win\\$icon_filename" fi + else + iconpath="$(double_dash_p "$(wslvar -s USERPROFILE)")\\wslu\\wsl.ico" fi + # handling custom vairable command if [[ "$customenv" != "" ]]; then echo "${info} the following custom variable/command will be applied: $customenv" fi if [[ "$is_gui" == "1" ]]; then - winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs bash.exe -c \"cd ~; export DISPLAY=:0; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" + winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\wscript.exe';\$s.Arguments='$script_location_win\\runHidden.vbs $distro_location_win $distro_param \"cd ~; export DISPLAY=:0; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" else - winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='C:\\Windows\\System32\\bash.exe';\$s.Arguments='-c \"cd ~; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" + winps_exec "Import-Module 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Utility\\Microsoft.PowerShell.Utility.psd1';\$s=(New-Object -COM WScript.Shell).CreateShortcut('$tpath\\$new_cname.lnk');\$s.TargetPath='$distro_location_win';\$s.Arguments='$distro_param \"cd ~; $customenv $cname\"';\$s.IconLocation='$iconpath';\$s.Save();" fi - tpath="$(wslpath $(wslvar -s TMP))/$new_cname.lnk" + tpath="$(wslpath "$(wslvar -s TMP)")/$new_cname.lnk" mv "$tpath" "$dpath" echo "${info} Create shortcut ${new_cname}.lnk successful" else diff -Nru wslu-2.0.0/src/wslvar.sh wslu-2.3.2/src/wslvar.sh --- wslu-2.0.0/src/wslvar.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/src/wslvar.sh 2019-09-23 16:12:26.000000000 +0000 @@ -5,7 +5,7 @@ help_short="wslvar (--sys|--shell) [NAME]\nwslvar (--help|--version|--getsys|--getshell)" function call_shell { - winps_exec "(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders').'$@'" | cat + winps_exec "(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders').'$*'" | cat } function view_shell { @@ -13,7 +13,7 @@ } function call_sys { - winps_exec "Write-Output \$Env:$@" | cat + winps_exec "Write-Output \$Env:$*" | cat } function view_sys { @@ -25,13 +25,13 @@ } function caller { - if [ "$@" != "" ]; then + if [ "$*" != "" ]; then case $var_type in - 1) p="$(cl_destoryer $(call_sys $@))";; - 2) p="$(cl_destoryer $(call_shell $@))";; + 1) p="$(cl_destoryer "$(call_sys "$@")")";; + 2) p="$(cl_destoryer "$(call_shell "$@")")";; *) echo "${error}Invalid variable type. Aborted."; exit 22;; esac - echo $p + echo "$p" else echo "${error} No Input. Aborted." exit 21 @@ -44,7 +44,7 @@ -l|--shell) var_type=2; shift;; -S|--getsys) view_sys; exit;; -L|--getshell) view_shell; exit;; - -h|--help) help $0 "$help_short"; exit;; + -h|--help) help "$0" "$help_short"; exit;; -v|--version) echo "wslu v$wslu_version; wslvar v$version"; exit;; *) caller "$@"; exit;; esac diff -Nru wslu-2.0.0/src/wslview.sh wslu-2.3.2/src/wslview.sh --- wslu-2.0.0/src/wslview.sh 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/src/wslview.sh 2019-09-23 16:12:26.000000000 +0000 @@ -1,4 +1,4 @@ -version="05" +version="06" lname="" @@ -30,14 +30,23 @@ case $args in -r|--register) add_reg_alt;; -u|--unregister) del_reg_alt;; - -h|--help) help $0 "$help_short"; exit;; + -h|--help) help "$0" "$help_short"; exit;; -v|--version) echo "wslu v$wslu_version; wslview v$version"; exit;; *) lname="$lname$args";; esac done if [[ "$lname" != "" ]]; then - winps_exec Start "$lname" + #if [[ "$lname" =~ file:///* ]]; then + # if [[ "$WSL_DISTRO_NAME" != "" ]]; then + # echo "do something" + # else + # echo "${error} This protocol is not supported before version 1903." + # exit 34 + # fi + #else + winps_exec Start "\"$lname\"" + #fi else echo "${error}No input, aborting" exit 21 diff -Nru wslu-2.0.0/tests/wslsys.bats wslu-2.3.2/tests/wslsys.bats --- wslu-2.0.0/tests/wslsys.bats 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/tests/wslsys.bats 2019-09-23 16:12:26.000000000 +0000 @@ -9,11 +9,11 @@ @test "wslsys - Help" { run out/wslsys --help [ "${lines[0]}" = "wslsys - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux" ] - [ "${lines[1]}" = "Usage: wslsys (-h|-v|-S|-U|-b|-B|-fB|-R|-K|-P) -s" ] + [ "${lines[1]}" = "Usage: wslsys (-h|-v|-I|-b|-B|-fB|-U|-R|-K|-P) -s" ] } @test "wslsys - Help - Alt." { run out/wslsys -h [ "${lines[0]}" = "wslsys - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux" ] - [ "${lines[1]}" = "Usage: wslsys (-h|-v|-S|-U|-b|-B|-fB|-R|-K|-P) -s" ] + [ "${lines[1]}" = "Usage: wslsys (-h|-v|-I|-b|-B|-fB|-U|-R|-K|-P) -s" ] } diff -Nru wslu-2.0.0/tests/wslupath.bats wslu-2.3.2/tests/wslupath.bats --- wslu-2.0.0/tests/wslupath.bats 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/tests/wslupath.bats 2019-09-23 16:12:26.000000000 +0000 @@ -43,7 +43,7 @@ @test "wslupath - No parameter - Linux DirPath" { run out/wslupath "/mnt/c/Windows" - [ "${lines[0]}" = "c:\\Windows" ] + [ "${lines[0]}" = "C:\\Windows" ] } @test "wslupath - /w DoubleDash - Windows Double DirPath" { diff -Nru wslu-2.0.0/tests/wslusc.bats wslu-2.3.2/tests/wslusc.bats --- wslu-2.0.0/tests/wslusc.bats 2019-03-15 15:30:18.000000000 +0000 +++ wslu-2.3.2/tests/wslusc.bats 2019-09-23 16:12:26.000000000 +0000 @@ -17,13 +17,13 @@ @test "wslusc - Help" { run out/wslusc --help [ "${lines[0]}" = "wslusc - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux" ] - [ "${lines[1]}" = "Usage: wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--help|--version) [COMMAND]" ] + [ "${lines[1]}" = "Usage: wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--interactive|--help|--version) [COMMAND]" ] } @test "wslusc - Help - Alt." { run out/wslusc -h [ "${lines[0]}" = "wslusc - Part of wslu, a collection of utilities for Windows 10 Windows Subsystem for Linux" ] - [ "${lines[1]}" = "Usage: wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--help|--version) [COMMAND]" ] + [ "${lines[1]}" = "Usage: wslusc (--env [PATH]|--name [NAME]|--icon [ICO FILE]|--gui|--interactive|--help|--version) [COMMAND]" ] } @test "wslusc - without GUI" {