4343# Keep track of the current devstack directory.
4444TOP_DIR=$( cd $( dirname " $0 " ) && pwd)
4545
46+
47+ # Settings
48+ # ========
49+
50+ # This script is customizable through setting environment variables. If you
51+ # want to override a setting you can either::
52+ #
53+ # export MYSQL_PASSWORD=anothersecret
54+ # ./stack.sh
55+ #
56+ # You can also pass options on a single line ``MYSQL_PASSWORD=simple ./stack.sh``
57+ #
58+ # Additionally, you can put any local variables into a ``localrc`` file, like::
59+ #
60+ # MYSQL_PASSWORD=anothersecret
61+ # MYSQL_USER=hellaroot
62+ #
63+ # We try to have sensible defaults, so you should be able to run ``./stack.sh``
64+ # in most cases.
65+ #
66+ # We our settings from ``stackrc``. This file is distributed with devstack and
67+ # contains locations for what repositories to use. If you want to use other
68+ # repositories and branches, you can add your own settings with another file
69+ # called ``localrc``
70+ #
71+ # If ``localrc`` exists, then ``stackrc`` will load those settings. This is
72+ # useful for changing a branch or repostiory to test other versions. Also you
73+ # can store your other settings like **MYSQL_PASSWORD** or **ADMIN_PASSWORD** instead
74+ # of letting devstack generate random ones for you.
75+ source ./stackrc
76+
77+ # Destination path for installation ``DEST``
78+ DEST=${DEST:-/ opt/ stack}
79+
4680# OpenStack is designed to be run as a regular user (Dashboard will fail to run
4781# as root, since apache refused to startup serve content from root user). If
4882# stack.sh is run as root, it automatically creates a stack user with
@@ -60,7 +94,7 @@ if [[ $EUID -eq 0 ]]; then
6094
6195 if ! getent passwd stack > /dev/null; then
6296 echo " Creating a user called stack"
63- useradd -U -G sudo -s /bin/bash -m stack
97+ useradd -U -G sudo -s /bin/bash -d $DEST - m stack
6498 fi
6599
66100 echo " Giving stack user passwordless sudo priviledges"
@@ -71,7 +105,7 @@ if [[ $EUID -eq 0 ]]; then
71105 > /etc/sudoers.d/50_stack_sh )
72106
73107 echo " Copying files to stack user"
74- STACK_DIR=" /home/stack /${PWD##*/ } "
108+ STACK_DIR=" $DEST /${PWD##*/ } "
75109 cp -r -f " $PWD " " $STACK_DIR "
76110 chown -R stack " $STACK_DIR "
77111 if [[ " $SHELL_AFTER_RUN " != " no" ]]; then
@@ -82,40 +116,6 @@ if [[ $EUID -eq 0 ]]; then
82116 exit 1
83117fi
84118
85-
86- # Settings
87- # ========
88-
89- # This script is customizable through setting environment variables. If you
90- # want to override a setting you can either::
91- #
92- # export MYSQL_PASSWORD=anothersecret
93- # ./stack.sh
94- #
95- # You can also pass options on a single line ``MYSQL_PASSWORD=simple ./stack.sh``
96- #
97- # Additionally, you can put any local variables into a ``localrc`` file, like::
98- #
99- # MYSQL_PASSWORD=anothersecret
100- # MYSQL_USER=hellaroot
101- #
102- # We try to have sensible defaults, so you should be able to run ``./stack.sh``
103- # in most cases.
104- #
105- # We our settings from ``stackrc``. This file is distributed with devstack and
106- # contains locations for what repositories to use. If you want to use other
107- # repositories and branches, you can add your own settings with another file
108- # called ``localrc``
109- #
110- # If ``localrc`` exists, then ``stackrc`` will load those settings. This is
111- # useful for changing a branch or repostiory to test other versions. Also you
112- # can store your other settings like **MYSQL_PASSWORD** or **ADMIN_PASSWORD** instead
113- # of letting devstack generate random ones for you.
114- source ./stackrc
115-
116- # Destination path for installation ``DEST``
117- DEST=${DEST:-/ opt/ stack}
118-
119119# Set the destination directories for openstack projects
120120NOVA_DIR=$DEST /nova
121121DASH_DIR=$DEST /dash
0 commit comments