From 3710eece149ecd98bfe80b5aaf8fe99b30e24ec9 Mon Sep 17 00:00:00 2001 From: Shuichiro MAKIGAKI Date: Thu, 28 Aug 2014 19:07:09 +0900 Subject: [PATCH] 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 --- stack.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/stack.sh b/stack.sh index 9a25bc0630..711c313ffb 100755 --- a/stack.sh +++ b/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 # --------------