Fix to avoid undefined variables in initial sanity checks
This commit moves check to see if screen is already running after reading stackrc, and changes messages in check if root is running DevStack. STACK_USER is defined in stackrc, and SCREEN_NAME can be replaced with "a non-root account". Change-Id: I022ed1099169a3549b7e31883abe33d6298f6fa5 Closes-Bug: #1362091
This commit is contained in:
parent
61a6e253f2
commit
3710eece14
21
stack.sh
21
stack.sh
@ -69,20 +69,11 @@ if [[ $EUID -eq 0 ]]; then
|
||||
echo "You are running this script as root."
|
||||
echo "Cut it out."
|
||||
echo "Really."
|
||||
echo "If you need an account to run DevStack, do this (as root, heh) to create $STACK_USER:"
|
||||
echo "If you need an account to run DevStack, do this (as root, heh) to create a non-root account:"
|
||||
echo "$TOP_DIR/tools/create-stack-user.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check to see if we are already running DevStack
|
||||
# Note that this may fail if USE_SCREEN=False
|
||||
if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].$SCREEN_NAME"; then
|
||||
echo "You are already running a stack.sh session."
|
||||
echo "To rejoin this session type 'screen -x stack'."
|
||||
echo "To destroy this session, type './unstack.sh'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Prepare the environment
|
||||
# -----------------------
|
||||
@ -130,6 +121,7 @@ if [[ -r $TOP_DIR/local.conf ]]; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# ``stack.sh`` is customizable by setting environment variables. Override a
|
||||
# default setting via export::
|
||||
#
|
||||
@ -158,6 +150,15 @@ if [[ ! -r $TOP_DIR/stackrc ]]; then
|
||||
fi
|
||||
source $TOP_DIR/stackrc
|
||||
|
||||
# Check to see if we are already running DevStack
|
||||
# Note that this may fail if USE_SCREEN=False
|
||||
if type -p screen > /dev/null && screen -ls | egrep -q "[0-9]\.$SCREEN_NAME"; then
|
||||
echo "You are already running a stack.sh session."
|
||||
echo "To rejoin this session type 'screen -x stack'."
|
||||
echo "To destroy this session, type './unstack.sh'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Local Settings
|
||||
# --------------
|
||||
|
Loading…
Reference in New Issue
Block a user