commit:     9b18c9796e4173b7d404239fa7a516edbc05a561
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 26 07:17:34 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Jan 26 07:17:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=9b18c979

tools/catalyst-auto: Allow multiple config files, for host-specific overrides.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 tools/catalyst-auto | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/tools/catalyst-auto b/tools/catalyst-auto
index d42e97e..684531f 100755
--- a/tools/catalyst-auto
+++ b/tools/catalyst-auto
@@ -17,7 +17,8 @@ if [[ -z ${UNSHARE} ]] ; then
 fi
 unset UNSHARE
 
-config_file=
+declare -a config_files
+config_files=()
 verbose=0
 keep_tmpdir=0
 testing=0
@@ -98,7 +99,7 @@ do
       exit 0
       ;;
     -c|--config)
-      config_file=$1
+      config_files+=("$1")
       shift
       ;;
     -v|--verbose)
@@ -117,15 +118,24 @@ do
     esac
 done
 
-# Make sure all required values were specified
-if [ -z "${config_file}" -o ! -e "${config_file}" ]; then
-  usage "ERROR: You must specify a valid config file to use"
-  exit 1
-fi
-
 # Probe the default gitdir from this script name.
 GITDIR=$(dirname "$(dirname "$(realpath "$0")")")
-source ${config_file}
+
+doneconfig=0
+for config_file in ${config_files[@]}; do
+    # Make sure all required values were specified
+    if [ -z "${config_file}" -o ! -e "${config_file}" ]; then
+      usage "ERROR: You must specify a valid config file to use: 
'$config_file' is not valid"
+      exit 1
+    fi
+    source ${config_file}
+    doneconfig=1
+done
+if [[ $doneconfig -eq 0 ]]; then
+      usage "ERROR: You must specify at least one valid config file to use"
+      exit 1
+fi
+
 
 TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" catalyst-auto.XXXXXX)
 DATESTAMP=$(date +%Y%m%d)

Reply via email to