From 656f62c033375d3e41d97cde89ee23ddd9e2548a Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Wed, 9 Sep 2020 11:47:14 +0800
Subject: [PATCH] WIP: add a setup script in CEPCSW.

---
 setup.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 setup.sh

diff --git a/setup.sh b/setup.sh
new file mode 100644
index 00000000..222137c3
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+##############################################################################
+# Setup script for CEPCSW:
+# - setup the external libraries
+#
+# Usage:
+# $ source setup.sh
+# or:
+# $ source setup.sh 97.0.2
+#
+# Author: Tao Lin <lintao@ihep.ac.cn>
+##############################################################################
+
+function info:() {
+    echo "INFO: $*" 1>&2
+}
+
+function error:() {
+    echo "ERROR: $*" 1>&2
+}
+
+function lcg-version() {
+    echo ${CEPCSW_LCG_VERSION}
+}
+
+function cepcsw-base() {
+    echo /cvmfs/cepcsw.ihep.ac.cn/prototype
+}
+
+function cepcsw-external() {
+    echo $(cepcsw-base)/releases/externals/$(lcg-version)
+}
+
+function setup-external() {
+    local f=$(cepcsw-external)/setup.sh
+    if [ ! -f $f ]; then
+        error: "Failed to find setup script $f"
+        return
+    fi
+
+    info: "Setup CEPCSW externals: $f"
+    source $f
+
+}
+
+
+##############################################################################
+# Parse the command line options
+##############################################################################
+
+CEPCSW_LCG_VERSION=${1}; shift
+
+if [ -z "$CEPCSW_LCG_VERSION" ]; then
+    CEPCSW_LCG_VERSION=97.0.2
+fi
+
+setup-external
-- 
GitLab