Browse code

Set stack user's home dir to DEST

Dean Troyer authored on 2011/10/18 04:07:11
Showing 1 changed files
... ...
@@ -43,6 +43,40 @@ fi
43 43
 # Keep track of the current devstack directory.
44 44
 TOP_DIR=$(cd $(dirname "$0") && pwd)
45 45
 
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
+
46 80
 # OpenStack is designed to be run as a regular user (Dashboard will fail to run
47 81
 # as root, since apache refused to startup serve content from root user).  If
48 82
 # stack.sh is run as root, it automatically creates a stack user with
... ...
@@ -60,7 +94,7 @@ if [[ $EUID -eq 0 ]]; then
60 60
 
61 61
     if ! getent passwd stack >/dev/null; then
62 62
         echo "Creating a user called stack"
63
-        useradd -U -G sudo -s /bin/bash -m stack
63
+        useradd -U -G sudo -s /bin/bash -d $DEST -m stack
64 64
     fi
65 65
 
66 66
     echo "Giving stack user passwordless sudo priviledges"
... ...
@@ -71,7 +105,7 @@ if [[ $EUID -eq 0 ]]; then
71 71
         > /etc/sudoers.d/50_stack_sh )
72 72
 
73 73
     echo "Copying files to stack user"
74
-    STACK_DIR="/home/stack/${PWD##*/}"
74
+    STACK_DIR="$DEST/${PWD##*/}"
75 75
     cp -r -f "$PWD" "$STACK_DIR"
76 76
     chown -R stack "$STACK_DIR"
77 77
     if [[ "$SHELL_AFTER_RUN" != "no" ]]; then
... ...
@@ -82,40 +116,6 @@ if [[ $EUID -eq 0 ]]; then
82 82
     exit 1
83 83
 fi
84 84
 
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
-
119 85
 # Set the destination directories for openstack projects
120 86
 NOVA_DIR=$DEST/nova
121 87
 DASH_DIR=$DEST/dash