summaryrefslogtreecommitdiff
path: root/scripts/saveSample.sh.in
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-01-24 22:54:42 (GMT)
committerGitHub <noreply@github.com>2017-01-24 22:54:42 (GMT)
commitb5d0e396d9ad0c886ab487bd26776bda92e5f40c (patch)
tree7bfe2a05f5dcee235ddc448dc3bde53882c8318c /scripts/saveSample.sh.in
parent027a75cbf0e8361160485b5869f3a554cf44977c (diff)
parent832bee87c03ce2fecdbf8b00996fc1fca8f2b2e0 (diff)
Merge pull request #547 from stilor/separate-canadian-crosses-instdir
Simplify the pre-build actions a bit
Diffstat (limited to 'scripts/saveSample.sh.in')
-rw-r--r--scripts/saveSample.sh.in52
1 files changed, 12 insertions, 40 deletions
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index a070dc2..646c189 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -10,29 +10,14 @@
# Parse the tools' paths configuration
. "${CT_LIB_DIR}/paths.sh"
-
-# We'll need the stdout later, save it
-exec 7>&1
-
. "${CT_LIB_DIR}/scripts/functions"
-# Don't care about any log file
-exec >/dev/null
-rm -f "${tmp_log_file}"
-
-# Parse the configuration file
-# Don't use CT_TestOrAbort, it prints the test string to [DEBUG]
-# Note: we just need the non-mangled .config, not .config.2
-if [ ! -f .config ]; then
- CT_Abort "Configuration file not found. Please create one."
-fi
-. .config
+CT_LoadConfig
# We can not reliably save a sample which either uses local patches
# and/or custom Linux kernel headers. Warn the user about this issue
# and continue if he/she confirms sving the sample.
if [ "${CT_CUSTOM_PATCH}" = "y" ]; then
- exec >&7
echo "You are using local patches."
echo "You will not be able to (easily) share this sample in this case."
read -p "Press Ctrl-C to stop now, or Enter to continue..."
@@ -41,17 +26,6 @@ fi
# Do not use a progress bar
unset CT_LOG_PROGRESS_BAR
-# Parse architecture and kernel specific functions
-. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
-. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
-
-# Target tuple: CT_TARGET needs a little love:
-CT_DoBuildTargetTuple
-
-# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
-# re-parse them:
-. .config
-
# Override log options
unset CT_LOG_PROGRESS_BAR CT_LOG_ERROR CT_LOG_INFO CT_LOG_EXTRA CT_LOG_DEBUG LOG_ALL
CT_LOG_WARN=y
@@ -66,16 +40,17 @@ esac
samp_dir="samples/${samp_name}"
mkdir -p "${samp_dir}"
-# Tweak the .config file
-# We need to be based on the real .config with kconfig's values,
-# not our mangled .config.2 with shell arrays
-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)
@@ -114,9 +89,6 @@ export KCONFIG_CONFIG="$(pwd)/.defconfig"
${CONF} --savedefconfig="${samp_dir}/crosstool.config" "${KCONFIG_TOP}"
rm -f .defconfig
-# Restore stdout now, to be interactive
-exec >&7
-
# Fill-in the reported-by info
[ -f "${samp_dir}/reported.by" ] && . "${samp_dir}/reported.by"
old_name="${reporter_name}"