update hooks: add a hook for fixing all pending config updates

BUG=chromium-os:13987
TEST=below
1) export CONFIG_PROTECT="/etc /usr/share"
2) checkout as old as possible revision of cros-overlay, update chroot to it
3) checkout HEAD and update back
4) run the hook, see it update thousands of files correctly

Change-Id: I4213de8ccba6e573541e96591ea0d033a10218a5
Reviewed-on: http://gerrit.chromium.org/gerrit/8938
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: Zdenek Behan <zbehan@chromium.org>
This commit is contained in:
Zdenek Behan 2011-10-07 01:36:36 +02:00 committed by Gerrit
parent 3494498738
commit 3c1d3d8be6

View File

@ -0,0 +1,24 @@
# Copyright (c) 2011 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.
info "Cleaning old configuration files, crosbug.com/13987"
# The filesystem may be polluted by a lot of pending config file updates
# at this point. By changing CONFIG_PROTECT, several of these have become
# permanently stale, as neither tool considers them updates anymore.
# First discard all updates in config files that are still protected, as
# governed by the current CONFIG_PROTECT.
# Autodiscard is option "-9" followed by the "YES" confirmation.
info "Discarding bad updates"
printf '%s\nYES\n' -9 | sudo etc-update
# Overload CONFIG_PROTECT and automerge all possible updates in all sensible
# locations, that is all updates that should've been merged immediately in
# the first place.
# Automerge is the "-5" option.
info "Automerging good updates"
echo "-5" | sudo CONFIG_PROTECT="/etc /usr/share" etc-update
exit 0