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
34
34
delete_log
35
35
detect_existing_instance
36
36
get_os_information
37
+ wsl2_requirements
37
38
detect_cpu_instructions
38
39
is_raspeberrypi_soc
39
40
detect_sound
Original file line number Diff line number Diff line change @@ -7,9 +7,14 @@ function setup() {
7
7
load ../../utils/common.sh
8
8
LOG_FILE=/tmp/ovos-installer.log
9
9
OS_RELEASE=/tmp/os-release
10
+ WSL_FILE=/tmp/wsl.conf
10
11
cat << EOF >"$OS_RELEASE "
11
12
VERSION="39 (Workstation Edition)"
12
13
ID=fedora
14
+ EOF
15
+ cat << EOF >"$WSL_FILE "
16
+ [boot]
17
+ systemd=true
13
18
EOF
14
19
}
15
20
54
59
unset uname
55
60
}
56
61
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
+
57
76
function teardown() {
58
- rm -f " $OS_RELEASE " " $LOG_FILE "
77
+ rm -f " $OS_RELEASE " " $LOG_FILE " " $WSL_FILE "
59
78
}
Original file line number Diff line number Diff line change @@ -298,3 +298,16 @@ function in_array() {
298
298
echo " $needle is an unsupported option" & >> " $LOG_FILE "
299
299
on_error
300
300
}
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
39
39
export SCENARIO_NAME=" scenario.yaml"
40
40
export SCENARIO_PATH=" "
41
41
export USER_ID=" $EUID "
42
+ export WSL_FILE=/etc/wsl.conf
42
43
export YQ_BINARY_PATH=/tmp/yq
43
44
export YQ_URL=" https://github.com/mikefarah/yq/releases/download/v4.40.3"
You can’t perform that action at this time.
0 commit comments