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

Unified Diff: src/scripts/common.sh

Issue 429006: build: Make enter_chroot.sh fail if run as root. (Closed)
Patch Set: Created 11 years, 1 month 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 | src/scripts/enter_chroot.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/common.sh
diff --git a/src/scripts/common.sh b/src/scripts/common.sh
index fc7a897d61346f2a40426930e6f37dba70a3b9fa..25dee4a3ed6c634b6d287689e539a83ea97db76a 100644
--- a/src/scripts/common.sh
+++ b/src/scripts/common.sh
@@ -171,6 +171,13 @@ function assert_outside_chroot {
fi
}
+function assert_not_root_user {
+ if [ `id -u` = 0 ]; then
+ echo "This script must be run as a non-root user."
+ exit 1
+ fi
+}
+
# Install a package if it's not already installed
function install_if_missing {
# Positional parameters from calling script. :? means "fail if unset".
« no previous file with comments | « no previous file | src/scripts/enter_chroot.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698