summaryrefslogtreecommitdiff
path: root/scripts/saveSample.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/saveSample.sh.in')
-rw-r--r--scripts/saveSample.sh.in27
1 files changed, 15 insertions, 12 deletions
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index 6b3f205..6a097a6 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -59,18 +59,21 @@ unset CT_LOG_PROGRESS_BAR CT_LOG_ERROR CT_LOG_INFO CT_LOG_EXTRA CT_LOG_DEBUG LOG
CT_LOG_WARN=y
CT_LOG_LEVEL_MAX="WARN"
-# Create the sample directory
-if [ ! -d "samples/${CT_TARGET}" ]; then
- mkdir -p "samples/${CT_TARGET}"
-fi
+# Compute the name of the sample directory
+case "${CT_TOOLCHAIN_TYPE}" in
+ cross) samp_name="${CT_TARGET}";;
+ *) CT_Abort "Unsupported toolchain type '${CT_TOOLCHAIN_TYPE}'";;
+esac
+samp_dir="samples/${samp_name}"
+mkdir -p "${samp_dir}"
# Save the crosstool-NG config file
-"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
+"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${samp_name}"|;' \
-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 \
- >"samples/${CT_TARGET}/crosstool.config"
+ >"${samp_dir}/crosstool.config"
# Function to copy a file to the sample directory
# Needed in case the file is already there (think of a previously available sample)
@@ -94,12 +97,12 @@ fi
# Save the uClibc .config file
if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
# We save the file, and then point the saved sample to this file
- CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
- "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
- "samples/${CT_TARGET}/crosstool.config"
+ CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
+ "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
+ "${samp_dir}/crosstool.config"
else
# remove any dangling files
- for f in "samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
+ for f in "${samp_dir}/${CT_LIBC}-"*.config; do
if [ -f "${f}" ]; then rm -f "${f}"; fi
done
fi
@@ -108,7 +111,7 @@ fi
exec >&7
# Fill-in the reported-by info
-[ -f "samples/${CT_TARGET}/reported.by" ] && . "samples/${CT_TARGET}/reported.by"
+[ -f "${samp_dir}/reported.by" ] && . "${samp_dir}/reported.by"
old_name="${reporter_name}"
old_url="${reporter_url}"
read -p "Reporter name [${reporter_name}]: " reporter_name
@@ -123,4 +126,4 @@ reporter_comment=$(cat)
( echo "reporter_name=\"${reporter_name:=${old_name}}\""
echo "reporter_url=\"${reporter_url:=${old_url}}\""
printf "reporter_comment=\"${reporter_comment}\"\n"
-) >"samples/${CT_TARGET}/reported.by"
+) >"${samp_dir}/reported.by"