X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=functions%2Fmain;h=14f39a9cf423a8324c76a7072f603b44d3aca0c8;hb=301a91366d75426eedf0d5994fc1241ab1d2fd47;hp=ec0e91143155309607c9c8687ed3505062cdbee2;hpb=340ea470736411a0fb1abed96caa0a8356dc81f1;p=hvlinux.git diff --git a/functions/main b/functions/main index ec0e911..14f39a9 100644 --- a/functions/main +++ b/functions/main @@ -2,6 +2,10 @@ set -o errtrace # Let shell functions inherit ERR trap. set -o errexit +# Don' t locate and remember (hash) commands as they are looked up for +# execution (don' t remember path): +set +h + hvtrap_setup() { # Setting ERR trap does implicit `set -o errexit'. @@ -566,11 +570,19 @@ hv_useradd() # Applying patch # First argument is the name of the patch -# Second argument is the package name (target dir in $LFS_TMP) +# Second argument is the package name +# Third argument: optional target directory (default is $LFS_TMP) apply_patch() { local PATCH_FILE=${1} - local TARGET_DIR=${2} + local PACKAGE=${2} + local TARGET_DIR="" + + if [ $# -eq 3 ]; then + TARGET_DIR=${3}/${PACKAGE} + else + TARGET_DIR=${LFS_TMP}/${PACKAGE} + fi if [ -z "${PATCH_FILE}" ]; then echo @@ -585,7 +597,7 @@ apply_patch() fi echo "Applying patch: ${PATCH_FILE}" - patch -Np1 -d ${LFS_TMP}/${TARGET_DIR} -i ${LFS_PKG_DIR}/${PATCH_FILE} + patch -Np1 -d ${TARGET_DIR} -i ${LFS_PKG_DIR}/${PATCH_FILE} } # Applying any patch(es) found for the current package. @@ -598,7 +610,7 @@ apply_patch() apply_patches() { PACKAGE=${1} - local TARGET_DIR=${PACKAGE} + local TARGET_DIR="" # Checking for correct number of arguments if [ $# -gt 2 ]; then @@ -609,15 +621,13 @@ apply_patches() if [ $# -eq 2 ]; then TARGET_DIR=${2} - else - TARGET_DIR=${PACKAGE} fi # Checking if we can find at least one patch. if ls ${LFS_PKG_DIR}/${1}-*.patch 1> /dev/null 2>&1; then cd ${LFS_PKG_DIR} for patch in ${1}-*.patch; do - apply_patch ${patch} ${TARGET_DIR} + apply_patch ${patch} ${PACKAGE} ${TARGET_DIR} done fi @@ -796,7 +806,7 @@ indicate_pkg_build_complete() # Arg. #1: Package name and version (ex: gcc-4.5.1) # Remaining arguments: Additional configure options # Options: -# -c Do not decompress package to ${LFS_TMP} +# -c Do not decompress package # -j Disable parallel make for this package # -l Unique identification label in 'install.log' # (default is package name and version)