-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall_files.sh
80 lines (70 loc) · 1.84 KB
/
install_files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
export NAME="debian"
export WSL_DISTRIBUTION="Debian"
# Uncomment next if systemd is used via genie
# export GENIE="genie -c"
# X server settings
export DISPLAY_NUMBER="0.0"
export XSRV="C:\\Program Files\\VcXsrv"
WSL_XSRV=$(wslpath "$XSRV")
WHOME=$(wslpath $(cmd.exe /C "echo %USERPROFILE%") | sed 's/\r//')
TMP="$$"
mkdir -p "$TMP" && cd $TMP
# This is the file that starts the X clients
# Modify this to meet your needs
# It is placed in $HOME
cat >start_$NAME.sh <<+EOF
#!/bin/bash
(
export LIBGL_ALWAYS_INDIRECT=1
export DISPLAY_NUMBER="$DISPLAY_NUMBER"
export DISPLAY=\$(grep -m 1 nameserver /etc/resolv.conf | awk '{print \$2}'):\$DISPLAY_NUMBER
sudo su -c "service dbus start"
startkde
) >> $HOME/.xsession.errors 2>&1
+EOF
# Start using bat
cat >start_$NAME.bat <<+EOF
@echo off
wsl -d $WSL_DISTRIBUTION $GENIE $HOME/start_$NAME.sh
+EOF
# xlaunch file
cat >$NAME.xlaunch <<+EOF
<?xml version="1.0" encoding="UTF-8"?>
<XLaunch
WindowMode="Windowed"
Display="-1"
Wgl="True"
DisableAC="True"
Clipboard="True"
ClipboardPrimary="True"
ClientMode="StartProgram"
LocalClient="True"
LocalProgram="start_$NAME.bat"
RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser=""
XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" XDMCPTerminate="False"
ExtraParams=""
/>
+EOF
# xlaunch bat file
cat >launch_$NAME.bat <<+EOF
@ECHO OFF
CD "$XSRV"
.\\xlaunch.exe -run $NAME.xlaunch
+EOF
# xlaunch sh file
cat >launch_$NAME.sh <<+EOF
#!/bin/bash
cd "$WSL_XSRV"
cmd.exe /c "xlaunch.exe -run $NAME.xlaunch"
+EOF
chmod +x *.sh
test -f "$HOME/start_$NAME.sh" && {
echo "Moving $HOME/start_$NAME.sh to $HOME/start_$NAME.sh.old"
mv $HOME/start_$NAME.sh $HOME/start_$NAME.sh.old
}
mv start_$NAME.sh launch_$NAME.sh "$HOME"
mv launch_$NAME.bat "$WHOME"
mv start_$NAME.bat $NAME.xlaunch "$WSL_XSRV"
cd ..
rm -rf "$TMP"