dev_container: Fix /scratch permission

Correct permission of /scratch to allow crosvmdev to modify its
content after UID & GID changed to match host after container first
start.

TEST=tools/dev_container --stop ; tools/dev_container tools/run_tests
--target=vm:aarch64 --build-only

Change-Id: I8872c433ae903536750a4623f0d149b2875deba2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3855471
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Zihan Chen <zihanchen@google.com>
This commit is contained in:
Zihan Chen 2022-08-25 01:15:45 +00:00 committed by crosvm LUCI
parent ac9a459761
commit 9c3270b08c
3 changed files with 4 additions and 6 deletions

View file

@ -37,7 +37,7 @@ RUN useradd -ms /bin/bash crosvmdev \
# Pass rust envs from rust toolchain image when sudo into new user
&& echo 'Defaults env_keep += "RUSTUP_HOME CARGO_HOME RUST_VERSION CARGO_TARGET_DIR"' >> /etc/sudoers \
# Allow dependencies and build files to be used and overwritten by user
&& chmod -R 777 /scratch /cache
&& chown -R crosvmdev:crosvmdev /scratch /cache
# Following operations will be run as crosvmdev to ensure correct permission.
USER crosvmdev

View file

@ -3,12 +3,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if [[ $OUTSIDE_GID != $(sudo -u crosvmdev id -g) ]]; then
if [[ $OUTSIDE_GID != $(id -g crosvmdev) || $OUTSIDE_UID != $(id -u crosvmdev) ]]; then
groupmod -g "$OUTSIDE_GID" crosvmdev
chgrp -R crosvmdev /home/crosvmdev
fi
if [[ $OUTSIDE_UID != $(sudo -u crosvmdev id -u) ]]; then
usermod -u "$OUTSIDE_UID" crosvmdev
chown -R crosvmdev:crosvmdev /scratch
fi
# Transitional section to fix CI's cache permission

View file

@ -1 +1 @@
r0019
r0020