Exit cleanly if run as a non-root user

Exits with a message if the efficitive-uid (EUID) is not 0

Change-Id: If36a9ede5f8bfc763d86870e6f630bafee605476
Reviewed-on: https://review.openstack.org/19453
Reviewed-by: Dan Prince <dprince@redhat.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Sunil Thaha 2013-01-11 15:17:11 +10:00 committed by Jenkins
parent 27024edcbc
commit 2c6a5f3e8e

View File

@ -1,5 +1,10 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cat > /etc/apt/preferences.d/00-puppet.pref <<EOF
Package: puppet puppet-common puppetmaster puppetmaster-common
Pin: version 2.7*