oobe: exit early for cloud-init
WSL supports `cloud-init` for provisioning. In some cases (RHEL) this is enabled. If `wsl-setup` is used on RHEL then there's a TOCTOU between the check for "no user exists" and the "create user" part as `cloud-init` creates the user during the prompt. Let's exit early and assume everything is handled by `cloud-init` *if* it is enabled. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
parent
0479b8395c
commit
5afaf63d99
@ -2,7 +2,8 @@
|
||||
|
||||
# The Fedora WSL out of box experience script.
|
||||
#
|
||||
# This command runs the first time the user opens an interactive shell.
|
||||
# This command runs the first time the user opens an interactive shell if
|
||||
# `cloud-init` is not enabled.
|
||||
#
|
||||
# A non-zero exit code indicates to WSL that setup failed.
|
||||
|
||||
@ -10,6 +11,10 @@ set -ueo pipefail
|
||||
|
||||
DEFAULT_USER_ID=1000
|
||||
|
||||
if systemctl is-enabled cloud-init.service > /dev/null ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'Please create a default user account. The username does not need to match your Windows username.'
|
||||
echo 'For more information visit: https://aka.ms/wslusers'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user