From d8c259af5ae8a5eba10bf1d8fbf368251c028caf Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 26 Sep 2011 14:04:13 -0700 Subject: [PATCH] use stackrc.example, and prompt user before copying --- build_lxc.sh | 7 +++++++ build_nfs.sh | 7 +++++++ stack.sh | 7 +++++++ stackrc => stackrc.example | 0 4 files changed, 21 insertions(+) rename stackrc => stackrc.example (100%) diff --git a/build_lxc.sh b/build_lxc.sh index 3d0ad89c06..4c624aab89 100755 --- a/build_lxc.sh +++ b/build_lxc.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +# Use stackrc.example if stackrc is missing +if [ ! -e ./stackrc ]; then + read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " + echo + [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; } +fi + # Source params source ./stackrc diff --git a/build_nfs.sh b/build_nfs.sh index fa3e3ef89c..c0fa7332d0 100755 --- a/build_nfs.sh +++ b/build_nfs.sh @@ -1,5 +1,12 @@ #!/bin/bash +# Use stackrc.example if stackrc is missing +if [ ! -e ./stackrc ]; then + read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " + echo + [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; } +fi + # Source params source ./stackrc diff --git a/stack.sh b/stack.sh index 85b7474955..54d777ab22 100755 --- a/stack.sh +++ b/stack.sh @@ -59,6 +59,13 @@ set -o errexit # an error. It is also useful for following allowing as the install occurs. set -o xtrace +# Use stackrc.example if stackrc is missing +if [ ! -e ./stackrc ]; then + read -n1 -p "No stackrc present. Copy stackrc.example to stackrc? (y/n) " + echo + [[ $REPLY = [yY] ]] && cp stackrc.example stackrc|| { echo "Aborting: Missing stackrc"; exit 1; } +fi + # Import variables source ./stackrc diff --git a/stackrc b/stackrc.example similarity index 100% rename from stackrc rename to stackrc.example