Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:musl commit in: sys-apps/sysvinit/files/, sys-apps/sysvinit/
Date: Sun, 29 Sep 2013 21:29:46
Message-Id: 1380490213.618b2049851855a5b7126e9b90dc7498b710ff7e.blueness@gentoo
1 commit: 618b2049851855a5b7126e9b90dc7498b710ff7e
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 29 21:16:34 2013 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 29 21:30:13 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=618b2049
7
8 sys-apps/sysvinit: add needed #include
9
10 ---
11 sys-apps/sysvinit/files/inittab-2.87 | 58 +++++++++
12 sys-apps/sysvinit/files/reboot.sh | 11 ++
13 sys-apps/sysvinit/files/shutdown.sh | 13 ++
14 sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch | 142 +++++++++++++++++++++
15 .../files/sysvinit-2.86-shutdown-single.patch | 36 ++++++
16 .../sysvinit/files/sysvinit-2.88-makefile.patch | 60 +++++++++
17 sys-apps/sysvinit/files/sysvinit-2.88-musl.patch | 10 ++
18 .../sysvinit/files/sysvinit-2.88-selinux.patch | 38 ++++++
19 .../sysvinit/files/sysvinit-2.88-shutdown-h.patch | 65 ++++++++++
20 sys-apps/sysvinit/metadata.xml | 5 +
21 sys-apps/sysvinit/sysvinit-2.88-r99.ebuild | 102 +++++++++++++++
22 11 files changed, 540 insertions(+)
23
24 diff --git a/sys-apps/sysvinit/files/inittab-2.87 b/sys-apps/sysvinit/files/inittab-2.87
25 new file mode 100644
26 index 0000000..cf07548
27 --- /dev/null
28 +++ b/sys-apps/sysvinit/files/inittab-2.87
29 @@ -0,0 +1,58 @@
30 +#
31 +# /etc/inittab: This file describes how the INIT process should set up
32 +# the system in a certain run-level.
33 +#
34 +# Author: Miquel van Smoorenburg, <miquels@×××××××.nl>
35 +# Modified by: Patrick J. Volkerding, <volkerdi@×××××××××.com>
36 +# Modified by: Daniel Robbins, <drobbins@g.o>
37 +# Modified by: Martin Schlemmer, <azarah@g.o>
38 +# Modified by: Mike Frysinger, <vapier@g.o>
39 +# Modified by: Robin H. Johnson, <robbat2@g.o>
40 +#
41 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/files/inittab-2.87,v 1.2 2013/04/20 03:51:26 vapier Exp $
42 +
43 +# Default runlevel.
44 +id:3:initdefault:
45 +
46 +# System initialization, mount local filesystems, etc.
47 +si::sysinit:/sbin/rc sysinit
48 +
49 +# Further system initialization, brings up the boot runlevel.
50 +rc::bootwait:/sbin/rc boot
51 +
52 +l0:0:wait:/sbin/rc shutdown
53 +l0s:0:wait:/sbin/halt -dhp
54 +l1:1:wait:/sbin/rc single
55 +l2:2:wait:/sbin/rc nonetwork
56 +l3:3:wait:/sbin/rc default
57 +l4:4:wait:/sbin/rc default
58 +l5:5:wait:/sbin/rc default
59 +l6:6:wait:/sbin/rc reboot
60 +l6r:6:wait:/sbin/reboot -dk
61 +#z6:6:respawn:/sbin/sulogin
62 +
63 +# new-style single-user
64 +su0:S:wait:/sbin/rc single
65 +su1:S:wait:/sbin/sulogin
66 +
67 +# TERMINALS
68 +c1:12345:respawn:/sbin/agetty 38400 tty1 linux
69 +c2:2345:respawn:/sbin/agetty 38400 tty2 linux
70 +c3:2345:respawn:/sbin/agetty 38400 tty3 linux
71 +c4:2345:respawn:/sbin/agetty 38400 tty4 linux
72 +c5:2345:respawn:/sbin/agetty 38400 tty5 linux
73 +c6:2345:respawn:/sbin/agetty 38400 tty6 linux
74 +
75 +# SERIAL CONSOLES
76 +#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100
77 +#s1:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
78 +
79 +# What to do at the "Three Finger Salute".
80 +ca:12345:ctrlaltdel:/sbin/shutdown -r now
81 +
82 +# Used by /etc/init.d/xdm to control DM startup.
83 +# Read the comments in /etc/init.d/xdm for more
84 +# info. Do NOT remove, as this will start nothing
85 +# extra at boot if /etc/init.d/xdm is not added
86 +# to the "default" runlevel.
87 +x:a:once:/etc/X11/startDM.sh
88
89 diff --git a/sys-apps/sysvinit/files/reboot.sh b/sys-apps/sysvinit/files/reboot.sh
90 new file mode 100755
91 index 0000000..3e50f71
92 --- /dev/null
93 +++ b/sys-apps/sysvinit/files/reboot.sh
94 @@ -0,0 +1,11 @@
95 +# Copyright 1999-2007 Gentoo Foundation
96 +# Distributed under the terms of the GNU General Public License v2
97 +
98 +opts="-dpk"
99 +[ "${RC_DOWN_INTERFACE}" = "yes" ] && opts="${opts}i"
100 +
101 +/sbin/reboot "${opts}" 2>/dev/null
102 +
103 +# hmm, if the above failed, that's kind of odd ...
104 +# so let's force a reboot
105 +/sbin/reboot -f
106
107 diff --git a/sys-apps/sysvinit/files/shutdown.sh b/sys-apps/sysvinit/files/shutdown.sh
108 new file mode 100755
109 index 0000000..502ef52
110 --- /dev/null
111 +++ b/sys-apps/sysvinit/files/shutdown.sh
112 @@ -0,0 +1,13 @@
113 +# Copyright 1999-2006 Gentoo Foundation
114 +# Distributed under the terms of the GNU General Public License v2
115 +
116 +opts="-d"
117 +[ "${INIT_HALT}" != "HALT" ] && opts="${opts}p"
118 +[ "${RC_DOWN_INTERFACE}" = "yes" ] && opts="${opts}i"
119 +[ "${RC_DOWN_HARDDISK}" = "yes" ] && opts="${opts}h"
120 +
121 +/sbin/halt "${opts}"
122 +
123 +# hmm, if the above failed, that's kind of odd ...
124 +# so let's force a halt
125 +/sbin/halt -f
126
127 diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch b/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch
128 new file mode 100644
129 index 0000000..4948806
130 --- /dev/null
131 +++ b/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch
132 @@ -0,0 +1,142 @@
133 +halt: add a -k kexec flag
134 +
135 +--- a/man/halt.8
136 ++++ b/man/halt.8
137 +@@ -40,6 +40,7 @@ halt, reboot, poweroff \- stop the system.
138 + .RB [ \-d ]
139 + .RB [ \-f ]
140 + .RB [ \-i ]
141 ++.RB [ \-k ]
142 + .br
143 + .B /sbin/poweroff
144 + .RB [ \-n ]
145 +@@ -83,6 +84,8 @@ Put all hard drives on the system in stand-by mode just before halt or power-off
146 + .IP \fB\-p\fP
147 + When halting the system, switch off the power. This is the default when halt is
148 + called as \fBpoweroff\fP.
149 ++.IP \fB\-k\fP
150 ++Try to reboot using \fBkexec\fP, if kernel supports it.
151 + .\"}}}
152 + .\"{{{ Diagnostics
153 + .SH DIAGNOSTICS
154 +--- a/src/halt.c
155 ++++ b/src/halt.c
156 +@@ -8,7 +8,7 @@
157 + * execute an "shutdown -r". This is for compatibility with
158 + * sysvinit 2.4.
159 + *
160 +- * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p]
161 ++ * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p] [-k]
162 + * -n: don't sync before halting the system
163 + * -w: only write a wtmp reboot record and exit.
164 + * -d: don't write a wtmp record.
165 +@@ -16,6 +16,7 @@
166 + * -h: put harddisks in standby mode
167 + * -i: shut down all network interfaces.
168 + * -p: power down the system (if possible, otherwise halt).
169 ++ * -k: reboot the system using kexec.
170 + *
171 + * Reboot and halt are both this program. Reboot
172 + * is just a link to halt. Invoking the program
173 +@@ -74,8 +75,10 @@ extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
174 + */
175 + void usage(void)
176 + {
177 +- fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n",
178 +- progname, strcmp(progname, "halt") ? "" : " [-p]");
179 ++ fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s%s\n",
180 ++ progname,
181 ++ strcmp(progname, "halt") ? "" : " [-p]",
182 ++ strcmp(progname, "reboot") ? "" : " [-k]");
183 + fprintf(stderr, "\t-n: don't sync before halting the system\n");
184 + fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n");
185 + fprintf(stderr, "\t-d: don't write a wtmp record.\n");
186 +@@ -84,6 +87,8 @@ void usage(void)
187 + fprintf(stderr, "\t-i: shut down all network interfaces.\n");
188 + if (!strcmp(progname, "halt"))
189 + fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n");
190 ++ if (!strcmp(progname, "reboot"))
191 ++ fprintf(stderr, "\t-k: reboot the system using kexec.\n");
192 + exit(1);
193 + }
194 +
195 +@@ -182,6 +187,7 @@ int main(int argc, char **argv)
196 + int do_ifdown = 0;
197 + int do_hddown = 0;
198 + int do_poweroff = 0;
199 ++ int do_kexec = 0;
200 + int c;
201 + char *tm = NULL;
202 +
203 +@@ -201,7 +207,7 @@ int main(int argc, char **argv)
204 + /*
205 + * Get flags
206 + */
207 +- while((c = getopt(argc, argv, ":ihdfnpwt:")) != EOF) {
208 ++ while((c = getopt(argc, argv, ":ihdfnpwkt:")) != EOF) {
209 + switch(c) {
210 + case 'n':
211 + do_sync = 0;
212 +@@ -225,6 +231,9 @@ int main(int argc, char **argv)
213 + case 'p':
214 + do_poweroff = 1;
215 + break;
216 ++ case 'k':
217 ++ do_kexec = 1;
218 ++ break;
219 + case 't':
220 + tm = optarg;
221 + break;
222 +@@ -242,10 +251,24 @@ int main(int argc, char **argv)
223 + (void)chdir("/");
224 +
225 + if (!do_hard && !do_nothing) {
226 ++ c = get_runlevel();
227 ++
228 ++ /*
229 ++ * We can't reboot using kexec through this path.
230 ++ */
231 ++ if (c != '6' && do_reboot && do_kexec) {
232 ++ fprintf(stderr, "ERROR: using -k at this"
233 ++ " runlevel requires also -f\n"
234 ++ " (You probably want instead to reboot"
235 ++ " normally and let your reboot\n"
236 ++ " script, usually /etc/init.d/reboot,"
237 ++ " specify -k)\n");
238 ++ exit(1);
239 ++ }
240 ++
241 + /*
242 + * See if we are in runlevel 0 or 6.
243 + */
244 +- c = get_runlevel();
245 + if (c != '0' && c != '6')
246 + do_shutdown(do_reboot ? "-r" : "-h", tm);
247 + }
248 +@@ -277,6 +300,15 @@ int main(int argc, char **argv)
249 + if (do_nothing) exit(0);
250 +
251 + if (do_reboot) {
252 ++ /*
253 ++ * kexec or reboot
254 ++ */
255 ++ if (do_kexec)
256 ++ init_reboot(BMAGIC_KEXEC);
257 ++
258 ++ /*
259 ++ * Fall through if failed
260 ++ */
261 + init_reboot(BMAGIC_REBOOT);
262 + } else {
263 + /*
264 +--- a/src/reboot.h
265 ++++ b/src/reboot.h
266 +@@ -47,5 +47,8 @@
267 + # define BMAGIC_POWEROFF BMAGIC_HALT
268 + #endif
269 +
270 ++/* for kexec support */
271 ++#define BMAGIC_KEXEC 0x45584543
272 ++
273 + #define init_reboot(magic) reboot(magic)
274 +
275
276 diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch b/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch
277 new file mode 100644
278 index 0000000..b8e403f
279 --- /dev/null
280 +++ b/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch
281 @@ -0,0 +1,36 @@
282 +This patch makes shutdown use the Single User runlevel by default so
283 +the gettys are shutdown too.
284 +
285 +Roy Marples <uberlord@g.o>
286 +
287 +--- a/man/shutdown.8
288 ++++ b/man/shutdown.8
289 +@@ -44,7 +44,7 @@ mail and news processing programs a chance to exit cleanly, etc.
290 + \fBshutdown\fP does its job by signalling the \fBinit\fP process,
291 + asking it to change the runlevel.
292 + Runlevel \fB0\fP is used to halt the system, runlevel \fB6\fP is used
293 +-to reboot the system, and runlevel \fB1\fP is used to put to system into
294 ++to reboot the system, and runlevel \fBS\fP is used to put to system into
295 + a state where administrative tasks can be performed; this is the default
296 + if neither the \fI-h\fP or \fI-r\fP flag is given to \fBshutdown\fP.
297 + To see which actions are taken on halt or reboot see the appropriate
298 +--- a/src/shutdown.c
299 ++++ b/src/shutdown.c
300 +@@ -506,7 +506,7 @@ int main(int argc, char **argv)
301 + usage();
302 + exit(1);
303 + }
304 +- strcpy(down_level, "1");
305 ++ strcpy(down_level, "S");
306 + halttype = NULL;
307 +
308 + /* Process the options. */
309 +@@ -685,6 +685,8 @@ int main(int argc, char **argv)
310 + strcpy(newstate, "for reboot");
311 + break;
312 + case '1':
313 ++ case 'S':
314 ++ case 's':
315 + strcpy(newstate, "to maintenance mode");
316 + break;
317 + default:
318
319 diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch b/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch
320 new file mode 100644
321 index 0000000..22f463c
322 --- /dev/null
323 +++ b/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch
324 @@ -0,0 +1,60 @@
325 +http://savannah.nongnu.org/bugs/index.php?29758
326 +
327 +From 2b7d90f04cdd0e343f413c5c7672615926c02706 Mon Sep 17 00:00:00 2001
328 +From: wfink <wfink@456724a4-4300-0410-8514-c89748c515a2>
329 +Date: Tue, 4 May 2010 07:50:12 +0000
330 +Subject: [PATCH] Fix sysvinit bug #29758
331 +
332 +git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@87 456724a4-4300-0410-8514-c89748c515a2
333 +
334 +diff --git a/src/Makefile b/src/Makefile
335 +index e2b8028..19675c5 100644
336 +--- a/src/Makefile
337 ++++ b/src/Makefile
338 +@@ -92,9 +92,9 @@ all: $(BIN) $(SBIN) $(USRBIN)
339 + init: LDLIBS += $(INITLIBS) $(STATIC)
340 + init: init.o init_utmp.o
341 +
342 +-halt: halt.o ifdown.o hddown.o utmp.o reboot.h
343 ++halt: halt.o ifdown.o hddown.o utmp.o
344 +
345 +-last: last.o oldutmp.h
346 ++last: last.o
347 +
348 + mesg: mesg.o
349 +
350 +@@ -109,7 +109,7 @@ sulogin: sulogin.o
351 +
352 + wall: dowall.o wall.o
353 +
354 +-shutdown: dowall.o shutdown.o utmp.o reboot.h
355 ++shutdown: dowall.o shutdown.o utmp.o
356 +
357 + bootlogd: LDLIBS += -lutil
358 + bootlogd: bootlogd.o
359 +@@ -118,14 +118,22 @@ sulogin.o: CPPFLAGS += $(SELINUX_DEF)
360 + sulogin.o: sulogin.c
361 +
362 + init.o: CPPFLAGS += $(SELINUX_DEF)
363 +-init.o: init.c init.h set.h reboot.h initreq.h
364 ++init.o: init.c init.h initreq.h paths.h reboot.h set.h
365 +
366 +-utmp.o: utmp.c init.h
367 ++utmp.o:
368 +
369 + init_utmp.o: CPPFLAGS += -DINIT_MAIN
370 +-init_utmp.o: utmp.c init.h
371 ++init_utmp.o: utmp.c init.h initreq.h paths.h
372 + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
373 +
374 ++utmpdump.o: utmpdump.c oldutmp.h
375 ++
376 ++shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
377 ++
378 ++halt.o: halt.c reboot.h
379 ++
380 ++last.o: last.c oldutmp.h
381 ++
382 + cleanobjs:
383 + rm -f *.o *.bak
384 +
385
386 diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-musl.patch b/sys-apps/sysvinit/files/sysvinit-2.88-musl.patch
387 new file mode 100644
388 index 0000000..6011278
389 --- /dev/null
390 +++ b/sys-apps/sysvinit/files/sysvinit-2.88-musl.patch
391 @@ -0,0 +1,10 @@
392 +--- sysvinit-2.88dsf.org/src/init.c
393 ++++ sysvinit-2.88dsf/src/init.c
394 +@@ -51,6 +51,7 @@
395 + #include <stdarg.h>
396 + #include <sys/syslog.h>
397 + #include <sys/time.h>
398 ++#include <sys/ttydefaults.h>
399 +
400 + #ifdef WITH_SELINUX
401 + # include <selinux/selinux.h>
402
403 diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch b/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch
404 new file mode 100644
405 index 0000000..91b7435
406 --- /dev/null
407 +++ b/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch
408 @@ -0,0 +1,38 @@
409 +http://svn.savannah.nongnu.org/viewvc?view=rev&root=sysvinit&revision=90
410 +https://bugs.gentoo.org/326697
411 +
412 +--- sysvinit/trunk/src/init.c 2010/05/07 15:16:26 89
413 ++++ sysvinit/trunk/src/init.c 2010/05/17 09:44:34 90
414 +@@ -54,10 +54,6 @@
415 +
416 + #ifdef WITH_SELINUX
417 + # include <selinux/selinux.h>
418 +-# include <sys/mount.h>
419 +-# ifndef MNT_DETACH /* present in glibc 2.10, missing in 2.7 */
420 +-# define MNT_DETACH 2
421 +-# endif
422 + #endif
423 +
424 + #ifdef __i386__
425 +@@ -2872,11 +2868,9 @@
426 +
427 + #ifdef WITH_SELINUX
428 + if (getenv("SELINUX_INIT") == NULL) {
429 +- const int rc = mount("proc", "/proc", "proc", 0, 0);
430 +- if (is_selinux_enabled() > 0) {
431 +- putenv("SELINUX_INIT=YES");
432 +- if (rc == 0) umount2("/proc", MNT_DETACH);
433 ++ if (is_selinux_enabled() != 1) {
434 + if (selinux_init_load_policy(&enforce) == 0) {
435 ++ putenv("SELINUX_INIT=YES");
436 + execv(myname, argv);
437 + } else {
438 + if (enforce > 0) {
439 +@@ -2887,7 +2881,6 @@
440 + }
441 + }
442 + }
443 +- if (rc == 0) umount2("/proc", MNT_DETACH);
444 + }
445 + #endif
446 + /* Start booting. */
447
448 diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch b/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch
449 new file mode 100644
450 index 0000000..716999c
451 --- /dev/null
452 +++ b/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch
453 @@ -0,0 +1,65 @@
454 +other inits have moved to not requiring the -h flag when used with -H/-P.
455 +modify sysvinit to be the same since it really doesn't matter.
456 +
457 +https://bugs.gentoo.org/449354
458 +
459 +patch by Doug Goldstein
460 +
461 +--- sysvinit-2.88dsf/man/shutdown.8
462 ++++ sysvinit-2.88dsf/man/shutdown.8
463 +@@ -66,16 +66,15 @@
464 + .\"}}}
465 + .\"{{{ -h
466 + .IP \fB\-h\fP
467 +-Halt or power off after shutdown.
468 ++Equivalent to -P, unless -H is specified.
469 + .\"}}}
470 + .\"{{{ -P
471 + .IP \fB\-P\fP
472 +-Halt action is to turn off the power.
473 ++Action is to power-off the machine.
474 + .\"}}}
475 + .\"{{{ -H
476 + .IP \fB\-H\fP
477 +-Modifier to the -h flag. Halt action is to halt or drop into boot
478 +-monitor on systems that support it. Must be used with the -h flag.
479 ++Action is to halt the machine.
480 + .\"}}}
481 + .\"{{{ -f
482 + .IP \fB\-f\fP
483 +--- sysvinit-2.88dsf/src/shutdown.c
484 ++++ sysvinit-2.88dsf/src/shutdown.c
485 +@@ -514,9 +514,11 @@
486 + switch(c) {
487 + case 'H':
488 + halttype = "HALT";
489 ++ down_level[0] = '0';
490 + break;
491 + case 'P':
492 + halttype = "POWERDOWN";
493 ++ down_level[0] = '0';
494 + break;
495 + case 'a': /* Access control. */
496 + useacl = 1;
497 +@@ -532,6 +534,8 @@
498 + break;
499 + case 'h': /* Halt after shutdown */
500 + down_level[0] = '0';
501 ++ if (!halttype)
502 ++ halttype = "POWERDOWN";
503 + break;
504 + case 'f': /* Don't perform fsck after next boot */
505 + fastboot = 1;
506 +@@ -565,12 +569,6 @@
507 + }
508 + }
509 +
510 +- if (NULL != halttype && down_level[0] != '0') {
511 +- fprintf(stderr, "shutdown: -H and -P flags can only be used along with -h flag.\n");
512 +- usage();
513 +- exit(1);
514 +- }
515 +-
516 + /* Do we need to use the shutdown.allow file ? */
517 + if (useacl && (fp = fopen(SDALLOW, "r")) != NULL) {
518 +
519
520 diff --git a/sys-apps/sysvinit/metadata.xml b/sys-apps/sysvinit/metadata.xml
521 new file mode 100644
522 index 0000000..96a2d58
523 --- /dev/null
524 +++ b/sys-apps/sysvinit/metadata.xml
525 @@ -0,0 +1,5 @@
526 +<?xml version="1.0" encoding="UTF-8"?>
527 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
528 +<pkgmetadata>
529 +<herd>base-system</herd>
530 +</pkgmetadata>
531
532 diff --git a/sys-apps/sysvinit/sysvinit-2.88-r99.ebuild b/sys-apps/sysvinit/sysvinit-2.88-r99.ebuild
533 new file mode 100644
534 index 0000000..820788e
535 --- /dev/null
536 +++ b/sys-apps/sysvinit/sysvinit-2.88-r99.ebuild
537 @@ -0,0 +1,102 @@
538 +# Copyright 1999-2013 Gentoo Foundation
539 +# Distributed under the terms of the GNU General Public License v2
540 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/sysvinit-2.88-r5.ebuild,v 1.4 2013/09/29 01:24:03 vapier Exp $
541 +
542 +EAPI="4"
543 +
544 +inherit eutils toolchain-funcs flag-o-matic
545 +
546 +DESCRIPTION="/sbin/init - parent of all processes"
547 +HOMEPAGE="http://savannah.nongnu.org/projects/sysvinit"
548 +SRC_URI="mirror://nongnu/${PN}/${P}dsf.tar.bz2"
549 +
550 +LICENSE="GPL-2"
551 +SLOT="0"
552 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
553 +IUSE="selinux ibm static kernel_FreeBSD"
554 +
555 +RDEPEND="selinux? ( >=sys-libs/libselinux-1.28 )"
556 +DEPEND="${RDEPEND}
557 + virtual/os-headers"
558 +
559 +S=${WORKDIR}/${P}dsf
560 +
561 +src_prepare() {
562 + epatch "${FILESDIR}"/${PN}-2.86-kexec.patch #80220
563 + epatch "${FILESDIR}"/${PN}-2.86-shutdown-single.patch #158615
564 + epatch "${FILESDIR}"/${P}-makefile.patch #319197
565 + epatch "${FILESDIR}"/${P}-selinux.patch #326697
566 + epatch "${FILESDIR}"/${P}-shutdown-h.patch #449354
567 + epatch "${FILESDIR}"/${P}-musl.patch
568 + sed -i '/^CPPFLAGS =$/d' src/Makefile || die
569 +
570 + # mesg/mountpoint/sulogin/utmpdump/wall have moved to util-linux
571 + sed -i -r \
572 + -e '/^(USR)?S?BIN/s:\<(mesg|mountpoint|sulogin|utmpdump|wall)\>::g' \
573 + -e '/^MAN[18]/s:\<(mesg|mountpoint|sulogin|utmpdump|wall)[.][18]\>::g' \
574 + src/Makefile || die
575 +
576 + # Mung inittab for specific architectures
577 + cd "${WORKDIR}"
578 + cp "${FILESDIR}"/inittab-2.87 inittab || die "cp inittab"
579 + local insert=()
580 + use ppc && insert=( '#psc0:12345:respawn:/sbin/agetty 115200 ttyPSC0 linux' )
581 + use arm && insert=( '#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100' )
582 + use hppa && insert=( 'b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100' )
583 + use s390 && insert=( 's0:12345:respawn:/sbin/agetty 38400 console' )
584 + if use ibm ; then
585 + insert+=(
586 + '#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0'
587 + '#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0'
588 + )
589 + fi
590 + (use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab
591 + if use kernel_FreeBSD ; then
592 + sed -i \
593 + -e 's/linux/cons25/g' \
594 + -e 's/ttyS0/cuaa0/g' \
595 + -e 's/ttyS1/cuaa1/g' \
596 + inittab #121786
597 + fi
598 + if use x86 || use amd64 ; then
599 + sed -i \
600 + -e '/ttyS[01]/s:9600:115200:' \
601 + inittab
602 + fi
603 + if [[ ${#insert[@]} -gt 0 ]] ; then
604 + printf '%s\n' '' '# Architecture specific features' "${insert[@]}" >> inittab
605 + fi
606 +}
607 +
608 +src_compile() {
609 + local myconf
610 +
611 + tc-export CC
612 + append-lfs-flags
613 + export DISTRO= #381311
614 + use static && append-ldflags -static
615 + use selinux && myconf=WITH_SELINUX=yes
616 + emake -C src ${myconf} || die
617 +}
618 +
619 +src_install() {
620 + emake -C src install ROOT="${D}"
621 + dodoc README doc/*
622 +
623 + insinto /etc
624 + doins "${WORKDIR}"/inittab
625 +
626 + doinitd "${FILESDIR}"/{reboot,shutdown}.sh
627 +}
628 +
629 +pkg_postinst() {
630 + # Reload init to fix unmounting problems of / on next reboot.
631 + # This is really needed, as without the new version of init cause init
632 + # not to quit properly on reboot, and causes a fsck of / on next reboot.
633 + if [[ ${ROOT} == / ]] ; then
634 + # Do not return an error if this fails
635 + /sbin/telinit U &>/dev/null
636 + fi
637 +
638 + elog "The mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to sys-apps/util-linux."
639 +}