File tree Expand file tree Collapse file tree 4 files changed +35
-1
lines changed
Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ detect_user
3434delete_log
3535detect_existing_instance
3636get_os_information
37+ wsl2_requirements
3738detect_cpu_instructions
3839is_raspeberrypi_soc
3940detect_sound
Original file line number Diff line number Diff line change @@ -7,9 +7,14 @@ function setup() {
77 load ../../utils/common.sh
88 LOG_FILE=/tmp/ovos-installer.log
99 OS_RELEASE=/tmp/os-release
10+ WSL_FILE=/tmp/wsl.conf
1011 cat << EOF >"$OS_RELEASE "
1112VERSION="39 (Workstation Edition)"
1213ID=fedora
14+ EOF
15+ cat << EOF >"$WSL_FILE "
16+ [boot]
17+ systemd=true
1318EOF
1419}
1520
5459 unset uname
5560}
5661
62+ @test " function_wsl2_requirements_valid" {
63+ WSL_FILE=/tmp/wsl.conf
64+ KERNEL=" 5.15.133.1-microsoft-standard-WSL2"
65+ run wsl2_requirements
66+ assert_success
67+ }
68+
69+ @test " function_wsl2_requirements_no_valid" {
70+ truncate -s 0 " $WSL_FILE "
71+ KERNEL=" 5.15.133.1-microsoft-standard-WSL2"
72+ run wsl2_requirements
73+ assert_failure
74+ }
75+
5776function teardown() {
58- rm -f " $OS_RELEASE " " $LOG_FILE "
77+ rm -f " $OS_RELEASE " " $LOG_FILE " " $WSL_FILE "
5978}
Original file line number Diff line number Diff line change @@ -298,3 +298,16 @@ function in_array() {
298298 echo " $needle is an unsupported option" & >> " $LOG_FILE "
299299 on_error
300300}
301+
302+ # This function validates basic requirements for Windows WSL2 such as systemd
303+ # handles the boot process, etc...
304+ function wsl2_requirements() {
305+ if [[ " $KERNEL " == * " microsoft" * ]]; then
306+ echo -ne " ➤ Validating WSL2 requirements... "
307+ if ! grep -q " systemd=true" " $WSL_FILE " & >> " $LOG_FILE " ; then
308+ echo " systemd=boot must be added to $WSL_FILE " & >> " $LOG_FILE "
309+ return 1
310+ fi
311+ echo -e " [$done_format ]"
312+ fi
313+ }
Original file line number Diff line number Diff line change @@ -39,5 +39,6 @@ export SCENARIO_ALLOWED_HIVEMIND_OPTIONS
3939export SCENARIO_NAME=" scenario.yaml"
4040export SCENARIO_PATH=" "
4141export USER_ID=" $EUID "
42+ export WSL_FILE=/etc/wsl.conf
4243export YQ_BINARY_PATH=/tmp/yq
4344export YQ_URL=" https://github.com/mikefarah/yq/releases/download/v4.40.3"
You can’t perform that action at this time.
0 commit comments