Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: common.sh

Issue 3909001: Added a function to update chroot sudoers automatically. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | enter_chroot.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common.sh
diff --git a/common.sh b/common.sh
index 19bd0c27779413062a766ac6d021ea20603bc01f..b562e0f4d600aeae050adcc1ca08bfd2c80ffcae 100644
--- a/common.sh
+++ b/common.sh
@@ -460,3 +460,23 @@ print_time_elapsed() {
seconds="$(( $elapsed_seconds % 60 ))"
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.
davidjames 2010/10/19 21:24:23 No need for this comment.
+ 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
+}
« no previous file with comments | « no previous file | enter_chroot.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698