mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 23:21:17 +02:00
Nuke chroot hacks from before March and before Gerrit transition.
These hacks are all at least three months old, and our official policy is to remove hacks after two weeks. For future hacks, the plan is to use the chroot upgrader script so that old chroots can be supported indefinitely. Thanks to the Gerrit transition, there are probably few old chroots around anyway that aren't going to be recreated anyway. BUG=chromium-os:16151 TEST=Verify enter_chroot.sh still works. Change-Id: Ie0c777aabbd70d2a0c88b59ddd71e9b67965ca94 Reviewed-on: http://gerrit.chromium.org/gerrit/2158 Reviewed-by: Raymes Khoury <raymes@chromium.org> Reviewed-by: Zdenek Behan <zbehan@chromium.org> Tested-by: David James <davidjames@chromium.org>
This commit is contained in:
parent
780933db56
commit
f540249413
20
common.sh
20
common.sh
@ -564,26 +564,6 @@ print_time_elapsed() {
|
||||
echo "Elapsed time: ${minutes}m${seconds}s"
|
||||
}
|
||||
|
||||
# This function is a place to put code to incrementally update the
|
||||
# chroot so that users don't need to fully re-make it. It should
|
||||
# be called from scripts that are run _outside_ the chroot.
|
||||
#
|
||||
# Please put date information so it's easy to keep track of when
|
||||
# old hacks can be retired and so that people can detect when a
|
||||
# hack triggered when it shouldn't have.
|
||||
#
|
||||
# ${1} specifies the location of the chroot.
|
||||
chroot_hacks_from_outside() {
|
||||
# Give args better names.
|
||||
local chroot_dir=$1
|
||||
|
||||
# Add root as a sudoer if not already done.
|
||||
if ! sudo grep -q '^root ALL=(ALL) ALL$' "${chroot_dir}/etc/sudoers" ; then
|
||||
info "Upgrading old chroot (pre 2010-10-19) - adding root to sudoers"
|
||||
sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\""
|
||||
fi
|
||||
}
|
||||
|
||||
# The board and variant command line options can be used in a number of ways
|
||||
# to specify the board and variant. The board can encode both pieces of
|
||||
# information separated by underscores. Or the variant can be passed using
|
||||
|
@ -336,37 +336,6 @@ function teardown_env {
|
||||
) 200>>"$LOCKFILE" || die "teardown_env failed"
|
||||
}
|
||||
|
||||
# This function does extra "fixups" of the chroot. It's a lot like
|
||||
# chroot_hacks_from_outside() in common.sh, except that it is only called
|
||||
# from enter_chroot.sh (chroot_hacks_from_outside is also called from
|
||||
# make_chroot.sh). This function was created because common.sh is on lockdown
|
||||
# and can't be changed.
|
||||
#
|
||||
# NOTE: the need for this type of "fixup" should be going away. If everything
|
||||
# in the chroot is versioned and nothing is generated, there is no need to
|
||||
# handle partly fixing up generated files.
|
||||
#
|
||||
# Please put date information so it's easy to keep track of when
|
||||
# old hacks can be retired and so that people can detect when a
|
||||
# hack triggered when it shouldn't have.
|
||||
function chroot_hacks_too() {
|
||||
local chroot_home="${FLAGS_chroot}/home/${USER}"
|
||||
|
||||
# Add chromite stuff if not already done.
|
||||
if ! grep -q "^PATH=.*/trunk/chromite/bin" "${chroot_home}/.bashrc"; then
|
||||
info "Upgrading old chroot (pre 2011-02-09) - adding chromite to path"
|
||||
echo "PATH=\$PATH:/home/${USER}/trunk/chromite/bin" >> \
|
||||
"${chroot_home}/.bashrc"
|
||||
fi
|
||||
if ! [ -L "${chroot_home}/.local/lib/python2.6/site-packages/chromite" ]; then
|
||||
info "Upgrading old chroot (pre 2011-02-09) - add chromite to site-packages"
|
||||
mkdir -p "${chroot_home}/.local/lib/python2.6/site-packages"
|
||||
ln -s ../../../../trunk/chromite \
|
||||
"${chroot_home}/.local/lib/python2.6/site-packages/"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ $FLAGS_mount -eq $FLAGS_TRUE ]; then
|
||||
setup_env
|
||||
info "Make sure you run"
|
||||
@ -381,11 +350,6 @@ if [ $FLAGS_unmount -eq $FLAGS_TRUE ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Apply any hacks needed to update the chroot.
|
||||
chroot_hacks_from_outside "${FLAGS_chroot}"
|
||||
chroot_hacks_too
|
||||
|
||||
|
||||
# Make sure we unmount before exiting
|
||||
trap teardown_env EXIT
|
||||
setup_env
|
||||
|
Loading…
x
Reference in New Issue
Block a user