From 279d726b9f78b4e594ec73017983db86895d0fbd Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Fri, 12 Mar 2021 02:53:45 +0000 Subject: [PATCH] config/functions: reduce use of basename and dirname Signed-off-by: Ian Leonard --- config/functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/functions b/config/functions index 1274145d97..e42a3f4c75 100644 --- a/config/functions +++ b/config/functions @@ -669,7 +669,7 @@ init_package_cache() { export _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL # overwrite existing cache files only when they are invalid, or not yet created - mkdir -p "$(dirname "${_CACHE_PACKAGE_GLOBAL}")" + mkdir -p "${_CACHE_PACKAGE_GLOBAL%/*}" if [ -f "${_CACHE_PACKAGE_LOCAL}" ] && cmp -s "${temp_local}" "${_CACHE_PACKAGE_LOCAL}"; then rm "${temp_local}" else @@ -781,7 +781,7 @@ check_arch() { for arch in ${linux_config_dir}/*.conf ${linux_config_dir}/*/linux.${TARGET_ARCH}.conf; do [[ ${arch} =~ .*\*.* ]] && continue #ignore unexpanded wildcard - arch_err_msg+="\n - $(basename ${arch} | cut -f2 -d".")" + arch_err_msg+="\n - $(echo ${arch##*/} | cut -f2 -d".")" done die "${arch_err_msg}" fi @@ -1128,7 +1128,7 @@ source_package() { unset_functions if [ -n "${1}" ]; then - [ -f "${1}" ] && PKG_DIR="$(dirname "${1}")" || PKG_DIR="$(get_pkg_directory "${1}")" + [ -f "${1}" ] && PKG_DIR="${1%/*}" || PKG_DIR="$(get_pkg_directory "${1}")" [ -n "$PKG_DIR" -a -r $PKG_DIR/package.mk ] || die "FAILURE: unable to source package - ${1}/package.mk does not exist" @@ -1423,7 +1423,7 @@ done for f in $PKG_DIR/source/resources/screenshot-*.{jpg,png}; do if [ -f "$f" ]; then - screenshots+="resources/$(basename $f)\n" + screenshots+="resources/${f##*/}\n" fi done