diff --git a/utils/generate-defconfig.sh b/utils/generate-defconfig.sh index b4ff2bb5..4cdd7a59 100755 --- a/utils/generate-defconfig.sh +++ b/utils/generate-defconfig.sh @@ -1,5 +1,6 @@ #!/bin/sh # Create new defconfigs by only applying the changes from a standard defconfig + set -e SCRIPT_DIR="$(readlink -f $(dirname -- "$0"))" @@ -7,28 +8,27 @@ MERGE_CONFIG="${SCRIPT_DIR}/../buildroot/support/kconfig/merge_config.sh" usage() { cat <&2 exit 1 @@ -38,31 +38,34 @@ check_file() { fi } +base="" +output="" +changes="" while [ $# -gt 0 ]; do case $1 in - -b|--base) - base="$2" - shift 2 - ;; - -c|--changes) - changes="$2" - shift 2 - ;; - -o|--output) - output="$2" - shift 2 - ;; - *) - usage - exit 1 - ;; + -b|--base) + base="$2" + shift 2 + ;; + -c|--changes) + changes="$changes $2" + shift 2 + ;; + -o|--output) + output="$2" + shift 2 + ;; + *) + usage + exit 1 + ;; esac done -if [ -z $output ] || [ -z $changes ] || [ -z $output ]; then - usage - exit 1 +if [ -z "$base" ] || [ -z "$changes" ] || [ -z "$output" ]; then + usage + exit 1 fi if [ ! -x "$MERGE_CONFIG" ]; then @@ -71,10 +74,13 @@ if [ ! -x "$MERGE_CONFIG" ]; then fi check_file "$base" "Base config" -check_file "$changes" "Changes config" +for change in $changes; do + check_file "$change" "Changes config" +done TMPDIR=`mktemp -d` $MERGE_CONFIG -O "$TMPDIR" "$base" "$changes" + O="$TMPDIR" make savedefconfig mv "$TMPDIR"/defconfig "$output" rm -r "$TMPDIR"