diff options
author | Adin Scannell <ascannell@google.com> | 2020-05-15 10:08:31 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-15 10:09:54 -0700 |
commit | c5a939d76c69c440b89045768c3acd8ffc5246b4 (patch) | |
tree | 30c59b6f85e169060ec79503eb62c5571000ff7b /tools/vm/ubuntu1604 | |
parent | 1847165a8c034e82cb35a0dc23878921cab30b5d (diff) |
Update vm scripts to handle existing kbuilder user.
PiperOrigin-RevId: 311751972
Diffstat (limited to 'tools/vm/ubuntu1604')
-rwxr-xr-x | tools/vm/ubuntu1604/40_kokoro.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/vm/ubuntu1604/40_kokoro.sh b/tools/vm/ubuntu1604/40_kokoro.sh index 06a1e6c48..2974f156c 100755 --- a/tools/vm/ubuntu1604/40_kokoro.sh +++ b/tools/vm/ubuntu1604/40_kokoro.sh @@ -43,14 +43,14 @@ done # junitparser is used to merge junit xml files. pip install junitparser -# We need a kbuilder user. -if useradd -c "kbuilder user" -m -s /bin/bash kbuilder; then - # User was added successfully; we add the relevant SSH keys here. - mkdir -p ~kbuilder/.ssh - (IFS=$'\n'; echo "${ssh_public_keys[*]}") > ~kbuilder/.ssh/authorized_keys - chmod 0600 ~kbuilder/.ssh/authorized_keys - chown -R kbuilder ~kbuilder/.ssh -fi +# We need a kbuilder user, which may already exist. +useradd -c "kbuilder user" -m -s /bin/bash kbuilder || true + +# We need to provision appropriate keys. +mkdir -p ~kbuilder/.ssh +(IFS=$'\n'; echo "${ssh_public_keys[*]}") > ~kbuilder/.ssh/authorized_keys +chmod 0600 ~kbuilder/.ssh/authorized_keys +chown -R kbuilder ~kbuilder/.ssh # Give passwordless sudo access. cat > /etc/sudoers.d/kokoro <<EOF |