From c783371ecca7cab75f1efb444539af778dcc9e07 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Mon, 18 Jan 2021 20:12:01 +0800 Subject: [PATCH 1/7] wslview: fix an interesting relative path issue fixes #165 --- src/wslview.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wslview.sh b/src/wslview.sh index 9668a4c3..89ed5887 100644 --- a/src/wslview.sh +++ b/src/wslview.sh @@ -46,6 +46,7 @@ if [[ "$lname" != "" ]]; then converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}" [[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")" lname="$converted_file_path" + # Linux absolute path elif [[ "$lname" =~ ^(/[^/]+)*(/)?$ ]]; then [ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34 properfile_full_path="$(readlink -f "${lname}")" @@ -53,6 +54,14 @@ if [[ "$lname" != "" ]]; then converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}" [[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")" lname="$converted_file_path" + # Linux relative path + elif [[ -d "$(readlink -f "$lname")" ]] || [[ -f "$(readlink -f "$lname")" ]]; then + [ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34 + properfile_full_path="$(readlink -f "${lname}")" + interop_win_type="$(interop_prefix)$(sysdrive_prefix)" + converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}" + [[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")" + lname="$converted_file_path" fi winps_exec Start "\"$lname\"" else From 08f1a0ff41e580e59329edb5a74524b9b8eb4294 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Mon, 18 Jan 2021 22:25:22 +0800 Subject: [PATCH 2/7] header: experimental fix; possibly not working --- src/wslu-header | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wslu-header b/src/wslu-header index fa88fb31..0f8363c8 100644 --- a/src/wslu-header +++ b/src/wslu-header @@ -150,8 +150,10 @@ function chcp_com { } function winps_exec { - chcp_com "$(cat ~/.config/wslu/oemcp)" - "$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive –ExecutionPolicy Bypass -Command "$@" + cp="$(cat ~/.config/wslu/oemcp)" + chcp_com "$cp" + cp=$(($cp+0)) + "$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive –ExecutionPolicy Bypass -Command "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding($cp); $@" EXIT_STATUS=$? chcp_com 65001 return $EXIT_STATUS From a7d941b64bd8d6108004a4bfb649597a9355c366 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Thu, 18 Feb 2021 22:20:03 +0800 Subject: [PATCH 3/7] docs: updating wslu.7 with aval. cmds (fixes #169) --- docs/wslu.7 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/wslu.7 b/docs/wslu.7 index fa2790ac..685d9405 100644 --- a/docs/wslu.7 +++ b/docs/wslu.7 @@ -4,6 +4,10 @@ - a collection of utilities for Windows 10 Linux Subsystem .SH DESCRIPTION This is a collection of utilities for Windows 10 Linux Subsystem, such as enabling sound in WSL or creating your favorite linux app shortcuts on Windows 10 Desktop. Requires Windows 10 Creators Update and higher. Some features require Windows 10 May 2019 Update or later. +.SH AVAILABLE COMMANDS +wslusc, wslsys, wslfetch, wslvar, wslview(wview/wslstart/wstart), wslupath(deprecated), wslact +.PP +check each manpage to see the detailed usage. .SH SUPPORTED DISTRIBUTION .nf - Debian GNU/Linux From db76437610d97c8179fdcb5a2587e095075d1eb2 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Thu, 18 Feb 2021 22:36:29 +0800 Subject: [PATCH 4/7] wslusc: helper update testing --- src/etc/wslusc-helper.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/etc/wslusc-helper.sh b/src/etc/wslusc-helper.sh index fb15c955..ee225b6a 100644 --- a/src/etc/wslusc-helper.sh +++ b/src/etc/wslusc-helper.sh @@ -57,23 +57,25 @@ function sysdrive_prefix { if [[ -n $WSL_INTEROP ]]; then # enable external x display for WSL 2 - if ( command -v ipconfig.exe &>/dev/null ); then ipconfig_exec=$(command -v ipconfig.exe) else ipconfig_exec="$(interop_prefix)$(sysdrive_prefix)/Windows/System32/ipconfig.exe" fi - if ( eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1 ) >/dev/null; then - set +H - wsl2_d_tmp="$(eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1)" - wsl2_d_tmp="$(eval "$ipconfig_exec" | sed $(( wsl2_d_tmp - 4 ))','$(( wsl2_d_tmp + 0 ))'!d' | grep IPv4 | cut -d : -f 2 | sed -e "s|\s||g" -e "s|\r||g")" - set -H - export DISPLAY=${wsl2_d_tmp}:0.0 - else - wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')" - export DISPLAY=${wsl2_d_tmp}:0 - fi +# if ( eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1 ) >/dev/null; then +# set +H +# wsl2_d_tmp="$(eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1)" +# wsl2_d_tmp="$(eval "$ipconfig_exec" | sed $(( wsl2_d_tmp - 4 ))','$(( wsl2_d_tmp + 0 ))'!d' | grep IPv4 | cut -d : -f 2 | sed -e "s|\s||g" -e "s|\r||g")" +# set -H +# export DISPLAY=${wsl2_d_tmp}:0.0 +# else +# wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')" +# export DISPLAY=${wsl2_d_tmp}:0 +# fi + + wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')" + export DISPLAY=${wsl2_d_tmp}:0 unset wsl2_d_tmp unset ipconfig_exec From 9141fd9483e6385bcd28481a65ed8a737a57755e Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Thu, 18 Feb 2021 22:53:24 +0800 Subject: [PATCH 5/7] wslusc: reduce advance detection (fixes #174) --- src/etc/wslusc-helper.sh | 57 +--------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/src/etc/wslusc-helper.sh b/src/etc/wslusc-helper.sh index ee225b6a..833c5a09 100644 --- a/src/etc/wslusc-helper.sh +++ b/src/etc/wslusc-helper.sh @@ -18,69 +18,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -function interop_prefix { - - win_location="/mnt/" - if [ -f /etc/wsl.conf ]; then - tmp="$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')" - [ "$tmp" == "" ] || win_location="$tmp" - unset tmp - fi - echo "$win_location" - - unset win_location -} - -function sysdrive_prefix { - win_location="$(interop_prefix)" - hard_reset=0 - for pt in $(ls "$win_location"); do - if [ $(echo "$pt" | wc -l) -eq 1 ]; then - if [ -d "$win_location$pt/Windows/System32" ]; then - hard_reset=1 - win_location="$pt" - break - fi - fi - done - - if [ $hard_reset -eq 0 ]; then - win_location="c" - fi - - echo "$win_location" - - unset win_location - unset hard_reset -} - if [[ -n $WSL_INTEROP ]]; then # enable external x display for WSL 2 - - if ( command -v ipconfig.exe &>/dev/null ); then - ipconfig_exec=$(command -v ipconfig.exe) - else - ipconfig_exec="$(interop_prefix)$(sysdrive_prefix)/Windows/System32/ipconfig.exe" - fi - -# if ( eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1 ) >/dev/null; then -# set +H -# wsl2_d_tmp="$(eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1)" -# wsl2_d_tmp="$(eval "$ipconfig_exec" | sed $(( wsl2_d_tmp - 4 ))','$(( wsl2_d_tmp + 0 ))'!d' | grep IPv4 | cut -d : -f 2 | sed -e "s|\s||g" -e "s|\r||g")" -# set -H -# export DISPLAY=${wsl2_d_tmp}:0.0 -# else -# wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')" -# export DISPLAY=${wsl2_d_tmp}:0 -# fi - wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')" export DISPLAY=${wsl2_d_tmp}:0 unset wsl2_d_tmp - unset ipconfig_exec else - export DISPLAY=:0 + export DISPLAY=:0 fi win_sys_scaling=$(wslsys -S -s) From b455a7b6ad1643152d7bb828daf7f5e868390692 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Sun, 28 Feb 2021 19:46:52 +0800 Subject: [PATCH 6/7] tests: removal of bats suite --- .gitmodules | 3 --- Makefile | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ee4c75f7..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "extras/bats"] - path = extras/bats - url = https://github.com/bats-core/bats-core.git diff --git a/Makefile b/Makefile index 8a714110..3a9a6438 100644 --- a/Makefile +++ b/Makefile @@ -66,4 +66,4 @@ clean: rm -rf $(OUTMANPATH) test: - extras/bats/bin/bats -r tests + bats -r tests From 08e2fdff91c6e98cd5e383e5bb3398e07d1f96f7 Mon Sep 17 00:00:00 2001 From: "Jinming Wu, Patrick" Date: Sun, 28 Feb 2021 19:49:24 +0800 Subject: [PATCH 7/7] Increase version 3.2.2 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8f5fc5fa..947f1e0b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.1-1 \ No newline at end of file +3.2.2-1