WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit 70ba606

Browse files
Merge pull request #171 from wslutilities/lts/master
[Release] wslu 3.2.2 LTS
2 parents 190eda6 + ae1d069 commit 70ba606

File tree

7 files changed

+22
-63
lines changed

7 files changed

+22
-63
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ clean:
6666
rm -rf $(OUTMANPATH)
6767

6868
test:
69-
extras/bats/bin/bats -r tests
69+
bats -r tests

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1-3
1+
3.2.2-1

docs/wslu.7

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
- a collection of utilities for Windows 10 Linux Subsystem
55
.SH DESCRIPTION
66
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.
7+
.SH AVAILABLE COMMANDS
8+
wslusc, wslsys, wslfetch, wslvar, wslview(wview/wslstart/wstart), wslupath(deprecated), wslact
9+
.PP
10+
check each manpage to see the detailed usage.
711
.SH SUPPORTED DISTRIBUTION
812
.nf
913
- Debian GNU/Linux

src/etc/wslusc-helper.sh

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,67 +18,14 @@
1818
# You should have received a copy of the GNU General Public License
1919
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2020

21-
function interop_prefix {
22-
23-
win_location="/mnt/"
24-
if [ -f /etc/wsl.conf ]; then
25-
tmp="$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')"
26-
[ "$tmp" == "" ] || win_location="$tmp"
27-
unset tmp
28-
fi
29-
echo "$win_location"
30-
31-
unset win_location
32-
}
33-
34-
function sysdrive_prefix {
35-
win_location="$(interop_prefix)"
36-
hard_reset=0
37-
for pt in $(ls "$win_location"); do
38-
if [ $(echo "$pt" | wc -l) -eq 1 ]; then
39-
if [ -d "$win_location$pt/Windows/System32" ]; then
40-
hard_reset=1
41-
win_location="$pt"
42-
break
43-
fi
44-
fi
45-
done
46-
47-
if [ $hard_reset -eq 0 ]; then
48-
win_location="c"
49-
fi
50-
51-
echo "$win_location"
52-
53-
unset win_location
54-
unset hard_reset
55-
}
56-
5721
if [[ -n $WSL_INTEROP ]]; then
5822
# enable external x display for WSL 2
59-
60-
61-
if ( command -v ipconfig.exe &>/dev/null ); then
62-
ipconfig_exec=$(command -v ipconfig.exe)
63-
else
64-
ipconfig_exec="$(interop_prefix)$(sysdrive_prefix)/Windows/System32/ipconfig.exe"
65-
fi
66-
67-
if ( eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1 ) >/dev/null; then
68-
set +H
69-
wsl2_d_tmp="$(eval "$ipconfig_exec" | grep -n -m 1 "Default Gateway.*: [0-9a-z]" | cut -d : -f 1)"
70-
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")"
71-
set -H
72-
export DISPLAY=${wsl2_d_tmp}:0.0
73-
else
74-
wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')"
75-
export DISPLAY=${wsl2_d_tmp}:0
76-
fi
23+
wsl2_d_tmp="$(grep nameserver /etc/resolv.conf | awk '{print $2}')"
24+
export DISPLAY=${wsl2_d_tmp}:0
7725

7826
unset wsl2_d_tmp
79-
unset ipconfig_exec
8027
else
81-
export DISPLAY=:0
28+
export DISPLAY=:0
8229
fi
8330

8431
win_sys_scaling=$(wslsys -S -s)

src/wslu-header

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ function chcp_com {
150150
}
151151

152152
function winps_exec {
153-
chcp_com "$(cat ~/.config/wslu/oemcp)"
154-
"$(interop_prefix)$(sysdrive_prefix)"/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive –ExecutionPolicy Bypass -Command "$@"
153+
cp="$(cat ~/.config/wslu/oemcp)"
154+
chcp_com "$cp"
155+
cp=$(($cp+0))
156+
"$(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); $@"
155157
EXIT_STATUS=$?
156158
chcp_com 65001
157159
return $EXIT_STATUS

src/wslview.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,22 @@ if [[ "$lname" != "" ]]; then
4646
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
4747
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
4848
lname="$converted_file_path"
49+
# Linux absolute path
4950
elif [[ "$lname" =~ ^(/[^/]+)*(/)?$ ]]; then
5051
[ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
5152
properfile_full_path="$(readlink -f "${lname}")"
5253
interop_win_type="$(interop_prefix)$(sysdrive_prefix)"
5354
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
5455
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
5556
lname="$converted_file_path"
57+
# Linux relative path
58+
elif [[ -d "$(readlink -f "$lname")" ]] || [[ -f "$(readlink -f "$lname")" ]]; then
59+
[ $wslutmpbuild -ge "$BN_MAY_NINETEEN" ] || error_echo "This protocol is not supported before version 1903." 34
60+
properfile_full_path="$(readlink -f "${lname}")"
61+
interop_win_type="$(interop_prefix)$(sysdrive_prefix)"
62+
converted_file_path="\\\\wsl\$\\$WSL_DISTRO_NAME${properfile_full_path//\//\\}"
63+
[[ "$properfile_full_path" =~ ^${interop_win_type//\/$/}.*$ ]] && converted_file_path="$(wslpath -w "$properfile_full_path")"
64+
lname="$converted_file_path"
5665
fi
5766
winps_exec Start "\"$lname\""
5867
else

0 commit comments

Comments
 (0)