X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=functions%2Fmain;h=246031492ef94cac1ccb78d5b8cf55066a1b17a8;hb=f17ab848cb756cad27489bf0c2746e5ead466658;hp=7c071db87c1315543d82765e3929298920eb0b88;hpb=71a4362438cd17248be2046e845e48c638e309dd;p=hvlinux.git diff --git a/functions/main b/functions/main index 7c071db..2460314 100644 --- a/functions/main +++ b/functions/main @@ -147,6 +147,7 @@ init_log_file() test_presence_of_packages_directory export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}" + export LFS_PATCHES_DIR="${SCRDIR}/patches" export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/${LFS_STAGE} export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log export LFS_TMP="${LFS}/tmp" @@ -585,15 +586,17 @@ hv_useradd() # Applying patch # First argument is the name of the patch # Second argument is the package name -# Third argument: optional target directory (default is $LFS_TMP) +# Third argument is the subdirectory inside the patches directory +# Fourth argument: optional target directory (default is $LFS_TMP) apply_patch() { local PATCH_FILE=${1} local PACKAGE=${2} + local PDIR=${3} local TARGET_DIR="" - if [ $# -eq 3 ]; then - TARGET_DIR=${3}/${PACKAGE} + if [ $# -eq 4 ]; then + TARGET_DIR=${4}/${PACKAGE} else TARGET_DIR=${LFS_TMP}/${PACKAGE} fi @@ -604,14 +607,14 @@ apply_patch() return ${EXIT_FAILURE} fi - if [ ! -f ${LFS_PKG_DIR}/${PATCH_FILE} ]; then + if [ ! -f ${PDIR}/${PATCH_FILE} ]; then echo echo "${FUNCNAME}(): patch file '${PATCH_FILE}' not found." return ${EXIT_FAILURE} fi echo "Applying patch: ${PATCH_FILE}" - patch -Np1 -d ${TARGET_DIR} -i ${LFS_PKG_DIR}/${PATCH_FILE} + patch -Np1 -d ${TARGET_DIR} -i ${PDIR}/${PATCH_FILE} } # Applying any patch(es) found for the current package. @@ -637,13 +640,17 @@ apply_patches() TARGET_DIR=${2} 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} ${PACKAGE} ${TARGET_DIR} - done - fi + for s in common ${HVL_TARGET}; do + pdir=${LFS_PATCHES_DIR}/${s} + if [ -d ${pdir} ]; then + if ls ${pdir}/${1}-*.patch 1> /dev/null 2>&1; then + cd ${pdir} + for patch in ${1}-*.patch; do + apply_patch ${patch} ${PACKAGE} ${pdir} ${TARGET_DIR} + done + fi + fi + done return $? }