Browse code

build_lxc.sh needs to be root to run

Jesse Andrews authored on 2011/09/29 10:29:50
Showing 1 changed files
... ...
@@ -1,5 +1,16 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
+# Sanity check
4
+if [ "$EUID" -ne "0" ]; then
5
+  echo "This script must be run with root privileges."
6
+  exit 1
7
+fi
8
+
9
+# Warn users who aren't on natty
10
+if ! grep -q natty /etc/lsb-release; then
11
+    echo "WARNING: this script has only been tested on natty"
12
+fi
13
+
3 14
 # Source params
4 15
 source ./stackrc
5 16
 
... ...
@@ -23,10 +34,6 @@ STACKSH_PARAMS=${STACKSH_PARAMS:-}
23 23
 # Option to use the version of devstack on which we are currently working
24 24
 USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
25 25
 
26
-# Warn users who aren't on natty
27
-if ! grep -q natty /etc/lsb-release; then
28
-    echo "WARNING: this script has only been tested on natty"
29
-fi
30 26
 
31 27
 # Install deps
32 28
 apt-get install -y lxc debootstrap