Line 0
Link Here
|
0 |
- |
1 |
# Copyright 1999-2018 Gentoo Authors |
|
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
4 |
EAPI=6 |
5 |
|
6 |
inherit toolchain-funcs flag-o-matic |
7 |
|
8 |
DESCRIPTION="/sbin/init - parent of all processes" |
9 |
HOMEPAGE="https://savannah.nongnu.org/projects/sysvinit" |
10 |
SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz" |
11 |
|
12 |
LICENSE="GPL-2" |
13 |
SLOT="0" |
14 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
15 |
IUSE="selinux ibm static kernel_FreeBSD" |
16 |
|
17 |
CDEPEND=" |
18 |
selinux? ( |
19 |
>=sys-libs/libselinux-1.28 |
20 |
)" |
21 |
DEPEND="${CDEPEND} |
22 |
virtual/os-headers" |
23 |
RDEPEND="${CDEPEND} |
24 |
selinux? ( sec-policy/selinux-shutdown ) |
25 |
!<sys-apps/openrc-0.13 |
26 |
" |
27 |
|
28 |
PATCHES=( |
29 |
"${FILESDIR}/${PN}-2.86-kexec.patch" #80220 |
30 |
"${FILESDIR}/${PN}-2.86-shutdown-single.patch" #158615 |
31 |
"${FILESDIR}/${PN}-2.88-shutdown-h.patch" #449354 |
32 |
) |
33 |
|
34 |
src_prepare() { |
35 |
default |
36 |
sed -i '/^CPPFLAGS =$/d' src/Makefile || die |
37 |
|
38 |
# last/lastb/mesg/mountpoint/sulogin/utmpdump/wall have moved to util-linux |
39 |
sed -i -r \ |
40 |
-e '/^(USR)?S?BIN/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)\>::g' \ |
41 |
-e '/^MAN[18]/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)[.][18]\>::g' \ |
42 |
src/Makefile || die |
43 |
|
44 |
# pidof has moved to >=procps-3.3.9 |
45 |
sed -i -r \ |
46 |
-e '/\/bin\/pidof/d' \ |
47 |
-e '/^MAN8/s:\<pidof.8\>::g' \ |
48 |
src/Makefile || die |
49 |
|
50 |
# Mung inittab for specific architectures |
51 |
cd "${WORKDIR}" || die |
52 |
cp "${FILESDIR}"/inittab-2.91 inittab || die "cp inittab" |
53 |
local insert=() |
54 |
use ppc && insert=( '#psc0:12345:respawn:/sbin/agetty 115200 ttyPSC0 linux' ) |
55 |
use arm && insert=( '#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100' ) |
56 |
use arm64 && insert=( 'f0:12345:respawn:/sbin/agetty 9600 ttyAMA0 vt100' ) |
57 |
use hppa && insert=( 'b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100' ) |
58 |
use s390 && insert=( 's0:12345:respawn:/sbin/agetty 38400 console dumb' ) |
59 |
if use ibm ; then |
60 |
insert+=( |
61 |
'#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0' |
62 |
'#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0' |
63 |
) |
64 |
fi |
65 |
(use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab |
66 |
if use kernel_FreeBSD ; then |
67 |
sed -i \ |
68 |
-e 's/linux/cons25/g' \ |
69 |
-e 's/ttyS0/cuaa0/g' \ |
70 |
-e 's/ttyS1/cuaa1/g' \ |
71 |
inittab #121786 |
72 |
fi |
73 |
if use x86 || use amd64 ; then |
74 |
sed -i \ |
75 |
-e '/ttyS[01]/s:9600:115200:' \ |
76 |
inittab |
77 |
fi |
78 |
if [[ ${#insert[@]} -gt 0 ]] ; then |
79 |
printf '%s\n' '' '# Architecture specific features' "${insert[@]}" >> inittab |
80 |
fi |
81 |
} |
82 |
|
83 |
src_compile() { |
84 |
tc-export CC |
85 |
append-lfs-flags |
86 |
export DISTRO= #381311 |
87 |
export VERSION="${PV}" |
88 |
use static && append-ldflags -static |
89 |
emake -C src $(usex selinux 'WITH_SELINUX=yes' '') |
90 |
} |
91 |
|
92 |
src_install() { |
93 |
emake -C src install ROOT="${D}" |
94 |
dodoc README doc/* |
95 |
|
96 |
insinto /etc |
97 |
doins "${WORKDIR}"/inittab |
98 |
|
99 |
# dead symlink |
100 |
rm "${ED%/}"/usr/bin/lastb || die |
101 |
} |
102 |
|
103 |
pkg_postinst() { |
104 |
# Reload init to fix unmounting problems of / on next reboot. |
105 |
# This is really needed, as without the new version of init cause init |
106 |
# not to quit properly on reboot, and causes a fsck of / on next reboot. |
107 |
if [[ ${ROOT} == / ]] ; then |
108 |
if [[ -e /dev/initctl && ! -e /run/initctl ]]; then |
109 |
ln -s /dev/initctl /run/initctl |
110 |
fi |
111 |
# Do not return an error if this fails |
112 |
/sbin/telinit U &>/dev/null |
113 |
fi |
114 |
|
115 |
elog "The last/lastb/mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to" |
116 |
elog "sys-apps/util-linux. The pidof tool has been moved to sys-process/procps." |
117 |
} |