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 52843138334 for ; Sun, 14 Jul 2019 13:00:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 76A95E08AB; Sun, 14 Jul 2019 13:00:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 336F5E08A2 for ; Sun, 14 Jul 2019 13:00:36 +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 2681F347AA1 for ; Sun, 14 Jul 2019 13:00:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 101C8715 for ; Sun, 14 Jul 2019 13:00:30 +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: <1563105497.7ad73a609d5e65fcc0ed9dd087da1f0cc3cd5e4c.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: 7ad73a609d5e65fcc0ed9dd087da1f0cc3cd5e4c X-VCS-Branch: master Date: Sun, 14 Jul 2019 13:00:30 +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: 9ac8d815-9c44-4cd8-b0e1-83364886a8ae X-Archives-Hash: c1955a25a8e3b52cc796d4103fd77f0b commit: 7ad73a609d5e65fcc0ed9dd087da1f0cc3cd5e4c Author: Thomas Deutschmann gentoo org> AuthorDate: Sun Jul 14 09:48:49 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Jul 14 11:58:17 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=7ad73a60 gen_initramfs.sh: Refactor append_modules() Signed-off-by: Thomas Deutschmann gentoo.org> gen_initramfs.sh | 66 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/gen_initramfs.sh b/gen_initramfs.sh index c46721a..26b2ea3 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1096,21 +1096,29 @@ print_list() } append_modules() { - local group - local group_modules - local MOD_EXT="$(modules_kext)" - - if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ] + local TDIR="${TEMP}/initramfs-modules-${KV}-temp" + if [ -d "${TDIR}" ] then - rm -r "${TEMP}/initramfs-modules-${KV}-temp/" + rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!" fi - print_info 2 "$(getIndent 2)modules: >> Copying modules to initramfs..." + mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!" + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" + + local mydir= + for mydir in \ + etc/modules \ + lib/modules/${KV} \ + ; do + mkdir -p "${TDIR}"/${mydir} || gen_die "Failed to create '${TDIR}/${mydir}'!" + done + + print_info 2 "$(get_indent 2)modules: >> Copying modules to initramfs ..." if [ "${INSTALL_MOD_PATH}" != '' ] then - cd ${INSTALL_MOD_PATH} || gen_die "Failed to chdir into '${INSTALL_MOD_PATH}'!" + cd "${INSTALL_MOD_PATH}" || gen_die "Failed to chdir to '${INSTALL_MOD_PATH}'!" else - cd / || gen_die "Failed to chdir into '/'!" + cd / || gen_die "Failed to chdir to '/'!" fi local _MODULES_DIR="${PWD%/}/lib/modules/${KV}" @@ -1122,45 +1130,45 @@ append_modules() { gen_die "${error_message}" fi - mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}" - + local i= mymod= + local MOD_EXT="$(modules_kext)" local n_copied_modules=0 - for i in `gen_dep_list` + for i in $(gen_dep_list) do - mymod=`find "${_MODULES_DIR}" -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 ` + mymod=$(find "${_MODULES_DIR}" -name "${i}${MOD_EXT}" 2>/dev/null | head -n 1) if [ -z "${mymod}" ] then - print_warning 2 "$(getIndent 3) - ${i}${MOD_EXT} not found; skipping..." + print_warning 2 "$(get_indent 3) - ${i}${MOD_EXT} not found; Skipping ..." continue; fi - print_info 2 "$(getIndent 3) - Copying ${i}${MOD_EXT}..." - cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp" || - gen_die "failed to copy '${mymod}' to '${TEMP}/initramfs-modules-${KV}-temp'" + print_info 2 "$(get_indent 3) - Copying ${i}${MOD_EXT} ..." + cp -ax --parents "${mymod}" "${TDIR}"/ 2>/dev/null \ + || gen_die "Failed to copy '${mymod}' to '${TDIR}/'!" n_copied_modules=$[$n_copied_modules+1] done if [ ${n_copied_modules} -eq 0 ] then - print_warning 1 "$(getIndent 2)modules: ${n_copied_modules} modules copied. Is that correct?" + print_warning 1 "$(get_indent 2)modules: ${n_copied_modules} modules copied. Is that correct?" else - print_info 2 "$(getIndent 2)modules: ${n_copied_modules} modules copied!" + print_info 2 "$(get_indent 2)modules: ${n_copied_modules} modules copied!" fi - cp -ax --parents "${_MODULES_DIR}"/modules* ${TEMP}/initramfs-modules-${KV}-temp || - gen_die "failed to copy '${_MODULES_DIR}/modules*' to '${TEMP}/initramfs-modules-${KV}-temp'" + cp -ax --parents "${_MODULES_DIR}"/modules* "${TDIR}"/ 2>/dev/null \ + || gen_die "Failed to copy '${_MODULES_DIR}/modules*' to '${TDIR}/'!" - mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules" + local group_modules= group= for group_modules in ${!MODULES_*}; do - group="$(echo $group_modules | cut -d_ -f2- | tr "[:upper:]" "[:lower:]")" - print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}" + 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}'!" done - cd "${TEMP}/initramfs-modules-${KV}-temp/" + + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" log_future_cpio_content - find . | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ - || gen_die "compressing modules cpio" - cd "${TEMP}" - rm -r "${TEMP}/initramfs-modules-${KV}-temp/" + find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ + || gen_die "Failed to append modules-${KV} to cpio!" } append_modprobed() {