tools/catalyst-auto: Allow multiple config files, for host-specific overrides.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
parent
b3244cc22d
commit
9b18c9796e
|
@ -17,7 +17,8 @@ if [[ -z ${UNSHARE} ]] ; then
|
||||||
fi
|
fi
|
||||||
unset UNSHARE
|
unset UNSHARE
|
||||||
|
|
||||||
config_file=
|
declare -a config_files
|
||||||
|
config_files=()
|
||||||
verbose=0
|
verbose=0
|
||||||
keep_tmpdir=0
|
keep_tmpdir=0
|
||||||
testing=0
|
testing=0
|
||||||
|
@ -98,7 +99,7 @@ do
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-c|--config)
|
-c|--config)
|
||||||
config_file=$1
|
config_files+=("$1")
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
|
@ -117,15 +118,24 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
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.
|
# Probe the default gitdir from this script name.
|
||||||
GITDIR=$(dirname "$(dirname "$(realpath "$0")")")
|
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)
|
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" catalyst-auto.XXXXXX)
|
||||||
DATESTAMP=$(date +%Y%m%d)
|
DATESTAMP=$(date +%Y%m%d)
|
||||||
|
|
Loading…
Reference in a new issue