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 diff --git a/VERSION b/VERSION index 23c200d7..947f1e0b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.1-3 \ No newline at end of file +3.2.2-1 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 diff --git a/src/etc/wslusc-helper.sh b/src/etc/wslusc-helper.sh index fb15c955..833c5a09 100644 --- a/src/etc/wslusc-helper.sh +++ b/src/etc/wslusc-helper.sh @@ -18,67 +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) 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 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