| ... | ... |
@@ -37,6 +37,56 @@ umask 022 |
| 37 | 37 |
# Keep track of the devstack directory |
| 38 | 38 |
TOP_DIR=$(cd $(dirname "$0") && pwd) |
| 39 | 39 |
|
| 40 |
+ |
|
| 41 |
+# Sanity Checks |
|
| 42 |
+# ------------- |
|
| 43 |
+ |
|
| 44 |
+# Clean up last environment var cache |
|
| 45 |
+if [[ -r $TOP_DIR/.stackenv ]]; then |
|
| 46 |
+ rm $TOP_DIR/.stackenv |
|
| 47 |
+fi |
|
| 48 |
+ |
|
| 49 |
+# ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config |
|
| 50 |
+# templates and other useful files in the ``files`` subdirectory |
|
| 51 |
+FILES=$TOP_DIR/files |
|
| 52 |
+if [ ! -d $FILES ]; then |
|
| 53 |
+ die $LINENO "missing devstack/files" |
|
| 54 |
+fi |
|
| 55 |
+ |
|
| 56 |
+# ``stack.sh`` keeps function libraries here |
|
| 57 |
+# Make sure ``$TOP_DIR/lib`` directory is present |
|
| 58 |
+if [ ! -d $TOP_DIR/lib ]; then |
|
| 59 |
+ die $LINENO "missing devstack/lib" |
|
| 60 |
+fi |
|
| 61 |
+ |
|
| 62 |
+# Check if run as root |
|
| 63 |
+# OpenStack is designed to be run as a non-root user; Horizon will fail to run |
|
| 64 |
+# as **root** since Apache will not serve content from **root** user). |
|
| 65 |
+# ``stack.sh`` must not be run as **root**. It aborts and suggests one course of |
|
| 66 |
+# action to create a suitable user account. |
|
| 67 |
+ |
|
| 68 |
+if [[ $EUID -eq 0 ]]; then |
|
| 69 |
+ echo "You are running this script as root." |
|
| 70 |
+ echo "Cut it out." |
|
| 71 |
+ echo "Really." |
|
| 72 |
+ echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:" |
|
| 73 |
+ echo "$TOP_DIR/tools/create-stack-user.sh" |
|
| 74 |
+ exit 1 |
|
| 75 |
+fi |
|
| 76 |
+ |
|
| 77 |
+# Check to see if we are already running DevStack |
|
| 78 |
+# Note that this may fail if USE_SCREEN=False |
|
| 79 |
+if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then |
|
| 80 |
+ echo "You are already running a stack.sh session." |
|
| 81 |
+ echo "To rejoin this session type 'screen -x stack'." |
|
| 82 |
+ echo "To destroy this session, type './unstack.sh'." |
|
| 83 |
+ exit 1 |
|
| 84 |
+fi |
|
| 85 |
+ |
|
| 86 |
+ |
|
| 87 |
+# Prepare the environment |
|
| 88 |
+# ----------------------- |
|
| 89 |
+ |
|
| 40 | 90 |
# Import common functions |
| 41 | 91 |
source $TOP_DIR/functions |
| 42 | 92 |
|
| ... | ... |
@@ -48,6 +98,15 @@ source $TOP_DIR/lib/config |
| 48 | 48 |
# and ``DISTRO`` |
| 49 | 49 |
GetDistro |
| 50 | 50 |
|
| 51 |
+# Warn users who aren't on an explicitly supported distro, but allow them to |
|
| 52 |
+# override check and attempt installation with ``FORCE=yes ./stack`` |
|
| 53 |
+if [[ ! ${DISTRO} =~ (precise|trusty|7.0|wheezy|sid|testing|jessie|f19|f20|rhel6|rhel7) ]]; then
|
|
| 54 |
+ echo "WARNING: this script has not been tested on $DISTRO" |
|
| 55 |
+ if [[ "$FORCE" != "yes" ]]; then |
|
| 56 |
+ die $LINENO "If you wish to run this script anyway run with FORCE=yes" |
|
| 57 |
+ fi |
|
| 58 |
+fi |
|
| 59 |
+ |
|
| 51 | 60 |
|
| 52 | 61 |
# Global Settings |
| 53 | 62 |
# =============== |
| ... | ... |
@@ -110,27 +169,6 @@ export_proxy_variables |
| 110 | 110 |
DEST=${DEST:-/opt/stack}
|
| 111 | 111 |
|
| 112 | 112 |
|
| 113 |
-# Sanity Check |
|
| 114 |
-# ------------ |
|
| 115 |
- |
|
| 116 |
-# Clean up last environment var cache |
|
| 117 |
-if [[ -r $TOP_DIR/.stackenv ]]; then |
|
| 118 |
- rm $TOP_DIR/.stackenv |
|
| 119 |
-fi |
|
| 120 |
- |
|
| 121 |
-# ``stack.sh`` keeps the list of ``apt`` and ``rpm`` dependencies and config |
|
| 122 |
-# templates and other useful files in the ``files`` subdirectory |
|
| 123 |
-FILES=$TOP_DIR/files |
|
| 124 |
-if [ ! -d $FILES ]; then |
|
| 125 |
- die $LINENO "missing devstack/files" |
|
| 126 |
-fi |
|
| 127 |
- |
|
| 128 |
-# ``stack.sh`` keeps function libraries here |
|
| 129 |
-# Make sure ``$TOP_DIR/lib`` directory is present |
|
| 130 |
-if [ ! -d $TOP_DIR/lib ]; then |
|
| 131 |
- die $LINENO "missing devstack/lib" |
|
| 132 |
-fi |
|
| 133 |
- |
|
| 134 | 113 |
# Import common services (database, message queue) configuration |
| 135 | 114 |
source $TOP_DIR/lib/database |
| 136 | 115 |
source $TOP_DIR/lib/rpc_backend |
| ... | ... |
@@ -140,14 +178,6 @@ source $TOP_DIR/lib/rpc_backend |
| 140 | 140 |
# calling disable_service(). |
| 141 | 141 |
disable_negated_services |
| 142 | 142 |
|
| 143 |
-# Warn users who aren't on an explicitly supported distro, but allow them to |
|
| 144 |
-# override check and attempt installation with ``FORCE=yes ./stack`` |
|
| 145 |
-if [[ ! ${DISTRO} =~ (precise|trusty|7.0|wheezy|sid|testing|jessie|f19|f20|rhel6|rhel7) ]]; then
|
|
| 146 |
- echo "WARNING: this script has not been tested on $DISTRO" |
|
| 147 |
- if [[ "$FORCE" != "yes" ]]; then |
|
| 148 |
- die $LINENO "If you wish to run this script anyway run with FORCE=yes" |
|
| 149 |
- fi |
|
| 150 |
-fi |
|
| 151 | 143 |
|
| 152 | 144 |
# Look for obsolete stuff |
| 153 | 145 |
if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
|
| ... | ... |
@@ -157,38 +187,9 @@ if [[ ,${ENABLED_SERVICES}, =~ ,"swift", ]]; then
|
| 157 | 157 |
exit 1 |
| 158 | 158 |
fi |
| 159 | 159 |
|
| 160 |
-# Make sure we only have one rpc backend enabled, |
|
| 161 |
-# and the specified rpc backend is available on your platform. |
|
| 162 |
-check_rpc_backend |
|
| 163 |
- |
|
| 164 |
-# Check to see if we are already running DevStack |
|
| 165 |
-# Note that this may fail if USE_SCREEN=False |
|
| 166 |
-if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then |
|
| 167 |
- echo "You are already running a stack.sh session." |
|
| 168 |
- echo "To rejoin this session type 'screen -x stack'." |
|
| 169 |
- echo "To destroy this session, type './unstack.sh'." |
|
| 170 |
- exit 1 |
|
| 171 |
-fi |
|
| 172 |
- |
|
| 173 |
-# Set up logging level |
|
| 174 |
-VERBOSE=$(trueorfalse True $VERBOSE) |
|
| 175 |
- |
|
| 176 |
-# root Access |
|
| 177 |
-# ----------- |
|
| 178 |
- |
|
| 179 |
-# OpenStack is designed to be run as a non-root user; Horizon will fail to run |
|
| 180 |
-# as **root** since Apache will not serve content from **root** user). |
|
| 181 |
-# ``stack.sh`` must not be run as **root**. It aborts and suggests one course of |
|
| 182 |
-# action to create a suitable user account. |
|
| 183 | 160 |
|
| 184 |
-if [[ $EUID -eq 0 ]]; then |
|
| 185 |
- echo "You are running this script as root." |
|
| 186 |
- echo "Cut it out." |
|
| 187 |
- echo "Really." |
|
| 188 |
- echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:" |
|
| 189 |
- echo "$TOP_DIR/tools/create-stack-user.sh" |
|
| 190 |
- exit 1 |
|
| 191 |
-fi |
|
| 161 |
+# Configure sudo |
|
| 162 |
+# -------------- |
|
| 192 | 163 |
|
| 193 | 164 |
# We're not **root**, make sure ``sudo`` is available |
| 194 | 165 |
is_package_installed sudo || install_package sudo |