Rev 29 | Rev 31 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 29 | Rev 30 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | rem // alright, this distribution is on WSL2 |
55 | rem // alright, this distribution is on WSL2 |
56 | ) |
56 | ) |
57 | echo ok |
57 | echo ok |
58 | 58 | ||
59 | rem // make sure we have the required tools, install them if not |
59 | rem // make sure we have the required tools, install them if not |
60 | set |
60 | set ETC_SUDOERS_PATCHED=0 |
61 | for %%i in (%REQUIRED_TOOLS%) do ( |
61 | for %%i in (%REQUIRED_TOOLS%) do ( |
62 | rem // tool syntax: "<executable>:<optional APT package name>" |
62 | rem // tool syntax: "<executable>:<optional APT package name>" |
63 | rem // if package name is not specified, it defaults to <executable> |
63 | rem // if package name is not specified, it defaults to <executable> |
64 | set REQUIRED_TOOL_AND_PACKAGE=%%i |
64 | set REQUIRED_TOOL_AND_PACKAGE=%%i |
65 | for /f "tokens=1-2 delims=:" %%j in ('echo !REQUIRED_TOOL_AND_PACKAGE!') do ( |
65 | for /f "tokens=1-2 delims=:" %%j in ('echo !REQUIRED_TOOL_AND_PACKAGE!') do ( |
Line 71... | Line 71... | ||
71 | wsl --distribution %WSL_DISTR% -- !REQUIRED_TOOL! --version > nul 2>&1 && ( |
71 | wsl --distribution %WSL_DISTR% -- !REQUIRED_TOOL! --version > nul 2>&1 && ( |
72 | echo yes |
72 | echo yes |
73 | ) || ( |
73 | ) || ( |
74 | echo no |
74 | echo no |
75 | echo !REQUIRED_TOOL! needs installation. Attempting to install it. |
75 | echo !REQUIRED_TOOL! needs installation. Attempting to install it. |
76 | if "! |
76 | if "!ETC_SUDOERS_PATCHED!"=="0" ( |
77 | rem // allow ourselves to run any commands by patching /etc/sudoers. Do this |
77 | rem // allow ourselves to run any commands by patching /etc/sudoers. Do this once, and only if necessary. |
78 | wsl --distribution %WSL_DISTR% -- sudo sh -c ^"echo '%%sudo ALL=^(ALL^) NOPASSWD:ALL' ^>^> /etc/sudoers^" |
78 | wsl --distribution %WSL_DISTR% -- sudo sh -c ^"grep '%%sudo ALL=^(ALL^) NOPASSWD:ALL' /etc/sudoers ^|^| echo '%%sudo ALL=^(ALL^) NOPASSWD:ALL' ^>^> /etc/sudoers^" |
79 |
|
79 | rem rem // update APT cache before installing stuff, but just once. |
80 |
|
80 | rem wsl --distribution %WSL_DISTR% -- sudo apt-get -y update |
81 | set |
81 | set ETC_SUDOERS_PATCHED=1 |
82 | ) |
82 | ) |
83 |
|
83 | rem wsl --distribution %WSL_DISTR% sudo apt-get -y install !REQUIRED_PACKAGE! || ( |
- | 84 | wsl --distribution %WSL_DISTR% sudo apt-get -y install "../../Third-party software/Ubuntu 22.04 Debian packages for WSL2/!REQUIRED_PACKAGE!.deb" || ( |
|
84 | echo Error: the required Linux tool !REQUIRED_TOOL! can't be installed with apt-get. |
85 | echo Error: the required Linux tool !REQUIRED_TOOL! can't be installed with apt-get. |
85 | pause |
86 | pause |
86 | goto :exit_error |
87 | goto :exit_error |
87 | ) |
88 | ) |
88 | ) |
89 | ) |
Line 163... | Line 164... | ||
163 | goto :exit_error |
164 | goto :exit_error |
164 | ) |
165 | ) |
165 | echo The Windows Subsystem for Linux was successfully installed with the %WSL_DISTR% |
166 | echo The Windows Subsystem for Linux was successfully installed with the %WSL_DISTR% |
166 | echo distribution. |
167 | echo distribution. |
167 | echo Action required: please reboot your computer and run this script again. |
168 | echo Action required: please reboot your computer and run this script again. |
168 | pause |
- | |
169 | goto :exit_success |
169 | goto :exit_success |
170 | 170 | ||
171 | :exit_error |
171 | :exit_error |
172 | rem // failure exit |
172 | rem // failure exit |
173 | pause |
173 | pause |