From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1078854-garchives=archives.gentoo.org@lists.gentoo.org> 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 4F6C6138334 for <garchives@archives.gentoo.org>; Thu, 21 Mar 2019 23:51:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 32242E089E; Thu, 21 Mar 2019 23:51:21 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 E644EE089E for <gentoo-commits@lists.gentoo.org>; Thu, 21 Mar 2019 23:51:20 +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 22883335D19 for <gentoo-commits@lists.gentoo.org>; Thu, 21 Mar 2019 23:51:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5D32C266 for <gentoo-commits@lists.gentoo.org>; Thu, 21 Mar 2019 23:51:17 +0000 (UTC) From: "Thomas Deutschmann" <whissi@gentoo.org> 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" <whissi@gentoo.org> Message-ID: <1553199991.631469dc525ca896b90220bd5712665eec4c4f82.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_compile.sh gen_funcs.sh gen_initramfs.sh genkernel X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 631469dc525ca896b90220bd5712665eec4c4f82 X-VCS-Branch: master Date: Thu, 21 Mar 2019 23:51:17 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ad6391ea-2484-4470-b536-ec59ea44465a X-Archives-Hash: 1437436f51d46b98808db814393e299c commit: 631469dc525ca896b90220bd5712665eec4c4f82 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> AuthorDate: Thu Mar 21 20:26:31 2019 +0000 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> CommitDate: Thu Mar 21 20:26:31 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=631469dc Unify output Use new "getIndent" function to unify output. Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> gen_compile.sh | 88 +++++++++++++++++++++---------------------- gen_funcs.sh | 17 +++++++++ gen_initramfs.sh | 111 +++++++++++++++++++++++++++++-------------------------- genkernel | 17 ++------- 4 files changed, 122 insertions(+), 111 deletions(-) diff --git a/gen_compile.sh b/gen_compile.sh index c287054..74319bd 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -212,7 +212,7 @@ apply_patches() { if [ -d "${patchdir}" ] then - print_info 1 "${util}: >> Applying patches..." + print_info 1 "$(getIndent 3)${util}: >> Applying patches..." for i in ${patchdir}/*{diff,patch} do [ -f "${i}" ] || continue @@ -229,13 +229,13 @@ apply_patches() { done if [ ${patch_success} -eq 1 ] then - print_info 1 " - `basename ${i}`" + print_info 1 "$(getIndent 4) - `basename ${i}`" else gen_die "could not apply patch ${i} for ${util}-${version}" fi done else - print_info 1 "${util}: >> No patches found in $patchdir ..." + print_info 1 "$(getIndent 3)${util}: >> No patches found in $patchdir ..." fi } @@ -305,21 +305,21 @@ compile_generic() { } compile_modules() { - print_info 1 " >> Compiling ${KV} modules..." + print_info 1 "$(getIndent 3)>> Compiling ${KV} modules..." cd ${KERNEL_DIR} compile_generic modules kernel export UNAME_MACHINE="${ARCH}" [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH if [ "${CMD_STRIP_TYPE}" == "all" -o "${CMD_STRIP_TYPE}" == "modules" ] then - print_info 1 " >> Installing ${KV} modules (and stripping)" + print_info 1 "$(getIndent 3)>> Installing ${KV} modules (and stripping)" INSTALL_MOD_STRIP=1 export INSTALL_MOD_STRIP else - print_info 1 " >> Installing ${KV} modules" + print_info 1 "$(getIndent 3)>> Installing ${KV} modules" fi MAKEOPTS="${MAKEOPTS} -j1" compile_generic "modules_install" kernel - print_info 1 " >> Generating module dependency data..." + print_info 1 "$(getIndent 3)>> Generating module dependency data..." if [ "${INSTALL_MOD_PATH}" != '' ] then depmod -a -e -F "${KERNEL_OUTPUTDIR}"/System.map -b "${INSTALL_MOD_PATH}" ${KV} @@ -338,30 +338,30 @@ compile_kernel() { if [ "${KERNEL_MAKE_DIRECTIVE_OVERRIDE}" != "${DEFAULT_KERNEL_MAKE_DIRECTIVE_OVERRIDE}" ]; then kernel_make_directive="${KERNEL_MAKE_DIRECTIVE_OVERRIDE}" fi - print_info 1 " >> Compiling ${KV} ${kernel_make_directive/_install/ [ install ]/}..." + print_info 1 "$(getIndent 3)>> Compiling ${KV} ${kernel_make_directive/_install/ [ install ]/}..." compile_generic "${kernel_make_directive}" kernel if [ "${KERNEL_MAKE_DIRECTIVE_2}" != '' ] then - print_info 1 " >> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..." + print_info 1 "$(getIndent 3)>> Starting supplimental compile of ${KV}: ${KERNEL_MAKE_DIRECTIVE_2}..." compile_generic "${KERNEL_MAKE_DIRECTIVE_2}" kernel fi if isTrue "${FIRMWARE_INSTALL}" && [ ! -e "${KERNEL_DIR}/ihex2fw.c" ] ; then # Kernel v4.14 removed firmware from the kernel sources, including the # ihex2fw.c tool source. Try and detect the tool to see if we are in >=v4.14 - print_warning 1 " >> Linux v4.14 removed in-kernel firmware, you MUST install the sys-kernel/linux-firmware package!" + print_warning 1 "$(getIndent 3)>> Linux v4.14 removed in-kernel firmware, you MUST install the sys-kernel/linux-firmware package!" elif isTrue "${FIRMWARE_INSTALL}" ; then local cfg_CONFIG_FIRMWARE_IN_KERNEL=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" CONFIG_FIRMWARE_IN_KERNEL) if isTrue "$cfg_CONFIG_FIRMWARE_IN_KERNEL"; then - print_info 1 " >> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..." + print_info 1 "$(getIndent 3)>> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)..." else - print_info 1 " >> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..." + print_info 1 "$(getIndent 3)>> Installing firmware ('make firmware_install') due to CONFIG_FIRMWARE_IN_KERNEL != y..." [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH [ "${INSTALL_FW_PATH}" != '' ] && export INSTALL_FW_PATH MAKEOPTS="${MAKEOPTS} -j1" compile_generic "firmware_install" kernel fi else - print_info 1 " >> Not installing firmware as requested by configuration FIRMWARE_INSTALL=no..." + print_info 1 "$(getIndent 3)>> Not installing firmware as requested by configuration FIRMWARE_INSTALL=no..." fi local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY_OVERRIDE:-${KERNEL_BINARY}}) @@ -446,10 +446,10 @@ compile_busybox() { newconfig_md5="$(md5sum < "${TEMP}/busybox-config")" if [ "${oldconfig_md5}" != "${newconfig_md5}" ] then - print_info 1 "busybox: >> Removing stale cache..." + print_info 1 "$(getIndent 3)busybox: >> Removing stale cache..." rm -rf "${BUSYBOX_BINCACHE}" else - print_info 1 "busybox: >> Using cache" + print_info 1 "$(getIndent 3)busybox: >> Using cache" fi fi @@ -472,13 +472,13 @@ compile_busybox() { apply_patches busybox ${BUSYBOX_VER} # This has the side-effect of changing the .config - print_info 1 'busybox: >> Configuring...' + print_info 1 "$(getIndent 3)busybox: >> Configuring..." yes '' 2>/dev/null | compile_generic oldconfig utils - print_info 1 'busybox: >> Compiling...' + print_info 1 "$(getIndent 3)busybox: >> Compiling..." compile_generic all utils V=1 - print_info 1 'busybox: >> Copying to cache...' + print_info 1 "$(getIndent 3)busybox: >> Copying to bincache..." [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] || gen_die 'Busybox executable does not exist!' ${UTILS_CROSS_COMPILE}strip "${TEMP}/${BUSYBOX_DIR}/busybox" || @@ -495,7 +495,7 @@ compile_busybox() { compile_lvm() { if [ -f "${LVM_BINCACHE}" ] then - print_info 1 "lvm: >> Using cache" + print_info 1 "$(getIndent 3)lvm: >> Using cache" else [ -f "${LVM_SRCTAR}" ] || gen_die "Could not find LVM source tarball: ${LVM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" @@ -506,13 +506,13 @@ compile_lvm() { [ -d "${LVM_DIR}" ] || gen_die "LVM directory ${LVM_DIR} is invalid!" cd "${LVM_DIR}" - print_info 1 'lvm: >> Patching ...' + print_info 1 "$(getIndent 3)lvm: >> Patching ..." apply_patches lvm ${LVM_VER} # we currently have a patch that changes configure.ac # once given patch is dropped, drop autoconf too - print_info 1 'lvm: >> Autoconf ...' + print_info 1 "$(getIndent 3)lvm: >> Autoconf ..." autoconf || gen_die 'Autoconf failed for LVM2' - print_info 1 'lvm: >> Configuring...' + print_info 1 "$(getIndent 3)lvm: >> Configuring..." LVM_CONF=( --enable-static_link --prefix=/ @@ -538,17 +538,17 @@ compile_lvm() { ./configure "${LVM_CONF[@]}" \ >> ${LOGFILE} 2>&1 || \ gen_die 'Configure of lvm failed!' - print_info 1 'lvm: >> Compiling...' + print_info 1 "$(getIndent 3)lvm: >> Compiling..." compile_generic '' utils || gen_die "failed to build LVM" mkdir -p "${TEMP}/lvm/sbin" - print_info 1 'lvm: >> Installing to DESTDIR...' + print_info 1 "$(getIndent 3)lvm: >> Installing to DESTDIR..." compile_generic "install DESTDIR=${TEMP}/lvm/" utils || gen_die "failed to install LVM" # Upstream does u-w on files, and this breaks stuff. chmod -R u+w "${TEMP}/lvm/" cd "${TEMP}/lvm" - print_info 1 ' >> Copying to bincache...' + print_info 1 "$(getIndent 3)lvm: >> Copying to bincache..." ${UTILS_CROSS_COMPILE}strip "sbin/lvm.static" || gen_die 'Could not strip lvm.static!' # See bug 382555 @@ -567,7 +567,7 @@ compile_lvm() { compile_mdadm() { if [ -f "${MDADM_BINCACHE}" ] then - print_info 1 ' MDADM: Using cache' + print_info 1 "$(getIndent 3)MDADM: Using cache" else [ -f "${MDADM_SRCTAR}" ] || gen_die "Could not find MDADM source tarball: ${MDADM_SRCTAR}! Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" @@ -588,13 +588,13 @@ compile_mdadm() { -e "s/^# LDFLAGS = -static/LDFLAGS = -static/" \ Makefile || gen_die "Failed to sed mdadm Makefile" - print_info 1 'mdadm: >> Compiling...' + print_info 1 "$(getIndent 3)mdadm: >> Compiling..." compile_generic 'mdadm mdmon' utils mkdir -p "${TEMP}/mdadm/sbin" install -m 0755 -s mdadm "${TEMP}/mdadm/sbin/mdadm" || gen_die "Failed mdadm install" install -m 0755 -s mdmon "${TEMP}/mdadm/sbin/mdmon" || gen_die "Failed mdmon install" - print_info 1 ' >> Copying to bincache...' + print_info 1 "$(getIndent 3)mdadm: >> Copying to bincache..." cd "${TEMP}/mdadm" ${UTILS_CROSS_COMPILE}strip "sbin/mdadm" "sbin/mdmon" || gen_die 'Could not strip mdadm binaries!' @@ -626,7 +626,7 @@ compile_dmraid() { cd "${DMRAID_DIR}" apply_patches dmraid ${DMRAID_VER} - print_info 1 'dmraid: >> Configuring...' + print_info 1 "$(getIndent 3)dmraid: >> Configuring..." LDFLAGS="-L${TEMP}/lvm/lib" \ CFLAGS="-I${TEMP}/lvm/include" \ @@ -644,13 +644,13 @@ compile_dmraid() { sed -i tools/Makefile -e "/DMRAID_LIBS +=/s|-lselinux||g" ###echo "DMRAIDLIBS += -lselinux -lsepol" >> tools/Makefile mkdir -p "${TEMP}/dmraid" - print_info 1 'dmraid: >> Compiling...' + print_info 1 "$(getIndent 3)dmraid: >> Compiling..." # Force dmraid to be built with -j1 for bug #188273 MAKEOPTS="${MAKEOPTS} -j1" compile_generic '' utils #compile_generic 'install' utils mkdir ${TEMP}/dmraid/sbin install -m 0755 -s tools/dmraid "${TEMP}/dmraid/sbin/dmraid" - print_info 1 ' >> Copying to bincache...' + print_info 1 "$(getIndent 3)dmraid: >> Copying to bincache..." cd "${TEMP}/dmraid" /bin/tar -cjf "${DMRAID_BINCACHE}" sbin/dmraid || gen_die 'Could not create binary cache' @@ -678,14 +678,14 @@ compile_fuse() { gen_die "fuse directory ${FUSE_DIR} invalid" cd "${FUSE_DIR}" apply_patches fuse ${FUSE_VER} - print_info 1 'fuse: >> Configuring...' + print_info 1 "$(getIndent 3)fuse: >> Configuring..." ./configure --disable-example >> ${LOGFILE} 2>&1 || gen_die 'Configuring fuse failed!' - print_info 1 'fuse: >> Compiling...' + print_info 1 "$(getIndent 3)fuse: >> Compiling..." MAKE=${UTILS_MAKE} compile_generic "" "" # Since we're linking statically against libfuse, we don't need to cache the .so -# print_info 1 'libfuse: >> Copying to cache...' +# print_info 1 "$(getIndent 3)libfuse: >> Copying to bincache..." # [ -f "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" ] || # gen_die 'libfuse.so does not exist!' # ${UTILS_CROSS_COMPILE}strip "${TEMP}/${FUSE_DIR}/lib/.libs/libfuse.so" || @@ -716,11 +716,11 @@ compile_unionfs_fuse() { gen_die "unionfs-fuse directory ${UNIONFS_FUSE_DIR} invalid" cd "${UNIONFS_FUSE_DIR}" apply_patches unionfs-fuse ${UNIONFS_FUSE_VER} - print_info 1 'unionfs-fuse: >> Compiling...' + print_info 1 "$(getIndent 3)unionfs-fuse: >> Compiling..." sed -i "/^\(CFLAGS\|CPPFLAGS\)/s:^\\(.*\\)$:\\1 -static -I${TEMP}/${FUSE_DIR}/include -L${TEMP}/${FUSE_DIR}/lib/.libs:" Makefile src/Makefile sed -i "/^LIB = /s:^LIB = \(.*\)$:LIB = -static -L${TEMP}/${FUSE_DIR}/lib/.libs \1 -ldl -lpthread -lrt:" Makefile src/Makefile MAKE=${UTILS_MAKE} compile_generic "" "" - print_info 1 'unionfs-fuse: >> Copying to cache...' + print_info 1 "$(getIndent 3)unionfs-fuse: >> Copying to bincache..." [ -f "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" ] || gen_die 'unionfs binary does not exist!' ${UTILS_CROSS_COMPILE}strip "${TEMP}/${UNIONFS_FUSE_DIR}/src/unionfs" || @@ -746,12 +746,12 @@ compile_iscsi() { tar -xpf "${ISCSI_SRCTAR}" [ ! -d "${ISCSI_DIR}" ] && gen_die "ISCSI directory ${ISCSI_DIR} invalid" - print_info 1 'iSCSI: >> Compiling...' + print_info 1 "$(getIndent 3)iSCSI: >> Compiling..." cd "${TEMP}/${ISCSI_DIR}" apply_patches iscsi ${ISCSI_VER} # Only build userspace - print_info 1 'iSCSI: >> Configuring userspace...' + print_info 1 "$(getIndent 3)iSCSI: >> Configuring userspace..." cd utils/open-isns || gen_die 'Could not enter open-isns dir' # we currently have a patch that changes configure.ac # once given patch is dropped, drop autoconf too @@ -772,8 +772,8 @@ compile_iscsi() { fi done - cd "${TEMP}/initramfs-iscsi-temp/" - print_info 1 'iscsistart: >> Copying to cache...' + cd "${TEMP}/initramfs-iscsi-temp/" + print_info 1 "$(getIndent 3)iscsistart: >> Copying to bincache..." [ -f "${TEMP}/${ISCSI_DIR}/usr/iscsistart" ] || gen_die 'iscsistart executable does not exist!' ${UTILS_CROSS_COMPILE}strip "${TEMP}/${ISCSI_DIR}/usr/iscsistart" || @@ -792,7 +792,7 @@ compile_iscsi() { compile_gpg() { if [ -f "${GPG_BINCACHE}" ] then - print_info 1 "gnupg: >> Using cache" + print_info 1 "$(getIndent 3)gnupg: >> Using cache" else [ ! -f "${GPG_SRCTAR}" ] && gen_die "Could not find gnupg source tarball: ${GPG_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!" @@ -803,7 +803,7 @@ compile_gpg() { gen_die "gnupg directory ${GPG_DIR} invalid" cd "${GPG_DIR}" apply_patches gnupg ${GPG_VER} - print_info 1 'gnupg: >> Configuring...' + print_info 1 "$(getIndent 3)gnupg: >> Configuring..." # --enable-minimal works, but it doesn't reduce the command length much. # Given its history and the precision this needs, explicit is cleaner. LDFLAGS='-static' CFLAGS='-Os' ./configure --prefix=/ \ @@ -819,9 +819,9 @@ compile_gpg() { --without-libpth-prefix --without-libiconv-prefix --without-libintl-prefix\ --without-zlib --without-bzip2 --without-libusb --without-readline \ >> ${LOGFILE} 2>&1 || gen_die 'Configuring gnupg failed!' - print_info 1 'gnupg: >> Compiling...' + print_info 1 "$(getIndent 3)gnupg: >> Compiling..." compile_generic "" "utils" - print_info 1 'gnupg: >> Copying to cache...' + print_info 1 "$(getIndent 3)gnupg: >> Copying to bincache..." [ -f "${TEMP}/${GPG_DIR}/g10/gpg" ] || gen_die 'gnupg executable does not exist!' ${UTILS_CROSS_COMPILE}strip "${TEMP}/${GPG_DIR}/g10/gpg" || diff --git a/gen_funcs.sh b/gen_funcs.sh index 656ddef..618aab6 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -231,6 +231,23 @@ gen_die() { exit 1 } +getIndent() { + [[ "$#" -lt '1' ]] && + gen_die 'getIndent(): improper usage!' + + local _level=${1} + local _indent= + local _indentTemplate=" " + local i=0 + + while [[ ${i} -lt ${_level} ]]; do + _indent+=${_indentTemplate} + i=$[$i+1] + done + + echo "${_indent}" +} + isBootRO() { return $(awk '( $2 == "'${BOOTDIR}'" && $4 ~ /(^|,)ro(,|$)/){ I=1; exit }END{print !I }' /proc/mounts); diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 9c50179..175ccc5 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -5,7 +5,7 @@ COPY_BINARIES=false CPIO_ARGS="--quiet -o -H newc --owner root:root --force-local" # The copy_binaries function is explicitly released under the CC0 license to -# encourage wide adoption and re-use. That means: +# encourage wide adoption and re-use. That means: # - You may use the code of copy_binaries() as CC0 outside of genkernel # - Contributions to this function are licensed under CC0 as well. # - If you change it outside of genkernel, please consider sending your @@ -44,7 +44,7 @@ copy_binaries() { else lddtree "$@" \ | tr ')(' '\n' \ - | awk '/=>/{ if($3 ~ /^\//){print $3}}' \ + | awk '/=>/{ if($3 ~ /^\//){print $3}}' \ || gen_die "Binary ${f} or some of its library dependencies could not be copied" fi ) \ | sort \ @@ -104,7 +104,7 @@ append_base_layout() { mkdir -p ${TEMP}/initramfs-base-temp/sbin mkdir -p ${TEMP}/initramfs-base-temp/usr/bin mkdir -p ${TEMP}/initramfs-base-temp/usr/sbin - ln -s lib ${TEMP}/initramfs-base-temp/lib64 + ln -s lib ${TEMP}/initramfs-base-temp/lib64 echo "/dev/ram0 / ext2 defaults 0 0" > ${TEMP}/initramfs-base-temp/etc/fstab echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab @@ -116,7 +116,7 @@ append_base_layout() { # Assume the initramfs we're building is for this system, so copy # our current hostid into it. # We also have to deal with binary+endianness here: glibc's gethostid - # expects the value to be in binary using the native endianness. But + # expects the value to be in binary using the native endianness. But # the coreutils hostid program doesn't show it in the right form. local hostid if file -L "${TEMP}/initramfs-base-temp/bin/sh" | grep -q 'MSB executable'; then @@ -145,6 +145,8 @@ append_busybox() { rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null fi + compile_busybox + mkdir -p "${TEMP}/initramfs-busybox-temp/bin/" tar -xf "${BUSYBOX_BINCACHE}" -C "${TEMP}/initramfs-busybox-temp/bin" busybox || gen_die 'Could not extract busybox bincache!' @@ -239,6 +241,9 @@ append_unionfs_fuse() { then rm -r "${TEMP}/initramfs-unionfs-fuse-temp" fi + + compile_unionfs_fuse + cd ${TEMP} mkdir -p "${TEMP}/initramfs-unionfs-fuse-temp/sbin/" bzip2 -dc "${UNIONFS_FUSE_BINCACHE}" > "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs" || @@ -257,7 +262,7 @@ append_unionfs_fuse() { # then # rm -r "${TEMP}/initramfs-suspend-temp/" # fi -# print_info 1 'SUSPEND: Adding support (compiling binaries)...' +# print_info 1 "$(getIndent 2)SUSPEND: Adding support (compiling binaries)..." # compile_suspend # mkdir -p "${TEMP}/initramfs-suspend-temp/" # /bin/tar -xpf "${SUSPEND_BINCACHE}" -C "${TEMP}/initramfs-suspend-temp" || @@ -277,7 +282,7 @@ append_multipath(){ then rm -r "${TEMP}/initramfs-multipath-temp" fi - print_info 1 ' Multipath support being added' + print_info 1 "$(getIndent 2)Multipath: Adding support (using system binaries)..." mkdir -p "${TEMP}"/initramfs-multipath-temp/{bin,etc,sbin,lib}/ # Copy files @@ -316,7 +321,7 @@ append_dmraid(){ then rm -r "${TEMP}/initramfs-dmraid-temp/" fi - print_info 1 'DMRAID: Adding support (compiling binaries)...' + print_info 1 "$(getIndent 2)DMRAID: Adding support (compiling binaries)..." compile_dmraid mkdir -p "${TEMP}/initramfs-dmraid-temp/" /bin/tar -xpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" || @@ -345,7 +350,7 @@ append_iscsi(){ then rm -r "${TEMP}/initramfs-iscsi-temp/" fi - print_info 1 'iSCSI: Adding support (compiling binaries)...' + print_info 1 "$(getIndent 2)iSCSI: Adding support (compiling binaries)..." compile_iscsi cd ${TEMP} mkdir -p "${TEMP}/initramfs-iscsi-temp/bin/" @@ -372,7 +377,7 @@ append_lvm(){ mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/cache" if false && [ -e '/sbin/lvm.static' ] then - print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm.static)...' + print_info 1 "$(getIndent 2)LVM: Adding support (using local static binary /sbin/lvm.static)..." cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/sbin/lvm" || gen_die 'Could not copy over lvm!' # See bug 382555 @@ -382,7 +387,7 @@ append_lvm(){ fi elif false && [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable' then - print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm)...' + print_info 1 "$(getIndent 2)LVM: Adding support (using local static binary /sbin/lvm)..." cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/sbin/lvm" || gen_die 'Could not copy over lvm!' # See bug 382555 @@ -391,7 +396,7 @@ append_lvm(){ cp /sbin/dmsetup "${TEMP}/initramfs-lvm-temp/bin/dmsetup" fi else - print_info 1 ' LVM: Adding support (compiling binaries)...' + print_info 1 "$(getIndent 2)LVM: Adding support (compiling binaries)..." compile_lvm || gen_die "Could not compile LVM" /bin/tar -xpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" || gen_die "Could not extract lvm binary cache!"; @@ -464,17 +469,17 @@ append_mdadm(){ gen_die "${MDADM_CONFIG} does not exist!" fi else - print_info 1 ' MDADM: Skipping inclusion of mdadm.conf' + print_info 1 "$(getIndent 2)MDADM: Skipping inclusion of mdadm.conf" fi if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \ && [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable' then - print_info 1 ' MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)...' + print_info 1 "$(getIndent 2)MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)..." cp /sbin/mdadm /sbin/mdmon "${TEMP}/initramfs-mdadm-temp/sbin/" || gen_die 'Could not copy over mdadm!' else - print_info 1 ' MDADM: Adding support (compiling binaries)...' + print_info 1 "$(getIndent 2)MDADM: Adding support (compiling binaries)..." compile_mdadm /bin/tar -xpf "${MDADM_BINCACHE}" -C "${TEMP}/initramfs-mdadm-temp" || gen_die "Could not extract mdadm binary cache!"; @@ -501,7 +506,7 @@ append_zfs(){ do if [ -f /etc/zfs/${i} ] then - print_info 1 " >> Including ${i}" + print_info 1 "$(getIndent 2)zfs: >> Including ${i}" cp -a "/etc/zfs/${i}" "${TEMP}/initramfs-zfs-temp/etc/zfs" 2> /dev/null \ || gen_die "Could not copy file ${i} for ZFS" fi @@ -607,7 +612,7 @@ append_splash(){ then [ -z "${SPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash [ -z "${SPLASH_THEME}" ] && SPLASH_THEME=default - print_info 1 " >> Installing splash [ using the ${SPLASH_THEME} theme ]..." + print_info 1 "$(getIndent 1)>> Installing splash [ using the ${SPLASH_THEME} theme ]..." if [ -d "${TEMP}/initramfs-splash-temp" ] then rm -r "${TEMP}/initramfs-splash-temp/" @@ -628,7 +633,7 @@ append_splash(){ cd "${TEMP}" rm -r "${TEMP}/initramfs-splash-temp/" else - print_warning 1 ' >> No splash detected; skipping!' + print_warning 1 "$(getIndent 1)>> No splash detected; skipping!" fi } @@ -640,7 +645,7 @@ append_overlay(){ } append_luks() { - local _luks_error_format="LUKS support cannot be included: %s. Please emerge sys-fs/cryptsetup[static]." + local _luks_error_format="LUKS support cannot be included: %s. Please emerge sys-fs/cryptsetup[static]." local _luks_source=/sbin/cryptsetup local _luks_dest=/sbin/cryptsetup @@ -658,7 +663,7 @@ append_luks() { [ -x "${_luks_source}" ] \ || gen_die "$(printf "${_luks_error_format}" "no file ${_luks_source}")" - print_info 1 "Including LUKS support" + print_info 1 "$(getIndent 2)LUKS: Adding support (using system binaries)..." copy_binaries "${TEMP}/initramfs-luks-temp/" /sbin/cryptsetup fi @@ -696,7 +701,7 @@ append_dropbear(){ fi cd "${TEMP}" \ - || gen_die "cd '${TEMP}' failed" + || gen_die "cd '${TEMP}' failed" mkdir -p ${TEMP}/initramfs-dropbear-temp/var/run mkdir -p ${TEMP}/initramfs-dropbear-temp/var/log mkdir -p ${TEMP}/initramfs-dropbear-temp/etc/dropbear @@ -775,7 +780,7 @@ append_gpg() { cd ${TEMP} mkdir -p "${TEMP}/initramfs-gpg-temp/sbin/" if [ ! -e ${GPG_BINCACHE} ] ; then - print_info 1 ' GPG: Adding support (compiling binaries)...' + print_info 1 "$(getIndent 2)GPG: Adding support (compiling binaries)..." compile_gpg fi bzip2 -dc "${GPG_BINCACHE}" > "${TEMP}/initramfs-gpg-temp/sbin/gpg" || @@ -804,9 +809,9 @@ append_modules() { print_info 2 "initramfs: >> Searching for modules..." if [ "${INSTALL_MOD_PATH}" != '' ] then - cd ${INSTALL_MOD_PATH} + cd ${INSTALL_MOD_PATH} else - cd / + cd / fi if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ] @@ -877,7 +882,7 @@ append_auxilary() { if [ -f "${CMD_LINUXRC}" ] then cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init" - print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init" + print_info 2 "$(getIndent 1)>> Copying user specified linuxrc: ${CMD_LINUXRC} to init" else if isTrue ${NETBOOT} then @@ -933,7 +938,7 @@ append_auxilary() { fi if isTrue $CMD_KEYMAP then - print_info 1 " >> Copying keymaps" + print_info 1 "$(getIndent 1)>> Copying keymaps" mkdir -p "${TEMP}/initramfs-aux-temp/lib/" cp -R "${GK_SHARE}/defaults/keymaps" "${TEMP}/initramfs-aux-temp/lib/" \ || gen_die "Error while copying keymaps" @@ -966,8 +971,8 @@ append_data() { [ $# -eq 0 ] && gen_die "append_data() called with zero arguments" if [ $# -eq 1 ] || isTrue ${var} then - print_info 1 " >> Appending ${name} cpio data..." - ${func} || gen_die "${func}() failed" + print_info 1 "$(getIndent 1)>> Appending ${name} cpio data..." + ${func} || gen_die "${func}() failed" fi } @@ -1043,7 +1048,7 @@ create_initramfs() { # http://search.cpan.org/~pixel/Archive-Cpio-0.07/lib/Archive/Cpio.pm # as then we can dedupe ourselves... if [[ $UID -eq 0 ]]; then - print_info 1 " >> Deduping cpio..." + print_info 1 "$(getIndent 1)>> Deduping cpio..." local TDIR="${TEMP}/initramfs-final" mkdir -p "${TDIR}" cd "${TDIR}" @@ -1055,7 +1060,7 @@ create_initramfs() { cd "${TEMP}" rm -rf "${TDIR}" else - print_info 1 " >> Cannot deduping cpio contents without root; skipping" + print_info 1 "$(getIndent 1)>> Cannot deduping cpio contents without root; skipping" fi cd "${TEMP}" @@ -1068,13 +1073,13 @@ create_initramfs() { sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_OUTPUTDIR}/.config compress_config='INITRAMFS_COMPRESSION_NONE' case ${compress_ext} in - gz) compress_config='INITRAMFS_COMPRESSION_GZIP' ;; - bz2) compress_config='INITRAMFS_COMPRESSION_BZIP2' ;; + gz) compress_config='INITRAMFS_COMPRESSION_GZIP' ;; + bz2) compress_config='INITRAMFS_COMPRESSION_BZIP2' ;; lzma) compress_config='INITRAMFS_COMPRESSION_LZMA' ;; - xz) compress_config='INITRAMFS_COMPRESSION_XZ' ;; - lzo) compress_config='INITRAMFS_COMPRESSION_LZO' ;; - lz4) compress_config='INITRAMFS_COMPRESSION_LZ4' ;; - *) compress_config='INITRAMFS_COMPRESSION_NONE' ;; + xz) compress_config='INITRAMFS_COMPRESSION_XZ' ;; + lzo) compress_config='INITRAMFS_COMPRESSION_LZO' ;; + lz4) compress_config='INITRAMFS_COMPRESSION_LZ4' ;; + *) compress_config='INITRAMFS_COMPRESSION_NONE' ;; esac # All N default except XZ, so there it gets used if the kernel does # compression on it's own. @@ -1094,8 +1099,8 @@ create_initramfs() { else if isTrue "${COMPRESS_INITRD}" then - # NOTE: We do not work with ${KERNEL_CONFIG} here, since things like - # "make oldconfig" or --noclean could be in effect. + # NOTE: We do not work with ${KERNEL_CONFIG} here, since things like + # "make oldconfig" or --noclean could be in effect. if [ -f "${KERNEL_OUTPUTDIR}"/.config ]; then local ACTUAL_KERNEL_CONFIG="${KERNEL_OUTPUTDIR}"/.config else @@ -1132,7 +1137,7 @@ create_initramfs() { 'CONFIG_RD_BZIP2 cmd_bzip2 bzip2' \ 'CONFIG_RD_GZIP cmd_gzip gzip' \ 'CONFIG_RD_LZO cmd_lzop lzop' \ - 'CONFIG_RD_LZ4 cmd_lz4 lz4' \ + 'CONFIG_RD_LZ4 cmd_lz4 lz4' \ ; do set -- ${tuple} kernel_option=$1 @@ -1164,12 +1169,12 @@ create_initramfs() { esac if [ -n "${compression}" ]; then - print_info 1 " >> Compressing cpio data (${compress_ext})..." - print_info 5 " >> Compression command (${compress_cmd} $CPIO)..." + print_info 1 "$(getIndent 1)>> Compressing cpio data (${compress_ext})..." + print_info 5 "$(getIndent 1)>> Compression command (${compress_cmd} $CPIO)..." ${compress_cmd} "${CPIO}" || gen_die "Compression (${compress_cmd}) failed" mv -f "${CPIO}${compress_ext}" "${CPIO}" || gen_die "Rename failed" else - print_info 1 " >> Not compressing cpio data ..." + print_info 1 "$(getIndent 1)>> Not compressing cpio data ..." fi fi ## To early load microcode we need to follow some pretty specific steps @@ -1181,35 +1186,35 @@ create_initramfs() { print_info 1 "--microcode-initramfs is enabled by default for compatability but made obsolete by sys-boot/grub-2.02-r1" cfg_CONFIG_MICROCODE_INTEL=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_INTEL) cfg_CONFIG_MICROCODE_AMD=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_AMD) - print_info 1 "early-microcode: >> Preparing..." + print_info 1 "$(getIndent 1)>> Adding early-microcode support..." UCODEDIR="${TMPDIR}/ucode_tmp/kernel/x86/microcode/" mkdir -p "${UCODEDIR}" - if [ "${cfg_CONFIG_MICROCODE_INTEL}" == "y" ]; then + if [ "${cfg_CONFIG_MICROCODE_INTEL}" == "y" ]; then if [ -d /lib/firmware/intel-ucode ]; then - print_info 1 " >> adding GenuineIntel.bin" + print_info 1 "$(getIndent 2)early-microcode: Adding GenuineIntel.bin..." cat /lib/firmware/intel-ucode/* > "${UCODEDIR}/GenuineIntel.bin" || gen_die "Failed to concat intel cpu ucode" else - print_info 1 "CONFIG_MICROCODE_INTEL=y set but no ucode available. Please install sys-firmware/intel-microcode[split-ucode]" + print_info 1 "$(getIndent 2)early-microcode: CONFIG_MICROCODE_INTEL=y set but no ucode available. Please install sys-firmware/intel-microcode[split-ucode]" fi fi - if [ "${cfg_CONFIG_MICROCODE_AMD}" == "y" ]; then + if [ "${cfg_CONFIG_MICROCODE_AMD}" == "y" ]; then if [ -d /lib/firmware/amd-ucode ]; then - print_info 1 " >> adding AuthenticAMD.bin" + print_info 1 "$(getIndent 2)early-microcode: Adding AuthenticAMD.bin..." cat /lib/firmware/amd-ucode/*.bin > "${UCODEDIR}/AuthenticAMD.bin" || gen_dir "Failed to concat amd cpu ucode" else - print_info 1 "CONFIG_MICROCODE_AMD=y set but no ucode available. Please install sys-firmware/linux-firmware" + print_info 1 "$(getIndent 2)early-microcode: CONFIG_MICROCODE_AMD=y set but no ucode available. Please install sys-firmware/linux-firmware" fi fi if [ -f "${UCODEDIR}/AuthenticAMD.bin" -o -f "${UCODEDIR}/GenuineIntel.bin" ]; then - print_info 1 "early-microcode: >> Creating cpio..." + print_info 1 "$(getIndent 2)early-microcode: Creating cpio..." pushd "${TMPDIR}/ucode_tmp" > /dev/null find . | cpio -o -H newc > ../ucode.cpio || gen_die "Failed to create cpu microcode cpio" popd > /dev/null - print_info 1 "early-microcode: >> Prepending early-microcode to initramfs" + print_info 1 "$(getIndent 2)early-microcode: Prepending early-microcode to initramfs..." cat "${TMPDIR}/ucode.cpio" "${CPIO}" > "${CPIO}.early-microcode" || gen_die "Failed to prepend early-microcode to initramfs" mv -f "${CPIO}.early-microcode" "${CPIO}" || gen_die "Rename failed" else - print_info 1 "CONFIG_MICROCODE=y is set but no microcode found" + print_info 1 "$(getIndent 2)early-microcode: CONFIG_MICROCODE=y is set but no microcode found" fi fi if isTrue "${WRAP_INITRD}" @@ -1217,8 +1222,8 @@ create_initramfs() { local mkimage_cmd=$(type -p mkimage) [[ -z ${mkimage_cmd} ]] && gen_die "mkimage is not available. Please install package 'dev-embedded/u-boot-tools'." local mkimage_args="-A ${ARCH} -O linux -T ramdisk -C ${compression:-none} -a 0x00000000 -e 0x00000000" - print_info 1 " >> Wrapping initramfs using mkimage..." - print_info 2 "${mkimage_cmd} ${mkimage_args} -n initramfs-${KV} -d ${CPIO} ${CPIO}.uboot" + print_info 1 "$(getIndent 1)>> Wrapping initramfs using mkimage..." + print_info 2 "$(getIndent 1)${mkimage_cmd} ${mkimage_args} -n initramfs-${KV} -d ${CPIO} ${CPIO}.uboot" ${mkimage_cmd} ${mkimage_args} -n "initramfs-${KV}" -d "${CPIO}" "${CPIO}.uboot" >> ${LOGFILE} 2>&1 || gen_die "Wrapping initramfs using mkimage failed" mv -f "${CPIO}.uboot" "${CPIO}" || gen_die "Rename failed" fi diff --git a/genkernel b/genkernel index 61dddca..a5ce560 100755 --- a/genkernel +++ b/genkernel @@ -4,7 +4,7 @@ PATH="${PATH}:/sbin:/usr/sbin" GK_V='3.5.3.3' -# Set the default for TMPDIR. May be modified by genkernel.conf or the +# Set the default for TMPDIR. May be modified by genkernel.conf or the # --tempdir command line option. TMPDIR='/var/tmp/genkernel' @@ -178,7 +178,7 @@ else fi else print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!" - print_warning 1 " Run ``mount ${BOOTDIR}`` to mount it!" + print_warning 1 "$(getIndent 1)Run ``mount ${BOOTDIR}`` to mount it!" echo fi fi @@ -223,7 +223,7 @@ fi KERNCACHE_IS_VALID=0 if [ "${KERNCACHE}" != "" ] then - gen_kerncache_is_valid + gen_kerncache_is_valid fi if [ ${BUILD_KERNEL} = '1' -a "${KERNCACHE_IS_VALID}" = '0' ] @@ -307,17 +307,6 @@ fi if [ "${BUILD_RAMDISK}" = '1' ] then - if [ "${BUSYBOX}" = '1' ] - then - # Compile Busybox - compile_busybox - fi - - if isTrue "${UNIONFS}" - then - compile_unionfs_fuse - fi - # Compile initramfs create_initramfs else