diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2016-01-25 23:17:34 -0800 |
---|---|---|
committer | Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto@gentoo.org> | 2016-03-24 03:33:35 +0000 |
commit | 19c5dbfc26179bd860a28bf2e89dbd35c697d6de (patch) | |
tree | 8aa176da0606b056e0e732cf3e553e6e37d00864 | |
parent | Sync cloud-prep.sh's from master. (diff) | |
download | releng-19c5dbfc26179bd860a28bf2e89dbd35c697d6de.tar.gz releng-19c5dbfc26179bd860a28bf2e89dbd35c697d6de.tar.bz2 releng-19c5dbfc26179bd860a28bf2e89dbd35c697d6de.zip |
tools/catalyst-auto: Allow multiple config files, for host-specific overrides.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | tools/catalyst-auto | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/catalyst-auto b/tools/catalyst-auto index 770af1c8..3d0b4191 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) |