aboutsummaryrefslogtreecommitdiff
path: root/scripts/saveSample.sh.in
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2016-12-13 18:40:47 -0800
committerAlexey Neyman <stilor@att.net>2017-01-19 18:08:29 -0800
commit3e4d4870c9b7506c7a114fdb8789f78fd551c171 (patch)
treea6289993f026feb3a83ca98621d7f5297cf4f232 /scripts/saveSample.sh.in
parent955f5bc0b8a879ba5d1b9a65a31cc235c9fd9be8 (diff)
downloadcrosstool-ng-3e4d4870c9b7506c7a114fdb8789f78fd551c171.tar.gz
crosstool-ng-3e4d4870c9b7506c7a114fdb8789f78fd551c171.tar.bz2
crosstool-ng-3e4d4870c9b7506c7a114fdb8789f78fd551c171.zip
Simplify config saving.
Instead of hardcoding defaults in saveSample.sh.in, have the same defaults in config. Then we can just remove them when saving the config.
Diffstat (limited to 'scripts/saveSample.sh.in')
-rw-r--r--scripts/saveSample.sh.in19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index 4fa1c876..646c1893 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -40,14 +40,17 @@ esac
samp_dir="samples/${samp_name}"
mkdir -p "${samp_dir}"
-# Tweak the .config file.
-cp .config .defconfig
-"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
- -e 's|^# CT_LOG_TO_FILE is not set$|CT_LOG_TO_FILE=y|;' \
- -e 's|^# CT_LOG_FILE_COMPRESS is not set$|CT_LOG_FILE_COMPRESS=y|;' \
- -e 's|^(CT_LOCAL_TARBALLS_DIR)=.*|\1="${HOME}/src"|;' \
- <.config \
- >.defconfig
+# Tweak the .config file: remove the options that we want to keep
+# at default setting in samples.
+force_default_opts=( \
+ PREFIX_DIR LOG_TO_FILE LOG_FILE_COMPRESS \
+ LOCAL_TARBALLS_DIR SAVE_TARBALLS \
+ LOG_ERROR LOG_WARN LOG_INFO LOG_EXTRA LOG_ALL LOG_DEBUG \
+ LOG_PROGRESS_BAR
+ )
+regexp=${force_default_opts[*]}
+regexp=${regexp// /|}
+grep -v -E '^(# )?CT_('"${regexp}"')' .config > .defconfig
# Function to copy a file to the sample directory
# Needed in case the file is already there (think of a previously available sample)