*/*: Bump copyright on files touched this year
[gentoo.git] / sys-kernel / genkernel / genkernel-3.4.52.4-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # genkernel-9999        -> latest Git branch "master"
5 # genkernel-VERSION     -> normal genkernel release
6
7 EAPI=5 # approved 2012.09.11, required by all profiles since 2014.03.12
8
9 inherit bash-completion-r1 epatch
10
11 VERSION_BUSYBOX='1.20.2'
12 VERSION_DMRAID='1.0.0.rc16-3'
13 VERSION_MDADM='3.1.5'
14 VERSION_FUSE='2.8.6'
15 VERSION_ISCSI='2.0-872'
16 VERSION_LVM='2.02.88'
17 VERSION_UNIONFS_FUSE='0.24'
18 VERSION_GPG='1.4.11'
19
20 RH_HOME="ftp://sourceware.org/pub"
21 DM_HOME="https://people.redhat.com/~heinzm/sw/dmraid/src"
22 BB_HOME="https://busybox.net/downloads"
23
24 COMMON_URI="${DM_HOME}/dmraid-${VERSION_DMRAID}.tar.bz2
25                 ${DM_HOME}/old/dmraid-${VERSION_DMRAID}.tar.bz2
26                 https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-${VERSION_MDADM}.tar.bz2
27                 ${RH_HOME}/lvm2/LVM2.${VERSION_LVM}.tgz
28                 ${RH_HOME}/lvm2/old/LVM2.${VERSION_LVM}.tgz
29                 ${BB_HOME}/busybox-${VERSION_BUSYBOX}.tar.bz2
30                 http://www.open-iscsi.org/bits/open-iscsi-${VERSION_ISCSI}.tar.gz
31                 mirror://gentoo/open-iscsi-${VERSION_ISCSI}.tar.gz
32                 mirror://sourceforge/fuse/fuse-${VERSION_FUSE}.tar.gz
33                 http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2
34                 mirror://gentoo/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2
35                 mirror://gnupg/gnupg/gnupg-${VERSION_GPG}.tar.bz2"
36
37 if [[ ${PV} == 9999* ]]
38 then
39         EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git"
40         inherit git-r3
41         S="${WORKDIR}/${P}"
42         SRC_URI="${COMMON_URI}"
43 else
44         SRC_URI="https://dev.gentoo.org/~zerochaos/distfiles/${P}.tar.xz
45                 ${COMMON_URI}"
46         KEYWORDS="~alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86"
47 fi
48
49 DESCRIPTION="Gentoo automatic kernel building scripts"
50 HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
51
52 LICENSE="GPL-2"
53 SLOT="0"
54 RESTRICT=""
55 IUSE="cryptsetup ibm selinux"
56
57 DEPEND="sys-fs/e2fsprogs
58         selinux? ( sys-libs/libselinux )"
59 RDEPEND="${DEPEND}
60         cryptsetup? ( sys-fs/cryptsetup )
61         app-arch/cpio
62         >=app-misc/pax-utils-0.2.1
63         !<sys-apps/openrc-0.9.9"
64 # pax-utils is used for lddtree
65
66 if [[ ${PV} == 9999* ]]; then
67         DEPEND="${DEPEND} app-text/asciidoc"
68 fi
69
70 pkg_pretend() {
71         if ! use cryptsetup && has_version "sys-kernel/genkernel[crypt]"; then
72                 ewarn "Local use flag 'crypt' has been renamed to 'cryptsetup' (bug #414523)."
73                 ewarn "Please set flag 'cryptsetup' for this very package if you would like"
74                 ewarn "to have genkernel create an initramfs with LUKS support."
75                 ewarn "Sorry for the inconvenience."
76                 echo
77         fi
78 }
79
80 src_prepare() {
81         if [[ ${PV} == 9999* ]] ; then
82                 einfo "Producing ChangeLog from Git history..."
83                 pushd "${S}/.git" >/dev/null || die
84                 git log > "${S}"/ChangeLog || die
85                 popd >/dev/null || die
86         fi
87         if use selinux ; then
88                 sed -i 's/###//g' "${S}"/gen_compile.sh || die
89         fi
90
91         # Update software.sh
92         sed -i \
93                 -e "s:VERSION_BUSYBOX:$VERSION_BUSYBOX:" \
94                 -e "s:VERSION_MDADM:$VERSION_MDADM:" \
95                 -e "s:VERSION_DMRAID:$VERSION_DMRAID:" \
96                 -e "s:VERSION_FUSE:$VERSION_FUSE:" \
97                 -e "s:VERSION_ISCSI:$VERSION_ISCSI:" \
98                 -e "s:VERSION_LVM:$VERSION_LVM:" \
99                 -e "s:VERSION_UNIONFS_FUSE:$VERSION_UNIONFS_FUSE:" \
100                 -e "s:VERSION_GPG:$VERSION_GPG:" \
101                 "${S}"/defaults/software.sh \
102                 || die "Could not adjust versions"
103
104         epatch "${FILESDIR}"/${P}-system-map.patch #570822
105         epatch "${FILESDIR}"/${P}-grub-mkconfig.patch #591200
106         epatch "${FILESDIR}"/${P}-crc32c.patch #655110
107         epatch_user
108 }
109
110 src_compile() {
111         if [[ ${PV} == 9999* ]]; then
112                 emake
113         fi
114 }
115
116 src_install() {
117         insinto /etc
118         doins "${S}"/genkernel.conf
119
120         doman genkernel.8
121         dodoc AUTHORS ChangeLog README TODO
122         dobin genkernel
123         rm -f genkernel genkernel.8 AUTHORS ChangeLog README TODO genkernel.conf
124
125         if use ibm ; then
126                 cp "${S}"/arch/ppc64/kernel-2.6{-pSeries,} || die
127         else
128                 cp "${S}"/arch/ppc64/kernel-2.6{.g5,} || die
129         fi
130         insinto /usr/share/genkernel
131         doins -r "${S}"/*
132
133         newbashcomp "${FILESDIR}"/genkernel.bash "${PN}"
134         insinto /etc
135         doins "${FILESDIR}"/initramfs.mounts
136
137         cd "${DISTDIR}"
138         insinto /usr/share/genkernel/distfiles
139         doins ${A/${P}.tar.xz/}
140 }
141
142 pkg_postinst() {
143         echo
144         elog 'Documentation is available in the genkernel manual page'
145         elog 'as well as the following URL:'
146         echo
147         elog 'https://wiki.gentoo.org/wiki/Genkernel'
148         echo
149         ewarn "This package is known to not work with reiser4.  If you are running"
150         ewarn "reiser4 and have a problem, do not file a bug.  We know it does not"
151         ewarn "work and we don't plan on fixing it since reiser4 is the one that is"
152         ewarn "broken in this regard.  Try using a sane filesystem like ext4."
153         echo
154         ewarn "The LUKS support has changed from versions prior to 3.4.4.  Now,"
155         ewarn "you use crypt_root=/dev/blah instead of real_root=luks:/dev/blah."
156         echo
157 }