# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 inherit savedconfig if [[ ${PV} == 99999999* ]]; then inherit git-r3 EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git" else GIT_COMMIT="" SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" fi DESCRIPTION="Linux firmware files" HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git" LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) redistributable? ( linux-fw-redistributable ( BSD-2 BSD BSD-4 ISC MIT no-source-code ) ) unknown-license? ( all-rights-reserved )" SLOT="0" IUSE="+redistributable savedconfig unknown-license" RESTRICT="binchecks strip unknown-license? ( bindist )" RDEPEND="!savedconfig? ( redistributable? ( !sys-firmware/alsa-firmware[alsa_cards_ca0132] !media-tv/cx18-firmware ! ${PN}.conf find * ! -type d ! -name ${PN}.conf >> ${PN}.conf if use savedconfig; then restore_config ${PN}.conf local file preserved_files=() remove=() ebegin "Removing all files not listed in config" while IFS= read -r file; do # Ignore comments. if [[ ${file} != "#"* ]]; then preserved_files+=("${file}") fi done < ${PN}.conf || die while IFS= read -d "" -r file; do has "${file}" "${preserved_files[@]}" || remove+=("${file}") done < <(find * ! -type d ! -name ${PN}.conf -print0 || die) if [[ ${#remove[@]} -gt 0 ]]; then printf "%s\0" "${remove[@]}" | xargs -0 rm || die fi eend 0 fi # remove empty directories, bug #396073 find -type d -empty -delete || die } src_install() { if use !savedconfig; then save_config ${PN}.conf fi rm ${PN}.conf || die insinto /lib/firmware/ doins -r * } pkg_preinst() { if use savedconfig; then ewarn "USE=savedconfig is active. You must handle file collisions manually." fi } pkg_postinst() { elog "If you are only interested in particular firmware files, edit the saved" elog "configfile and remove those that you do not want." local ver for ver in ${REPLACING_VERSIONS}; do if ver_test ${ver} -lt 20190514; then elog elog 'Starting with version 20190514, installation of many firmware' elog 'files is controlled by USE flags. Please review your USE flag' elog 'and package.license settings if you are missing some files.' break fi done }