diff --git a/chroot_version_hooks.d/47_path_overrides b/chroot_version_hooks.d/47_path_overrides deleted file mode 100644 index a3f89169bf..0000000000 --- a/chroot_version_hooks.d/47_path_overrides +++ /dev/null @@ -1,12 +0,0 @@ -# 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. - -# Ensure that crosutils path overrides are in use; note that chroot -# creation also invokes this, thus why we check for CROS_CHROOT; for -# the normal upgrade pathway, it's non existant. For chroot creation, -# It points to the chroot base. -echo 'export PATH="/usr/local/path-overrides${PATH:+:${PATH}}"' | \ - sudo tee "${CROS_CHROOT}"/etc/profile.d/crosutils-path-overrides.sh \ - > /dev/null -sudo chmod 644 "${CROS_CHROOT}"/etc/profile.d/crosutils-path-overrides.sh diff --git a/common.sh b/common.sh index f4ff153fb0..839f421a5a 100644 --- a/common.sh +++ b/common.sh @@ -466,12 +466,12 @@ assert_not_root_user() { # Usage: check_flags_only_and_allow_null_arg "$@" && set -- check_flags_only_and_allow_null_arg() { do_shift=1 - if [ $# = 1 -a -z "$1" ]; then + if [[ $# == 1 && -z "$@" ]]; then echo "$0: warning: ignoring null argument" >&2 shift do_shift=0 fi - if [ $# -gt 0 ]; then + if [[ $# -gt 0 ]]; then echo "error: invalid arguments: \"$@\"" >&2 flags_help exit 1 @@ -1071,22 +1071,3 @@ switch_to_strict_mode() { # TODO: Re-enable this once shflags is set -e safe. #switch_to_strict_mode - -# The following code is used to ensure our umount wrapper is in use. -# Shouldn't be invoked by anything other than common.sh -_enable_path_overrides(){ - # Ensure that our PATH overrides are in use. - local override_dir=$(readlink -f "${SCRIPT_ROOT}/path-overrides") - local IFS=: - local x - for x in ${PATH}; do - x=$(readlink -f "${x}") - if [ "${x}" = "${override_dir}" ]; then - # Already is in path; nothing more to do. - return - fi - done - export PATH="${override_dir}${PATH:+:${PATH}}" -} - -_enable_path_overrides diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 58cb0f5307..77a25d4f4e 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -274,13 +274,9 @@ setup_env() { queue_mount /run/shm "--bind" /run/shm fi fi - # Get path overrides for the chroot in place now- it's possible - # that they may be needed for early teardown. - queue_mount "${FLAGS_trunk}/src/scripts/path-overrides" "--bind" \ - "/usr/local/path-overrides" - queue_mount "${FLAGS_trunk}" "--bind" "${CHROOT_TRUNK_DIR}" + debug "Setting up referenced repositories if required." REFERENCE_DIR=$(git config --file \ "${FLAGS_trunk}/.repo/manifests.git/config" \ diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh index 6f957c9f8b..f857f0f4a3 100755 --- a/sdk_lib/make_chroot.sh +++ b/sdk_lib/make_chroot.sh @@ -177,11 +177,6 @@ init_setup () { sudo bash -e "${SCRIPT_ROOT}/chroot_version_hooks.d/45_rewrite_sudoers.d" \ "${FLAGS_chroot}" "${USER}" "${ENVIRONMENT_WHITELIST[@]}" - # Turn on the path overrides; subshelled to protect our env from whatever - # vars the scriptlet may bleed. - ( CROS_CHROOT="${FLAGS_chroot}" - . "${SCRIPT_ROOT}/chroot_version_hooks.d/47_path_overrides" ) - sudo find "${FLAGS_chroot}/etc/"sudoers* -type f -exec chmod 0440 {} + # Fix bad group for some. sudo chown -R root:root "${FLAGS_chroot}/etc/"sudoers*