mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
build: Make enter_chroot.sh fail if run as root.
BUG=684 Review URL: http://codereview.chromium.org/429006 git-svn-id: svn://chrome-svn/chromeos/trunk@304 06c00378-0e64-4dae-be16-12b19f9950a1
This commit is contained in:
parent
a9948c6336
commit
86dcc8e68b
@ -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".
|
||||
|
@ -10,8 +10,9 @@
|
||||
# The path to common.sh should be relative to your script's location.
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
# Script must be run outside the chroot
|
||||
# Script must be run outside the chroot and as a regular user.
|
||||
assert_outside_chroot
|
||||
assert_not_root_user
|
||||
|
||||
# Define command line flags
|
||||
# See http://code.google.com/p/shflags/wiki/Documentation10x
|
||||
|
Loading…
x
Reference in New Issue
Block a user