scripts/saveSample.sh
changeset 64 7dab8d1a2426
parent 63 89b41dbffe8d
child 84 dcb02306a338
     1.1 --- a/scripts/saveSample.sh	Mon May 07 09:04:02 2007 +0000
     1.2 +++ b/scripts/saveSample.sh	Mon May 07 15:57:02 2007 +0000
     1.3 @@ -27,17 +27,34 @@
     1.4  # Target triplet: CT_TARGET needs a little love:
     1.5  CT_DoBuildTargetTriplet
     1.6  
     1.7 +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
     1.8 +# re-parse them:
     1.9 +. "${CT_TOP_DIR}/.config"
    1.10 +
    1.11  # Create the sample directory
    1.12  [ -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ] || svn mkdir "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1
    1.13  
    1.14  # Save the crosstool-NG config file
    1.15  cp "${CT_TOP_DIR}/.config" "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    1.16  
    1.17 +# Function to copy a file to the sample directory
    1.18 +# Needed in case the file is already there (think of a previously available sample)
    1.19 +# Usage: CT_DoAddFileToSample <source> <dest>
    1.20 +CT_DoAddFileToSample() {
    1.21 +    source="$1"
    1.22 +    dest="$2"
    1.23 +    inode_s=`ls -i "${source}"`
    1.24 +    inode_d=`ls -i "${dest}"`
    1.25 +    if [ "${inode_s}" != "${inode_d}" ]; then
    1.26 +        cp "${source}" "${dest}"
    1.27 +    fi
    1.28 +    svn add "${dest}" >/dev/null 2>&1
    1.29 +}
    1.30 +
    1.31  # Save the kernel .config file
    1.32  if [ -n "${CT_KERNEL_LINUX_CONFIG_FILE}" ]; then
    1.33      # We save the file, and then point the saved sample to this file
    1.34 -    cp "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"
    1.35 -    svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" >/dev/null 2>&1
    1.36 +    CT_DoAddFileToSample "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"
    1.37      sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \
    1.38          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    1.39  else
    1.40 @@ -50,8 +67,7 @@
    1.41  # Save the uClibc .config file
    1.42  if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
    1.43      # We save the file, and then point the saved sample to this file
    1.44 -    cp "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    1.45 -    svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" >/dev/null 2>&1
    1.46 +    CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    1.47      sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
    1.48          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    1.49  else