From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BA345138334 for ; Tue, 23 Jul 2019 19:47:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 01190E086C; Tue, 23 Jul 2019 19:47:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C8A06E084E for ; Tue, 23 Jul 2019 19:47:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AA60F348517 for ; Tue, 23 Jul 2019 19:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4C2E14D3 for ; Tue, 23 Jul 2019 19:47:16 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1563908410.75fd4f4d05df729511f071b2c1a163f08f522622.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 75fd4f4d05df729511f071b2c1a163f08f522622 X-VCS-Branch: master Date: Tue, 23 Jul 2019 19:47:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7942fa47-bde2-4d32-876b-b8148f2b6df1 X-Archives-Hash: 04bd6cbca842df16782f3ad8484b70f2 commit: 75fd4f4d05df729511f071b2c1a163f08f522622 Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Jul 23 19:00:10 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Tue Jul 23 19:00:10 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=75fd4f4d gen_initramfs.sh: Refactor append_modules() to not include --module-prefix Make sure to chdir into ${INSTALL_MOD_PATH%/}/lib/modules/${KV} before copying modules to avoid inclusion of --module-prefix path. Bug: https://bugs.gentoo.org/690260 Signed-off-by: Thomas Deutschmann gentoo.org> gen_initramfs.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 1fcfdce..eb3aed7 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1301,29 +1301,32 @@ append_modules() { mkdir -p "${TDIR}"/${mydir} || gen_die "Failed to create '${TDIR}/${mydir}'!" done + local modules_dstdir="${TDIR}/lib/modules/${KV}" + local modules_srcdir="/lib/modules/${KV}" + print_info 2 "$(get_indent 2)modules: >> Copying modules to initramfs ..." - if [ "${INSTALL_MOD_PATH}" != '' ] + + if [ -n "${INSTALL_MOD_PATH}" ] then - cd "${INSTALL_MOD_PATH}" || gen_die "Failed to chdir to '${INSTALL_MOD_PATH}'!" - else - cd / || gen_die "Failed to chdir to '/'!" + modules_srcdir="${INSTALL_MOD_PATH%/}${modules_srcdir}" fi - local _MODULES_DIR="${PWD%/}/lib/modules/${KV}" - if [ ! -d "${_MODULES_DIR}" ] + if [ ! -d "${modules_srcdir}" ] then - error_message="'${_MODULES_DIR}' does not exist! Did you forget" + error_message="'${modules_srcdir}' does not exist! Did you forget" error_message+=" to compile kernel before building initramfs?" error_message+=" If you know what you are doing please set '--no-ramdisk-modules'." gen_die "${error_message}" fi + cd "${modules_srcdir}" || gen_die "Failed to chdir to '${modules_srcdir}'!" + local i= mymod= local MOD_EXT="$(modules_kext)" local n_copied_modules=0 for i in $(gen_dep_list) do - mymod=$(find "${_MODULES_DIR}" -name "${i}${MOD_EXT}" 2>/dev/null | head -n 1) + mymod=$(find . -name "${i}${MOD_EXT}" 2>/dev/null | head -n 1) if [ -z "${mymod}" ] then print_warning 3 "$(get_indent 3) - ${i}${MOD_EXT} not found; Skipping ..." @@ -1331,8 +1334,8 @@ append_modules() { fi print_info 3 "$(get_indent 3) - Copying ${i}${MOD_EXT} ..." - cp -ax --parents "${mymod}" "${TDIR}"/ 2>/dev/null \ - || gen_die "Failed to copy '${mymod}' to '${TDIR}/'!" + cp -ax --parents --target-directory "${modules_dstdir}" "${mymod}" 2>/dev/null \ + || gen_die "Failed to copy '${modules_srcdir}/${mymod}' to '${modules_dstdir}'!" n_copied_modules=$[$n_copied_modules+1] done @@ -1343,11 +1346,12 @@ append_modules() { print_info 2 "$(get_indent 2)modules: ${n_copied_modules} modules copied!" fi - cp -ax --parents "${_MODULES_DIR}"/modules* "${TDIR}"/ 2>/dev/null \ - || gen_die "Failed to copy '${_MODULES_DIR}/modules*' to '${TDIR}/'!" + cp -ax --parents --target-directory "${modules_dstdir}" modules* 2>/dev/null \ + || gen_die "Failed to copy '${modules_srcdir}/modules*' to '${modules_dstdir}'!" local group_modules= group= - for group_modules in ${!MODULES_*}; do + for group_modules in ${!MODULES_*} + do group="$(echo ${group_modules} | cut -d_ -f2- | tr "[:upper:]" "[:lower:]")" print_list ${!group_modules} > "${TDIR}"/etc/modules/${group} \ || gen_die "Failed to create '${TDIR}/etc/modules/${group}'!"