mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-22 23:07:10 -08:00
kernel-install.eclass: Move common to kernel-install_install_all
Move the code shared by pkg_postinst() and pkg_config() to a new kernel-install_install_all() function. After all, the purpose of pkg_config() is to repeat what pkg_postinst() does normally. Keeping it in a common function improves maintainability. Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -331,6 +331,34 @@ kernel-install_pkg_preinst() {
|
||||
# (no-op)
|
||||
}
|
||||
|
||||
# @FUNCTION: kernel-install_install_all
|
||||
# @USAGE: <ver>
|
||||
# @DESCRIPTION:
|
||||
# Build an initramfs for the kernel and install the kernel. This is
|
||||
# called from pkg_postinst() and pkg_config(). <ver> is the full
|
||||
# kernel version.
|
||||
kernel-install_install_all() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
[[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments"
|
||||
local ver=${1}
|
||||
|
||||
mount-boot_pkg_preinst
|
||||
|
||||
local image_path=$(dist-kernel_get_image_path)
|
||||
if use initramfs; then
|
||||
# putting it alongside kernel image as 'initrd' makes
|
||||
# kernel-install happier
|
||||
dist-kernel_build_initramfs \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \
|
||||
"${ver}"
|
||||
fi
|
||||
|
||||
dist-kernel_install_kernel "${ver}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/System.map"
|
||||
}
|
||||
|
||||
# @FUNCTION: kernel-install_pkg_postinst
|
||||
# @DESCRIPTION:
|
||||
# Build an initramfs for the kernel, install it and update
|
||||
@@ -338,22 +366,10 @@ kernel-install_pkg_preinst() {
|
||||
kernel-install_pkg_postinst() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
local ver="${PV}${KV_LOCALVERSION}"
|
||||
|
||||
if [[ -z ${ROOT} ]]; then
|
||||
mount-boot_pkg_preinst
|
||||
|
||||
local ver="${PV}${KV_LOCALVERSION}"
|
||||
local image_path=$(dist-kernel_get_image_path)
|
||||
if use initramfs; then
|
||||
# putting it alongside kernel image as 'initrd' makes
|
||||
# kernel-install happier
|
||||
dist-kernel_build_initramfs \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \
|
||||
"${ver}"
|
||||
fi
|
||||
|
||||
dist-kernel_install_kernel "${ver}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/System.map"
|
||||
kernel-install_install_all "${ver}"
|
||||
fi
|
||||
|
||||
kernel-install_update_symlink "${EROOT}/usr/src/linux" "${ver}"
|
||||
@@ -391,21 +407,7 @@ kernel-install_pkg_postrm() {
|
||||
kernel-install_pkg_config() {
|
||||
[[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently"
|
||||
|
||||
mount-boot_pkg_preinst
|
||||
|
||||
local ver="${PV}${KV_LOCALVERSION}"
|
||||
local image_path=$(dist-kernel_get_image_path)
|
||||
if use initramfs; then
|
||||
# putting it alongside kernel image as 'initrd' makes
|
||||
# kernel-install happier
|
||||
dist-kernel_build_initramfs \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path%/*}/initrd" \
|
||||
"${ver}"
|
||||
fi
|
||||
|
||||
dist-kernel_install_kernel "${ver}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/${image_path}" \
|
||||
"${EROOT}/usr/src/linux-${ver}/System.map"
|
||||
kernel-install_install_all "${PV}${KV_LOCALVERSION}"
|
||||
}
|
||||
|
||||
_KERNEL_INSTALL_ECLASS=1
|
||||
|
||||
Reference in New Issue
Block a user