Remove username from wsl.conf

- This is a cleanup for SystemSetup per DEENG-134 and DEENG-139
- Default user should be set by the WSL launcher.
- Shutdown/reboot actions also.
- Added a structured form of communication between OOBE and launcher.
- /run/launcher-command
This commit is contained in:
Carlos Nihelton 2021-12-14 12:04:38 -03:00
parent baa8465ded
commit bad945f5d7
4 changed files with 18 additions and 19 deletions

View File

@ -28,19 +28,30 @@ validate () {
netplan generate --root .subiquity netplan generate --root .subiquity
elif [ "${mode}" = "system_setup" ]; then elif [ "${mode}" = "system_setup" ]; then
setup_mode="$2" setup_mode="$2"
launcher_cmds=".subiquity/run/launcher-command"
echo "system setup validation for $setup_mode" echo "system setup validation for $setup_mode"
echo "checking launcher-status" echo "checking ${launcher_cmds}"
[ -d ".subiquity/run/subiquity/" ] || (echo "run/subiquity/ dir not created for status"; exit 1) if [ ! -f ${launcher_cmds} ]; then
[ -e ".subiquity/run/subiquity/launcher-status" ] || (echo "run/subiquity/launcher-status not created"; exit 1) echo "Expected launcher commands to be written to the file."
exit 1
elif [ -z "$(grep action ${launcher_cmds})" ] && [ "${setup_mode}" != "autoinstall-no-shutdown" ]; then
echo "Expected action to be set in launcher commands."
exit 1
elif [ -z "$(grep defaultUid ${launcher_cmds})" ] && [ "${setup_mode}" != "answers-reconf" ]; then
echo "Expected defaultUid to be set in launcher commands."
exit 1
else
cat ${launcher_cmds}
fi
expected_status="reboot" expected_status="reboot"
if [ "${setup_mode}" = "autoinstall-full" ]; then if [ "${setup_mode}" = "autoinstall-full" ]; then
expected_status="shutdown" expected_status="shutdown"
elif [ "${setup_mode}" = "autoinstall-no-shutdown" ]; then elif [ "${setup_mode}" = "autoinstall-no-shutdown" ]; then
expected_status="complete" expected_status=""
fi fi
result_status="$(cat .subiquity/run/subiquity/launcher-status)" result_status="$(cat ${launcher_cmds} | grep action | cut -d = -f 2)"
if [ "${result_status}" != "${expected_status}" ]; then if [ "${result_status}" != "${expected_status}" ]; then
echo "incorrect run/subiquity/launcher-status: expect ${expected_status}, got ${result_status}" echo "incorrect ${launcher_cmds}: expect ${expected_status}, got ${result_status}"
exit 1 exit 1
fi fi
echo "checking generated config" echo "checking generated config"
@ -52,7 +63,7 @@ validate () {
for file in system_setup/tests/golden/${setup_mode}/*.conf; do for file in system_setup/tests/golden/${setup_mode}/*.conf; do
filename=$(basename ${file}) filename=$(basename ${file})
conf_filepath=".subiquity/etc/${filename}" conf_filepath=".subiquity/etc/${filename}"
diff -Nup "${file}" "${conf_filepath}" || exit 1 diff -NBup "${file}" "${conf_filepath}" || exit 1
done done
if [ "${setup_mode}" != "answers-reconf" ]; then if [ "${setup_mode}" != "answers-reconf" ]; then
echo "checking user created" echo "checking user created"

View File

@ -5,7 +5,3 @@ root = /custom_mnt_path
[network] [network]
generatehosts = false generatehosts = false
generateresolvconf = false generateresolvconf = false
[user]
default = ubuntu

View File

@ -11,7 +11,3 @@ enabled = false
[network] [network]
generatehosts = false generatehosts = false
generateresolvconf = false generateresolvconf = false
[user]
default = ubuntu

View File

@ -5,7 +5,3 @@ root = /custom_mnt_path
[network] [network]
generatehosts = false generatehosts = false
generateresolvconf = false generateresolvconf = false
[user]
default = ubuntu