Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH] bin: make template config as default
Date: Fri, 31 May 2019 17:52:09 +0900	[thread overview]
Message-ID: <1559292729-26993-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Config file of startup script `bin/env.sh` is under management of git,
but it is not convenient for developers if this file is changed and
asked to `git add` even if subtle changes. This update is to add
template config under the management of git and to use customized
config which is not included under git.

The startup script expects to find customized `bin/config.sh`, or create
it by copying template `bin/sample/config.sh` if it does not exist.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 .gitignore                       |  1 +
 bin/{env.sh => sample/config.sh} |  0
 bin/start.sh                     | 15 +++++++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)
 rename bin/{env.sh => sample/config.sh} (100%)

diff --git a/.gitignore b/.gitignore
index b31ab54..34c2ea8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 *.swp
 *.pyc
 *.log
+bin/config.sh
 docs/guides/_build/*
 docs/guides/images/**/*.pdf
 src/controller/3rd_party/*
diff --git a/bin/env.sh b/bin/sample/config.sh
similarity index 100%
rename from bin/env.sh
rename to bin/sample/config.sh
diff --git a/bin/start.sh b/bin/start.sh
index 6a6f304..9bc1ff0 100755
--- a/bin/start.sh
+++ b/bin/start.sh
@@ -8,10 +8,21 @@
 # Activate for debugging
 #set -x
 
-SPP_DIR=$(cd $(dirname $0); pwd)/..
+WORK_DIR=$(cd $(dirname $0); pwd)
+SPP_DIR=${WORK_DIR}/..
+
+DEFAULT_CONFIG=${WORK_DIR}/sample/config.sh
+CONFIG=${WORK_DIR}/config.sh
+
+if [ ! -f ${CONFIG} ]; then
+    echo "Creating config file ..."
+    cp ${DEFAULT_CONFIG} ${CONFIG}
+    echo "Edit '${CONFIG}' and run this script again!"
+    exit
+fi
 
 # import vars and functions
-. ${SPP_DIR}/bin/env.sh
+. ${CONFIG}
 
 echo "Start spp-ctl"
 python3 ${SPP_DIR}/src/spp-ctl/spp-ctl -b ${SPP_HOST_IP} \
-- 
2.17.1


                 reply	other threads:[~2019-05-31  8:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559292729-26993-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).