mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 13:36:58 +02:00
sudo takes 150ms per invocation on Goobuntu, and with 10 invocations in enter_chroot.sh, this means that we're wasting a lot of time, every time cros_sdk is invoked. Cutting these unnecessary invocations reduces the time required to run enter_chroot.sh from 2.3s to 0.8s. CL:36618 is the companion change that updates cros_sdk to invoke sudo unshare -m prior to calling enter_chroot.sh. Summary of changes: 1. Remove all calls to sudo and just run the commands directly. - Remove the mount queue and any sudo_multi optimizations. - Rename sudo_chroot -> bare_chroot because we don't run sudo anymore there. - Remove code for validating sudo timestamp. 2. Allow the scripts to work as root: - Ensure that files created by cros_sdk that previously were owned by the user still are owned by the user (either using chown or cp -p). - Use $SUDO_USER to find the user's account. - Use $SUDO_HOME instead of $HOME to find the user's home dir. - Remove outdated code for disabling automount on Lucid, which doesn't work when run as root. - Update code for calculating the user's git username to use sudo to switch to the user. Also move it to make_chroot.sh so that this change doesn't impact performance. 3. Cleanup - Remove environment syncer process in favor of just syncing once when chroot is entered. - Remove teardown and instead rely on unshare to unmount the mounts. To make sure that outside processes never notice the mounts, we use mount -n. This also ensures that /etc/mtab never contains stale mounts. - Remove path-overrides, since it is no longer needed. BUG=chromium-os:35714, chromium-os:35679 TEST=Trybot runs. CQ-DEPEND=CL:36618 Change-Id: I919a8aadb08fafde97348e8511573c28fdd47186 Reviewed-on: https://gerrit.chromium.org/gerrit/36619 Tested-by: David James <davidjames@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Ready: David James <davidjames@chromium.org>
6 lines
247 B
Plaintext
6 lines
247 B
Plaintext
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# Path overrides are no longer in use, so this script is just a placeholder.
|