Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/sysvinit/files/, sys-apps/sysvinit/
Date: Sat, 17 Aug 2019 18:38:05
Message-Id: 1566067058.ada626f71628c922b27d692057520caeb72dd03c.williamh@gentoo
1 commit: ada626f71628c922b27d692057520caeb72dd03c
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 17 18:37:18 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 17 18:37:38 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ada626f7
7
8 sys-apps/sysvinit: 2.95-r1 bump to add halt.sh
9
10 This adds halt.sh which will be used to either halt or poweroff the
11 system based on the contents of the INIT_HALT environment variable.
12
13 Package-Manager: Portage-2.3.69, Repoman-2.3.16
14 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
15
16 sys-apps/sysvinit/files/halt.sh | 6 ++
17 sys-apps/sysvinit/files/inittab-2.95 | 61 +++++++++++++
18 sys-apps/sysvinit/sysvinit-2.95-r1.ebuild | 139 ++++++++++++++++++++++++++++++
19 3 files changed, 206 insertions(+)
20
21 diff --git a/sys-apps/sysvinit/files/halt.sh b/sys-apps/sysvinit/files/halt.sh
22 new file mode 100644
23 index 00000000000..07a32b99574
24 --- /dev/null
25 +++ b/sys-apps/sysvinit/files/halt.sh
26 @@ -0,0 +1,6 @@
27 +#!/bin/sh
28 +if [ "$INIT_HALT" = HALT ]; then
29 + exec /sbin/halt -dhn
30 +else
31 + exec /sbin/poweroff -dhn
32 +fi
33
34 diff --git a/sys-apps/sysvinit/files/inittab-2.95 b/sys-apps/sysvinit/files/inittab-2.95
35 new file mode 100644
36 index 00000000000..03f226a8c3b
37 --- /dev/null
38 +++ b/sys-apps/sysvinit/files/inittab-2.95
39 @@ -0,0 +1,61 @@
40 +#
41 +# /etc/inittab: This file describes how the INIT process should set up
42 +# the system in a certain run-level.
43 +#
44 +# Author: Miquel van Smoorenburg, <miquels@×××××××.nl>
45 +# Modified by: Patrick J. Volkerding, <volkerdi@×××××××××.com>
46 +# Modified by: Daniel Robbins, <drobbins@g.o>
47 +# Modified by: Martin Schlemmer, <azarah@g.o>
48 +# Modified by: Mike Frysinger, <vapier@g.o>
49 +# Modified by: Robin H. Johnson, <robbat2@g.o>
50 +# Modified by: William Hubbs, <williamh@g.o>
51 +#
52 +
53 +# Default runlevel.
54 +id:3:initdefault:
55 +
56 +# System initialization, mount local filesystems, etc.
57 +si::sysinit:/sbin/openrc sysinit
58 +
59 +# Further system initialization, brings up the boot runlevel.
60 +rc::bootwait:/sbin/openrc boot
61 +
62 +l0u:0:wait:/sbin/telinit u
63 +l0:0:wait:/sbin/openrc shutdown
64 +l0s:0:wait:/sbin/halt.sh
65 +l1:1:wait:/sbin/openrc single
66 +l2:2:wait:/sbin/openrc nonetwork
67 +l3:3:wait:/sbin/openrc default
68 +l4:4:wait:/sbin/openrc default
69 +l5:5:wait:/sbin/openrc default
70 +l6u:6:wait:/sbin/telinit u
71 +l6:6:wait:/sbin/openrc reboot
72 +l6r:6:wait:/sbin/reboot -dkn
73 +#z6:6:respawn:/sbin/sulogin
74 +
75 +# new-style single-user
76 +su0:S:wait:/sbin/openrc single
77 +su1:S:wait:/sbin/sulogin
78 +
79 +# TERMINALS
80 +#x1:12345:respawn:/sbin/agetty 38400 console linux
81 +c1:12345:respawn:/sbin/agetty 38400 tty1 linux
82 +c2:2345:respawn:/sbin/agetty 38400 tty2 linux
83 +c3:2345:respawn:/sbin/agetty 38400 tty3 linux
84 +c4:2345:respawn:/sbin/agetty 38400 tty4 linux
85 +c5:2345:respawn:/sbin/agetty 38400 tty5 linux
86 +c6:2345:respawn:/sbin/agetty 38400 tty6 linux
87 +
88 +# SERIAL CONSOLES
89 +#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100
90 +#s1:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
91 +
92 +# What to do at the "Three Finger Salute".
93 +ca:12345:ctrlaltdel:/sbin/shutdown -r now
94 +
95 +# Used by /etc/init.d/xdm to control DM startup.
96 +# Read the comments in /etc/init.d/xdm for more
97 +# info. Do NOT remove, as this will start nothing
98 +# extra at boot if /etc/init.d/xdm is not added
99 +# to the "default" runlevel.
100 +x:a:once:/etc/X11/startDM.sh
101
102 diff --git a/sys-apps/sysvinit/sysvinit-2.95-r1.ebuild b/sys-apps/sysvinit/sysvinit-2.95-r1.ebuild
103 new file mode 100644
104 index 00000000000..6dd6484ee44
105 --- /dev/null
106 +++ b/sys-apps/sysvinit/sysvinit-2.95-r1.ebuild
107 @@ -0,0 +1,139 @@
108 +# Copyright 1999-2019 Gentoo Authors
109 +# Distributed under the terms of the GNU General Public License v2
110 +
111 +EAPI=7
112 +
113 +inherit toolchain-funcs flag-o-matic
114 +
115 +DESCRIPTION="/sbin/init - parent of all processes"
116 +HOMEPAGE="https://savannah.nongnu.org/projects/sysvinit"
117 +SRC_URI="mirror://nongnu/${PN}/${P/_/-}.tar.xz"
118 +
119 +LICENSE="GPL-2"
120 +SLOT="0"
121 +[[ "${PV}" == *beta* ]] || \
122 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
123 +IUSE="selinux ibm static kernel_FreeBSD"
124 +
125 +CDEPEND="
126 + selinux? (
127 + >=sys-libs/libselinux-1.28
128 + )"
129 +DEPEND="${CDEPEND}
130 + virtual/os-headers"
131 +RDEPEND="${CDEPEND}
132 + selinux? ( sec-policy/selinux-shutdown )
133 + !<sys-apps/openrc-0.13
134 +"
135 +
136 +S="${WORKDIR}/${P/_*}"
137 +
138 +PATCHES=(
139 + "${FILESDIR}/${PN}-2.86-kexec.patch" #80220
140 + "${FILESDIR}/${PN}-2.94_beta-shutdown-single.patch" #158615
141 + "${FILESDIR}/${PN}-2.95_beta-shutdown-h.patch" #449354
142 +)
143 +
144 +src_prepare() {
145 + default
146 +
147 + sed -i \
148 + -e '/^CPPFLAGS =$/d' \
149 + -e '/^override CFLAGS +=/s/ -fstack-protector-strong//' \
150 + src/Makefile || die
151 +
152 + # last/lastb/mesg/mountpoint/sulogin/utmpdump/wall have moved to util-linux
153 + sed -i -r \
154 + -e '/^(USR)?S?BIN/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)\>::g' \
155 + -e '/^MAN[18]/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)[.][18]\>::g' \
156 + src/Makefile || die
157 +
158 + # pidof has moved to >=procps-3.3.9
159 + sed -i -r \
160 + -e '/\/bin\/pidof/d' \
161 + -e '/^MAN8/s:\<pidof.8\>::g' \
162 + src/Makefile || die
163 +
164 + # logsave is already in e2fsprogs
165 + sed -i -r \
166 + -e '/^(USR)?S?BIN/s:\<logsave\>::g' \
167 + -e '/^MAN8/s:\<logsave.8\>::g' \
168 + src/Makefile || die
169 +
170 + # Mung inittab for specific architectures
171 + cd "${WORKDIR}" || die
172 + cp "${FILESDIR}"/inittab-2.95 inittab || die "cp inittab"
173 + local insert=()
174 + use ppc && insert=( '#psc0:12345:respawn:/sbin/agetty 115200 ttyPSC0 linux' )
175 + use arm && insert=( '#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100' )
176 + use arm64 && insert=( 'f0:12345:respawn:/sbin/agetty 9600 ttyAMA0 vt100' )
177 + use hppa && insert=( 'b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100' )
178 + use s390 && insert=( 's0:12345:respawn:/sbin/agetty 38400 console dumb' )
179 + if use ibm ; then
180 + insert+=(
181 + '#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0'
182 + '#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0'
183 + )
184 + fi
185 + (use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab
186 + if use kernel_FreeBSD ; then
187 + sed -i \
188 + -e 's/linux/cons25/g' \
189 + -e 's/ttyS0/cuaa0/g' \
190 + -e 's/ttyS1/cuaa1/g' \
191 + inittab #121786
192 + fi
193 + if use x86 || use amd64 ; then
194 + sed -i \
195 + -e '/ttyS[01]/s:9600:115200:' \
196 + inittab
197 + fi
198 + if [[ ${#insert[@]} -gt 0 ]] ; then
199 + printf '%s\n' '' '# Architecture specific features' "${insert[@]}" >> inittab
200 + fi
201 +}
202 +
203 +src_compile() {
204 + tc-export CC
205 + append-lfs-flags
206 + export DISTRO= #381311
207 + export VERSION="${PV}"
208 + use static && append-ldflags -static
209 + emake -C src $(usex selinux 'WITH_SELINUX=yes' '')
210 +}
211 +
212 +src_install() {
213 + emake -C src install ROOT="${D}"
214 + dodoc README doc/*
215 +
216 + insinto /etc
217 + doins "${WORKDIR}"/inittab
218 +
219 + # dead symlink
220 + rm "${ED}"/usr/bin/lastb || die
221 +
222 + newinitd "${FILESDIR}"/bootlogd.initd bootlogd
223 + into /
224 + dosbin "${FILESDIR}"/halt.sh
225 +}
226 +
227 +pkg_postinst() {
228 + # Reload init to fix unmounting problems of / on next reboot.
229 + # This is really needed, as without the new version of init cause init
230 + # not to quit properly on reboot, and causes a fsck of / on next reboot.
231 + if [[ ${ROOT} == / ]] ; then
232 + if [[ -e /dev/initctl && ! -e /run/initctl ]]; then
233 + ln -s /dev/initctl /run/initctl
234 + fi
235 + # Do not return an error if this fails
236 + /sbin/telinit U &>/dev/null
237 + fi
238 +
239 + elog "The last/lastb/mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to"
240 + elog "sys-apps/util-linux. The pidof tool has been moved to sys-process/procps."
241 +
242 + # Required for new bootlogd service
243 + if [[ ! -e "${EROOT}/var/log/boot" ]] ; then
244 + touch "${EROOT}/var/log/boot"
245 + fi
246 +}