Pull stack.sh sanity check reorg from multi-distro branch.
This performs OS detection checks earlier and moves the
Sanity Check section later so we have more information available.
Change-Id: I5b9e64c4dc024a9ad90bd4f7e5ed86d601c0f610
| ... | ... |
@@ -1,9 +1,8 @@ |
| 1 | 1 |
#!/usr/bin/env bash |
| 2 | 2 |
|
| 3 |
-# **stack.sh** is an opinionated OpenStack developer installation. |
|
| 4 |
- |
|
| 5 |
-# This script installs and configures various combinations of *Glance*, |
|
| 6 |
-# *Horizon*, *Keystone*, *Melange*, *Nova*, *Quantum* and *Swift* |
|
| 3 |
+# ``stack.sh`` is an opinionated OpenStack developer installation. It |
|
| 4 |
+# installs and configures various combinations of **Glance**, **Horizon**, |
|
| 5 |
+# **Keystone**, **Melange**, **Nova**, **Quantum** and **Swift** |
|
| 7 | 6 |
|
| 8 | 7 |
# This script allows you to specify configuration options of what git |
| 9 | 8 |
# repositories to use, enabled services, network configuration and various |
| ... | ... |
@@ -12,42 +11,30 @@ |
| 12 | 12 |
# developer install. |
| 13 | 13 |
|
| 14 | 14 |
# To keep this script simple we assume you are running on an **Ubuntu 11.10 |
| 15 |
-# Oneiric** machine. It should work in a VM or physical server. Additionally |
|
| 16 |
-# we put the list of *apt* and *pip* dependencies and other configuration files |
|
| 17 |
-# in this repo. So start by grabbing this script and the dependencies. |
|
| 15 |
+# Oneiric** or **Ubuntu 12.04 Precise** machine. It should work in a VM or |
|
| 16 |
+# physical server. Additionally we put the list of ``apt`` and ``pip`` |
|
| 17 |
+# dependencies and other configuration files in this repo. So start by |
|
| 18 |
+# grabbing this script and the dependencies. |
|
| 18 | 19 |
|
| 19 | 20 |
# Learn more and get the most recent version at http://devstack.org |
| 20 | 21 |
|
| 21 |
- |
|
| 22 |
-# Sanity Check |
|
| 23 |
-# ============ |
|
| 24 |
- |
|
| 25 |
-# Warn users who aren't on oneiric, but allow them to override check and attempt |
|
| 26 |
-# installation with ``FORCE=yes ./stack`` |
|
| 27 |
-DISTRO=$(lsb_release -c -s) |
|
| 28 |
- |
|
| 29 |
-if [[ ! ${DISTRO} =~ (oneiric|precise) ]]; then
|
|
| 30 |
- echo "WARNING: this script has only been tested on oneiric" |
|
| 31 |
- if [[ "$FORCE" != "yes" ]]; then |
|
| 32 |
- echo "If you wish to run this script anyway run with FORCE=yes" |
|
| 33 |
- exit 1 |
|
| 34 |
- fi |
|
| 35 |
-fi |
|
| 36 |
- |
|
| 37 |
-# Keep track of the current devstack directory. |
|
| 22 |
+# Keep track of the devstack directory |
|
| 38 | 23 |
TOP_DIR=$(cd $(dirname "$0") && pwd) |
| 39 | 24 |
|
| 40 | 25 |
# Import common functions |
| 41 |
-. $TOP_DIR/functions |
|
| 26 |
+source $TOP_DIR/functions |
|
| 42 | 27 |
|
| 43 |
-# stack.sh keeps the list of **apt** and **pip** dependencies in external |
|
| 44 |
-# files, along with config templates and other useful files. You can find these |
|
| 45 |
-# in the ``files`` directory (next to this script). We will reference this |
|
| 46 |
-# directory using the ``FILES`` variable in this script. |
|
| 47 |
-FILES=$TOP_DIR/files |
|
| 48 |
-if [ ! -d $FILES ]; then |
|
| 49 |
- echo "ERROR: missing devstack/files - did you grab more than just stack.sh?" |
|
| 50 |
- exit 1 |
|
| 28 |
+# Determine what system we are running on. This provides ``os_VENDOR``, |
|
| 29 |
+# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` |
|
| 30 |
+GetOSVersion |
|
| 31 |
+ |
|
| 32 |
+# Translate the OS version values into common nomenclature |
|
| 33 |
+if [[ "$os_VENDOR" =~ (Ubuntu) ]]; then |
|
| 34 |
+ # 'Everyone' refers to Ubuntu releases by the code name adjective |
|
| 35 |
+ DISTRO=$os_CODENAME |
|
| 36 |
+else |
|
| 37 |
+ # Catch-all for now is Vendor + Release + Update |
|
| 38 |
+ DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE" |
|
| 51 | 39 |
fi |
| 52 | 40 |
|
| 53 | 41 |
|
| ... | ... |
@@ -72,21 +59,49 @@ fi |
| 72 | 72 |
# |
| 73 | 73 |
# DevStack distributes ``stackrc`` which contains locations for the OpenStack |
| 74 | 74 |
# repositories and branches to configure. ``stackrc`` sources ``localrc`` to |
| 75 |
-# allow you to override those settings and not have your changes overwritten |
|
| 75 |
+# allow you to safely override those settings without being overwritten |
|
| 76 | 76 |
# when updating DevStack. |
| 77 | 77 |
|
| 78 |
-# We support HTTP and HTTPS proxy servers via the usual environment variables |
|
| 79 |
-# **http_proxy** and **https_proxy**. They can be set in ``localrc`` if necessary or |
|
| 80 |
-# on the command line:: |
|
| 78 |
+# HTTP and HTTPS proxy servers are supported via the usual environment variables |
|
| 79 |
+# ``http_proxy`` and ``https_proxy``. They can be set in ``localrc`` if necessary |
|
| 80 |
+# or on the command line:: |
|
| 81 | 81 |
# |
| 82 | 82 |
# http_proxy=http://proxy.example.com:3128/ ./stack.sh |
| 83 | 83 |
|
| 84 |
+if [[ ! -r $TOP_DIR/stackrc ]]; then |
|
| 85 |
+ echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?" |
|
| 86 |
+ exit 1 |
|
| 87 |
+fi |
|
| 84 | 88 |
source ./stackrc |
| 85 | 89 |
|
| 86 | 90 |
# Destination path for installation ``DEST`` |
| 87 | 91 |
DEST=${DEST:-/opt/stack}
|
| 88 | 92 |
|
| 89 |
-# Check to see if we are already running a stack.sh |
|
| 93 |
+ |
|
| 94 |
+# Sanity Check |
|
| 95 |
+# ============ |
|
| 96 |
+ |
|
| 97 |
+# Warn users who aren't on an explicitly supported distro, but allow them to |
|
| 98 |
+# override check and attempt installation with ``FORCE=yes ./stack`` |
|
| 99 |
+if [[ ! ${DISTRO} =~ (oneiric|precise) ]]; then
|
|
| 100 |
+ echo "WARNING: this script has only been tested on oneiric and precise" |
|
| 101 |
+ if [[ "$FORCE" != "yes" ]]; then |
|
| 102 |
+ echo "If you wish to run this script anyway run with FORCE=yes" |
|
| 103 |
+ exit 1 |
|
| 104 |
+ fi |
|
| 105 |
+fi |
|
| 106 |
+ |
|
| 107 |
+# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external |
|
| 108 |
+# files, along with config templates and other useful files. You can find these |
|
| 109 |
+# in the ``files`` directory (next to this script). We will reference this |
|
| 110 |
+# directory using the ``FILES`` variable in this script. |
|
| 111 |
+FILES=$TOP_DIR/files |
|
| 112 |
+if [ ! -d $FILES ]; then |
|
| 113 |
+ echo "ERROR: missing devstack/files - did you grab more than just stack.sh?" |
|
| 114 |
+ exit 1 |
|
| 115 |
+fi |
|
| 116 |
+ |
|
| 117 |
+# Check to see if we are already running DevStack |
|
| 90 | 118 |
if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].stack"; then |
| 91 | 119 |
echo "You are already running a stack.sh session." |
| 92 | 120 |
echo "To rejoin this session type 'screen -x stack'." |