scripts/functions
changeset 3075 aadd4647dd91
parent 3048 2858a24a5846
child 3082 39ec9e913d79
     1.1 --- a/scripts/functions	Sun Aug 12 07:45:42 2012 -0400
     1.2 +++ b/scripts/functions	Thu Oct 04 13:26:14 2012 +1000
     1.3 @@ -516,6 +516,41 @@
     1.4      return 1
     1.5  }
     1.6  
     1.7 +# This function gets the custom source from either a tarball or directory
     1.8 +# Usage: CT_GetCustom <component> <custom_version> <custom_location>
     1.9 +CT_GetCustom() {
    1.10 +    local custom_component="$1"
    1.11 +    local custom_version="$2"
    1.12 +    local custom_location="$3"
    1.13 +    local custom_name="${custom_component}-${custom_version}"
    1.14 +
    1.15 +    CT_TestAndAbort "${custom_name}: CT_CUSTOM_LOCATION_ROOT_DIR or ${custom_component}'s CUSTOM_LOCATION must be set." \
    1.16 +                    -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${custom_location}"
    1.17 +
    1.18 +    if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" \
    1.19 +         -a -z "${custom_location}"          ]; then
    1.20 +        custom_location="${CT_CUSTOM_LOCATION_ROOT_DIR}/${custom_component}"
    1.21 +    fi
    1.22 +
    1.23 +    CT_DoLog EXTRA "Using '${custom_name}' from custom location"
    1.24 +    if [ ! -d "${custom_location}" ]; then
    1.25 +        # We need to know the custom tarball extension,
    1.26 +        # so we can create a properly-named symlink, which
    1.27 +        # we use later on in 'extract'
    1.28 +        case "${custom_location}" in
    1.29 +            *.tar.bz2)      custom_name="${custom_name}.tar.bz2";;
    1.30 +            *.tar.gz|*.tgz) custom_name="${custom_name}.tar.gz";;
    1.31 +            *.tar)          custom_name="${custom_name}.tar";;
    1.32 +            *)  CT_Abort "Unknown extension for custom tarball '${custom_location}'";;
    1.33 +        esac
    1.34 +        CT_DoExecLog DEBUG ln -sf "${custom_location}"  \
    1.35 +                                  "${CT_TARBALLS_DIR}/${custom_name}"
    1.36 +    else
    1.37 +        CT_DoExecLog DEBUG ln -snf "${custom_location}" \
    1.38 +                                   "${CT_SRC_DIR}/${custom_name}"
    1.39 +    fi
    1.40 +}
    1.41 +
    1.42  # This function saves the specified to local storage if possible,
    1.43  # and if so, symlinks it for later usage
    1.44  # Usage: CT_SaveLocal </full/path/file.name>