# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit flx-tools DESCRIPTION="build initramfs" LICENSE="public-domain" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="bzip2 gzip lzma lzo" BDEPEND="app-arch/cpio bzip2? ( app-arch/bzip2 ) gzip? ( app-arch/gzip ) lzma? ( app-arch/xz-utils ) lzo? ( app-arch/lzop )" DEF_CPIO_FLAGS="--quiet" DEF_BZIP2_FLAGS="--best" DEF_GZIP_FLAGS="--best" DEF_LZMA_FLAGS="--best" DEF_LZO_FLAGS="--best" DEF_XZ_FLAGS="--best" src_unpack () { mkdir "${S}" unpack_plist initramfs "${S}/fs" } src_compile () { check_symbol "${S}/fs" big_compress "${S}/fs" einfo "Building initramfs.cpio" ( cd fs find . -print | \ cpio ${CPIO_FLAGS:-$DEF_CPIO_FLAGS} -o -H newc \ ) > initramfs.cpio if use bzip2 ; then einfo "Building initramfs.cpio.bz2" bzip2 -c ${BZIP2_FLAGS:-$DEF_BZIP2_FLAGS} \ < initramfs.cpio \ > initramfs.cpio.bz2 \ || die "Failed to create initramfs.cpio.bz2" fi if use gzip ; then einfo "Building initramfs.cpio.gzip" gzip -c ${GZIP_FLAGS:-$DEF_GZIP_FLAGS} \ < initramfs.cpio \ > initramfs.cpio.gz \ || die "Failed to create initramfs.cpio.gz" fi if use lzma ; then einfo "Building initramfs.cpio.xz" xz -c ${XZ_FLAGS:-$DEF_XZ_FLAGS} \ < initramfs.cpio \ > initramfs.cpio.xz \ || die "Failed to create initramfs.cpio.xz" fi if use lzo ; then einfo "Building initramfs.cpio.lzo" lzop -c ${LZO_FLAGS:-$DEF_LZO_FLAGS} \ < initramfs.cpio \ > initramfs.cpio.lzo \ || die "Failed to create initramfs.cpio.lzo" fi } src_install () { insinto /fs doins initramfs.cpio use bzip2 && doins initramfs.cpio.bz2 use gzip && doins initramfs.cpio.gz use lzma && doins initramfs.cpio.xz use lzo && doins initramfs.cpio.lzo }