summaryrefslogtreecommitdiff
path: root/sys-apps/sysvinit
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-apps/sysvinit
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-apps/sysvinit')
-rw-r--r--sys-apps/sysvinit/Manifest13
-rw-r--r--sys-apps/sysvinit/files/inittab-2.8859
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch142
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch36
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch60
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch38
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch65
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.88-sysmacros.patch12
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.88-ttydefaults.patch10
-rw-r--r--sys-apps/sysvinit/metadata.xml8
-rw-r--r--sys-apps/sysvinit/sysvinit-2.88-r9.ebuild122
11 files changed, 565 insertions, 0 deletions
diff --git a/sys-apps/sysvinit/Manifest b/sys-apps/sysvinit/Manifest
new file mode 100644
index 000000000000..5904c8f9fdcb
--- /dev/null
+++ b/sys-apps/sysvinit/Manifest
@@ -0,0 +1,13 @@
+AUX inittab-2.88 1928 SHA256 6980758105a80c7957f8444aaf3e9db8e3354e98fb463451529d3f43071c2f73 SHA512 71476e1e07e288796887c7cfdf359523403816adb939c5c364b4fafef3dabd3e7eefb354bc09343606af4804a10247b5f345b404a5490fcdae8937287a84a990 WHIRLPOOL a00d9a6a5fa01021a2c3f7998f2da4f5a27ecf557b8e403b4756ec0b6da47f3a273abd87157ceeb2d38581c32b620aa829c7f8e0ab029ed3c926b466bd69b26e
+AUX sysvinit-2.86-kexec.patch 3910 SHA256 a9d764afc05ae73c2153b024a3b9e3295ba913e14e9684ddf1fd94467e4bc823 SHA512 6ce3adf698554d15394edbe6dbfc62822859854d503b201c9f96bd81c2a8cd249ed44229a85dd8b97f454f9311abc5792e349f5cc512ff6d5570500d88044bee WHIRLPOOL aecabc2b97e80d401bba856a38ab92d66c038eb00fe58e56e7e87d6ecb4ef0ec8e07534430887eb3f204dfac20f2d94e6ea81e2d7597e3a937442f376f703887
+AUX sysvinit-2.86-shutdown-single.patch 1229 SHA256 78852ca410e7ee23bf69cb6e566cb90404d8c8b7bcc10b264f66c97e0359d431 SHA512 b1fa6225cdb0d5ed6d2d3128a9ad29dc76f14845c3fe57aa2edf234af456ae49f700b25ed4170a6337f662be224bd6ddfd424331483b0c482fd33cd045ddc575 WHIRLPOOL a770eec46053c67a047832742197b8d30d8b5e2e27cad0dc4f608cbccde0b5ece7e08102c51372cc0b33304e266e3b03156d12209db14fbe61800b312ad556aa
+AUX sysvinit-2.88-makefile.patch 1546 SHA256 933bf495538ac92a9b1f3a4623f423b0cb15b37aa4a09f3612f40069dd58a5b7 SHA512 8cc6d2b3fe43d9040aa9f54b2ac448c3dbe986de629638052ddc294b2589ed283b51cc25d9b73e8dac5c5183a5c0675799fa425cf44523636c3ad1a943f1e4a5 WHIRLPOOL 4f999b12dfd51628fa7696afb35381374daece9535d97b1aee4a56dc183c33bd8cd1445a75f561ae5c2ba85da0149dddb6d62053572521c8ec5e296c84fdf4da
+AUX sysvinit-2.88-selinux.patch 1041 SHA256 e987ab6e478e5b3987ae1c6e338cfc66ae356f704d0c3ea932f9e4335b4986f0 SHA512 46eeb3ab2dd25f314b9f60b2dc8a7da2aa2aafb978953a730ccc36456d240e317930e86df69ce2592cf45978f3307dfc2522b24ae1158e64ff17dfa6ed84dcb8 WHIRLPOOL 4fe319df09759addf9499367a6da47e8effe93ec0a4ba5b7e7b1d0c746b324a303cdc81eb360c81e529faf41260d69e2b4364d6695b390db9dba1e3d1693c872
+AUX sysvinit-2.88-shutdown-h.patch 1626 SHA256 642585158e6fbb185ed53804be2eeea85c037726ed19beb51a9ffb594e63ca0f SHA512 244ed7c2242f52674153ccfebb92c7a9bdc68a25f98aacbbf107ddfce11b195483e90150619fbeae3167136fcb54b878f8eb77e2dfe225d9f2eeb2c182e5e2fe WHIRLPOOL 6500d8be6313190e5ccf8ca0fe3d51ef879458f59e7ebe1849f666f3c20ffdea21d73f2951e978ac0bf7dce1f47be0113e129db784fdabb6f4407e4d78a3cb0d
+AUX sysvinit-2.88-sysmacros.patch 224 SHA256 64cc0d464fbf2292ea523c9e79702e6f6eb2af778c9beef24162f2b9cbe2cbc3 SHA512 217fc75d34a19caebcdc56967f7cc9664d46d1523fc09b17369d10d61389dd7b93b8863ec292427603ed55aa68e86d5a81839f1da480b7654d78a4b01d83df43 WHIRLPOOL b9ef59de6140be237a69b69c3779bee01dd81527562444bb555cc77d0eb2179df01530dae144b3d744c05aa8aa7b7db5131c0c87a5b7d56a40ce2ae3327de7b8
+AUX sysvinit-2.88-ttydefaults.patch 266 SHA256 ac2dd0cba71c1bb501a1e164222c8480e930df7b650d2c16dd3f6d471270ce33 SHA512 d27c0f0ae4d2c6ddb9622c76571c0a4260b2c537ec7fcbc3c56b4e461f43238e5c9f8072f2db582bf5e625320e963e840aac247c83ec2438c3454d7cdc1b3198 WHIRLPOOL 9c4e4e119ed87dbf099f01be92d47793816c4ac31ab0288881f4aeb981c373082be0eaf96b759488cee92c4585cd1ca05d2404adddb1bbed5253119c228d0940
+DIST sysvinit-2.88dsf.tar.bz2 105551 SHA256 60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519 SHA512 0bd8eeb124e84fdfa8e621b05f796804ee69a9076b65f5115826bfa814ac1d5d28d31a5c22ebe77c86a93b2288edf4891adc0afaecc4de656c4ecda8a83807bf WHIRLPOOL f4809e19ea2c72c733d3c09a4964d7a6e67b091d1f1d9ef276515b2f138148bfbf516034d3fb1009289f9520f2fbe9e29687f432bba06fb437ebd6e2b9ef570c
+EBUILD sysvinit-2.88-r9.ebuild 3470 SHA256 367ca905ea802223f4a32e2f71d078cb00d5e675c904bf635a8ba8f94bce459e SHA512 3beb173dc4b830874f20e16f9d079abba86c2813f81719d091c174aed9591a803fb92d5fa2d20884f8aebb755b6735fa6183613271a576cd93f51c17a072b0f5 WHIRLPOOL 38ec93137e525d96365c57f565206cc4b726e41c57732a7321f60d3398178d479c5efa187422f600a600c50e6c4fe6385057770cd41d8341806627a59bc845d6
+MISC ChangeLog 6609 SHA256 2927af5980b8b65ada7026409c1f00cd1b76ec58f72f2f11d9a14bde20ff10e1 SHA512 b5f6c71caf6ad0a506bb1804f7141a889c0857749bf1ba884d7d2a9302cf851fdfa4c261f440210ded970fe8cf065a425dd02019276909cf58c015886804faf2 WHIRLPOOL fda83760fdf5b9b7bf2e3ee720d6f920bbfbb342b8e20b1a24b33401f5a617eb2de510b4abf7175ba3fd0d745d24b361241c4a220c8a8a1859410dc75dfb38be
+MISC ChangeLog-2015 21167 SHA256 046ef182e1c055ba8c6a745a79fd9d89fbfc633f12f7ab82128f5c55e81df34e SHA512 4f7e35563a74ddf31e0d0e28ee3ae0c0369c12b0d2420506f53d1267d651a1b77f48a263dbaac00fd6e4d23f1980fe458ac8ff95313042c16361178721c8f78d WHIRLPOOL 399470a61330172d5bed008f9b57ff4820f7ff770cd399c7f244afca4be588196cdb1b7cc7de8858945918fddc74febae179ace497cf7a7dd390a3027db067ef
+MISC metadata.xml 253 SHA256 d82c33ef453113a5c1ebe250dcba373c22934a69b0a86c6ab15a5ca589c25b91 SHA512 54a9069aeb4165d2dff3d473c8001bc51613aac9dff3f7f5e9971a9891a737a31511ffa11cbd523febe581ac1d9de2bdf2f40410f0c4239138f2ccca3ef15555 WHIRLPOOL e5aee23acff864609953a1e4de768f0e4aef704b44c53c021f28573e1ca5c99f1a46d92935ecec2449f7b4419a36d8373127d0ecfa8d7bae72d835e1839eb3f8
diff --git a/sys-apps/sysvinit/files/inittab-2.88 b/sys-apps/sysvinit/files/inittab-2.88
new file mode 100644
index 000000000000..baab75b31acc
--- /dev/null
+++ b/sys-apps/sysvinit/files/inittab-2.88
@@ -0,0 +1,59 @@
+#
+# /etc/inittab: This file describes how the INIT process should set up
+# the system in a certain run-level.
+#
+# Author: Miquel van Smoorenburg, <miquels@cistron.nl>
+# Modified by: Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
+# Modified by: Daniel Robbins, <drobbins@gentoo.org>
+# Modified by: Martin Schlemmer, <azarah@gentoo.org>
+# Modified by: Mike Frysinger, <vapier@gentoo.org>
+# Modified by: Robin H. Johnson, <robbat2@gentoo.org>
+# Modified by: William Hubbs, <williamh@gentoo.org>
+#
+
+# Default runlevel.
+id:3:initdefault:
+
+# System initialization, mount local filesystems, etc.
+si::sysinit:/sbin/openrc sysinit
+
+# Further system initialization, brings up the boot runlevel.
+rc::bootwait:/sbin/openrc boot
+
+l0:0:wait:/sbin/openrc shutdown
+l0s:0:wait:/sbin/halt -dhnp
+l1:1:wait:/sbin/openrc single
+l2:2:wait:/sbin/openrc nonetwork
+l3:3:wait:/sbin/openrc default
+l4:4:wait:/sbin/openrc default
+l5:5:wait:/sbin/openrc default
+l6:6:wait:/sbin/openrc reboot
+l6r:6:wait:/sbin/reboot -dkn
+#z6:6:respawn:/sbin/sulogin
+
+# new-style single-user
+su0:S:wait:/sbin/openrc single
+su1:S:wait:/sbin/sulogin
+
+# TERMINALS
+#x1:12345:respawn:/sbin/agetty 38400 console linux
+c1:12345:respawn:/sbin/agetty 38400 tty1 linux
+c2:2345:respawn:/sbin/agetty 38400 tty2 linux
+c3:2345:respawn:/sbin/agetty 38400 tty3 linux
+c4:2345:respawn:/sbin/agetty 38400 tty4 linux
+c5:2345:respawn:/sbin/agetty 38400 tty5 linux
+c6:2345:respawn:/sbin/agetty 38400 tty6 linux
+
+# SERIAL CONSOLES
+#s0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt100
+#s1:12345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
+
+# What to do at the "Three Finger Salute".
+ca:12345:ctrlaltdel:/sbin/shutdown -r now
+
+# Used by /etc/init.d/xdm to control DM startup.
+# Read the comments in /etc/init.d/xdm for more
+# info. Do NOT remove, as this will start nothing
+# extra at boot if /etc/init.d/xdm is not added
+# to the "default" runlevel.
+x:a:once:/etc/X11/startDM.sh
diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch b/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch
new file mode 100644
index 000000000000..4948806d9eb9
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch
@@ -0,0 +1,142 @@
+halt: add a -k kexec flag
+
+--- a/man/halt.8
++++ b/man/halt.8
+@@ -40,6 +40,7 @@ halt, reboot, poweroff \- stop the system.
+ .RB [ \-d ]
+ .RB [ \-f ]
+ .RB [ \-i ]
++.RB [ \-k ]
+ .br
+ .B /sbin/poweroff
+ .RB [ \-n ]
+@@ -83,6 +84,8 @@ Put all hard drives on the system in stand-by mode just before halt or power-off
+ .IP \fB\-p\fP
+ When halting the system, switch off the power. This is the default when halt is
+ called as \fBpoweroff\fP.
++.IP \fB\-k\fP
++Try to reboot using \fBkexec\fP, if kernel supports it.
+ .\"}}}
+ .\"{{{ Diagnostics
+ .SH DIAGNOSTICS
+--- a/src/halt.c
++++ b/src/halt.c
+@@ -8,7 +8,7 @@
+ * execute an "shutdown -r". This is for compatibility with
+ * sysvinit 2.4.
+ *
+- * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p]
++ * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p] [-k]
+ * -n: don't sync before halting the system
+ * -w: only write a wtmp reboot record and exit.
+ * -d: don't write a wtmp record.
+@@ -16,6 +16,7 @@
+ * -h: put harddisks in standby mode
+ * -i: shut down all network interfaces.
+ * -p: power down the system (if possible, otherwise halt).
++ * -k: reboot the system using kexec.
+ *
+ * Reboot and halt are both this program. Reboot
+ * is just a link to halt. Invoking the program
+@@ -74,8 +75,10 @@ extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
+ */
+ void usage(void)
+ {
+- fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n",
+- progname, strcmp(progname, "halt") ? "" : " [-p]");
++ fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s%s\n",
++ progname,
++ strcmp(progname, "halt") ? "" : " [-p]",
++ strcmp(progname, "reboot") ? "" : " [-k]");
+ fprintf(stderr, "\t-n: don't sync before halting the system\n");
+ fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n");
+ fprintf(stderr, "\t-d: don't write a wtmp record.\n");
+@@ -84,6 +87,8 @@ void usage(void)
+ fprintf(stderr, "\t-i: shut down all network interfaces.\n");
+ if (!strcmp(progname, "halt"))
+ fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n");
++ if (!strcmp(progname, "reboot"))
++ fprintf(stderr, "\t-k: reboot the system using kexec.\n");
+ exit(1);
+ }
+
+@@ -182,6 +187,7 @@ int main(int argc, char **argv)
+ int do_ifdown = 0;
+ int do_hddown = 0;
+ int do_poweroff = 0;
++ int do_kexec = 0;
+ int c;
+ char *tm = NULL;
+
+@@ -201,7 +207,7 @@ int main(int argc, char **argv)
+ /*
+ * Get flags
+ */
+- while((c = getopt(argc, argv, ":ihdfnpwt:")) != EOF) {
++ while((c = getopt(argc, argv, ":ihdfnpwkt:")) != EOF) {
+ switch(c) {
+ case 'n':
+ do_sync = 0;
+@@ -225,6 +231,9 @@ int main(int argc, char **argv)
+ case 'p':
+ do_poweroff = 1;
+ break;
++ case 'k':
++ do_kexec = 1;
++ break;
+ case 't':
+ tm = optarg;
+ break;
+@@ -242,10 +251,24 @@ int main(int argc, char **argv)
+ (void)chdir("/");
+
+ if (!do_hard && !do_nothing) {
++ c = get_runlevel();
++
++ /*
++ * We can't reboot using kexec through this path.
++ */
++ if (c != '6' && do_reboot && do_kexec) {
++ fprintf(stderr, "ERROR: using -k at this"
++ " runlevel requires also -f\n"
++ " (You probably want instead to reboot"
++ " normally and let your reboot\n"
++ " script, usually /etc/init.d/reboot,"
++ " specify -k)\n");
++ exit(1);
++ }
++
+ /*
+ * See if we are in runlevel 0 or 6.
+ */
+- c = get_runlevel();
+ if (c != '0' && c != '6')
+ do_shutdown(do_reboot ? "-r" : "-h", tm);
+ }
+@@ -277,6 +300,15 @@ int main(int argc, char **argv)
+ if (do_nothing) exit(0);
+
+ if (do_reboot) {
++ /*
++ * kexec or reboot
++ */
++ if (do_kexec)
++ init_reboot(BMAGIC_KEXEC);
++
++ /*
++ * Fall through if failed
++ */
+ init_reboot(BMAGIC_REBOOT);
+ } else {
+ /*
+--- a/src/reboot.h
++++ b/src/reboot.h
+@@ -47,5 +47,8 @@
+ # define BMAGIC_POWEROFF BMAGIC_HALT
+ #endif
+
++/* for kexec support */
++#define BMAGIC_KEXEC 0x45584543
++
+ #define init_reboot(magic) reboot(magic)
+
diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch b/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch
new file mode 100644
index 000000000000..b8e403f629f7
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.86-shutdown-single.patch
@@ -0,0 +1,36 @@
+This patch makes shutdown use the Single User runlevel by default so
+the gettys are shutdown too.
+
+Roy Marples <uberlord@gentoo.org>
+
+--- a/man/shutdown.8
++++ b/man/shutdown.8
+@@ -44,7 +44,7 @@ mail and news processing programs a chance to exit cleanly, etc.
+ \fBshutdown\fP does its job by signalling the \fBinit\fP process,
+ asking it to change the runlevel.
+ Runlevel \fB0\fP is used to halt the system, runlevel \fB6\fP is used
+-to reboot the system, and runlevel \fB1\fP is used to put to system into
++to reboot the system, and runlevel \fBS\fP is used to put to system into
+ a state where administrative tasks can be performed; this is the default
+ if neither the \fI-h\fP or \fI-r\fP flag is given to \fBshutdown\fP.
+ To see which actions are taken on halt or reboot see the appropriate
+--- a/src/shutdown.c
++++ b/src/shutdown.c
+@@ -506,7 +506,7 @@ int main(int argc, char **argv)
+ usage();
+ exit(1);
+ }
+- strcpy(down_level, "1");
++ strcpy(down_level, "S");
+ halttype = NULL;
+
+ /* Process the options. */
+@@ -685,6 +685,8 @@ int main(int argc, char **argv)
+ strcpy(newstate, "for reboot");
+ break;
+ case '1':
++ case 'S':
++ case 's':
+ strcpy(newstate, "to maintenance mode");
+ break;
+ default:
diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch b/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch
new file mode 100644
index 000000000000..73c0160803a8
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.88-makefile.patch
@@ -0,0 +1,60 @@
+https://savannah.nongnu.org/bugs/index.php?29758
+
+From 2b7d90f04cdd0e343f413c5c7672615926c02706 Mon Sep 17 00:00:00 2001
+From: wfink <wfink@456724a4-4300-0410-8514-c89748c515a2>
+Date: Tue, 4 May 2010 07:50:12 +0000
+Subject: [PATCH] Fix sysvinit bug #29758
+
+git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@87 456724a4-4300-0410-8514-c89748c515a2
+
+diff --git a/src/Makefile b/src/Makefile
+index e2b8028..19675c5 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -92,9 +92,9 @@ all: $(BIN) $(SBIN) $(USRBIN)
+ init: LDLIBS += $(INITLIBS) $(STATIC)
+ init: init.o init_utmp.o
+
+-halt: halt.o ifdown.o hddown.o utmp.o reboot.h
++halt: halt.o ifdown.o hddown.o utmp.o
+
+-last: last.o oldutmp.h
++last: last.o
+
+ mesg: mesg.o
+
+@@ -109,7 +109,7 @@ sulogin: sulogin.o
+
+ wall: dowall.o wall.o
+
+-shutdown: dowall.o shutdown.o utmp.o reboot.h
++shutdown: dowall.o shutdown.o utmp.o
+
+ bootlogd: LDLIBS += -lutil
+ bootlogd: bootlogd.o
+@@ -118,14 +118,22 @@ sulogin.o: CPPFLAGS += $(SELINUX_DEF)
+ sulogin.o: sulogin.c
+
+ init.o: CPPFLAGS += $(SELINUX_DEF)
+-init.o: init.c init.h set.h reboot.h initreq.h
++init.o: init.c init.h initreq.h paths.h reboot.h set.h
+
+-utmp.o: utmp.c init.h
++utmp.o:
+
+ init_utmp.o: CPPFLAGS += -DINIT_MAIN
+-init_utmp.o: utmp.c init.h
++init_utmp.o: utmp.c init.h initreq.h paths.h
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
++utmpdump.o: utmpdump.c oldutmp.h
++
++shutdown.o: shutdown.c paths.h reboot.h initreq.h init.h
++
++halt.o: halt.c reboot.h
++
++last.o: last.c oldutmp.h
++
+ cleanobjs:
+ rm -f *.o *.bak
+
diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch b/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch
new file mode 100644
index 000000000000..91b7435b25ac
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.88-selinux.patch
@@ -0,0 +1,38 @@
+http://svn.savannah.nongnu.org/viewvc?view=rev&root=sysvinit&revision=90
+https://bugs.gentoo.org/326697
+
+--- sysvinit/trunk/src/init.c 2010/05/07 15:16:26 89
++++ sysvinit/trunk/src/init.c 2010/05/17 09:44:34 90
+@@ -54,10 +54,6 @@
+
+ #ifdef WITH_SELINUX
+ # include <selinux/selinux.h>
+-# include <sys/mount.h>
+-# ifndef MNT_DETACH /* present in glibc 2.10, missing in 2.7 */
+-# define MNT_DETACH 2
+-# endif
+ #endif
+
+ #ifdef __i386__
+@@ -2872,11 +2868,9 @@
+
+ #ifdef WITH_SELINUX
+ if (getenv("SELINUX_INIT") == NULL) {
+- const int rc = mount("proc", "/proc", "proc", 0, 0);
+- if (is_selinux_enabled() > 0) {
+- putenv("SELINUX_INIT=YES");
+- if (rc == 0) umount2("/proc", MNT_DETACH);
++ if (is_selinux_enabled() != 1) {
+ if (selinux_init_load_policy(&enforce) == 0) {
++ putenv("SELINUX_INIT=YES");
+ execv(myname, argv);
+ } else {
+ if (enforce > 0) {
+@@ -2887,7 +2881,6 @@
+ }
+ }
+ }
+- if (rc == 0) umount2("/proc", MNT_DETACH);
+ }
+ #endif
+ /* Start booting. */
diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch b/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch
new file mode 100644
index 000000000000..716999c39c3b
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.88-shutdown-h.patch
@@ -0,0 +1,65 @@
+other inits have moved to not requiring the -h flag when used with -H/-P.
+modify sysvinit to be the same since it really doesn't matter.
+
+https://bugs.gentoo.org/449354
+
+patch by Doug Goldstein
+
+--- sysvinit-2.88dsf/man/shutdown.8
++++ sysvinit-2.88dsf/man/shutdown.8
+@@ -66,16 +66,15 @@
+ .\"}}}
+ .\"{{{ -h
+ .IP \fB\-h\fP
+-Halt or power off after shutdown.
++Equivalent to -P, unless -H is specified.
+ .\"}}}
+ .\"{{{ -P
+ .IP \fB\-P\fP
+-Halt action is to turn off the power.
++Action is to power-off the machine.
+ .\"}}}
+ .\"{{{ -H
+ .IP \fB\-H\fP
+-Modifier to the -h flag. Halt action is to halt or drop into boot
+-monitor on systems that support it. Must be used with the -h flag.
++Action is to halt the machine.
+ .\"}}}
+ .\"{{{ -f
+ .IP \fB\-f\fP
+--- sysvinit-2.88dsf/src/shutdown.c
++++ sysvinit-2.88dsf/src/shutdown.c
+@@ -514,9 +514,11 @@
+ switch(c) {
+ case 'H':
+ halttype = "HALT";
++ down_level[0] = '0';
+ break;
+ case 'P':
+ halttype = "POWERDOWN";
++ down_level[0] = '0';
+ break;
+ case 'a': /* Access control. */
+ useacl = 1;
+@@ -532,6 +534,8 @@
+ break;
+ case 'h': /* Halt after shutdown */
+ down_level[0] = '0';
++ if (!halttype)
++ halttype = "POWERDOWN";
+ break;
+ case 'f': /* Don't perform fsck after next boot */
+ fastboot = 1;
+@@ -565,12 +569,6 @@
+ }
+ }
+
+- if (NULL != halttype && down_level[0] != '0') {
+- fprintf(stderr, "shutdown: -H and -P flags can only be used along with -h flag.\n");
+- usage();
+- exit(1);
+- }
+-
+ /* Do we need to use the shutdown.allow file ? */
+ if (useacl && (fp = fopen(SDALLOW, "r")) != NULL) {
+
diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-sysmacros.patch b/sys-apps/sysvinit/files/sysvinit-2.88-sysmacros.patch
new file mode 100644
index 000000000000..efbe47a30be2
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.88-sysmacros.patch
@@ -0,0 +1,12 @@
+Newer C libraries omit this include from sys/types.h.
+
+--- a/src/bootlogd.c
++++ b/src/bootlogd.c
+@@ -32,6 +32,7 @@
+ *
+ */
+
++#include <sys/sysmacros.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
diff --git a/sys-apps/sysvinit/files/sysvinit-2.88-ttydefaults.patch b/sys-apps/sysvinit/files/sysvinit-2.88-ttydefaults.patch
new file mode 100644
index 000000000000..5db809067e13
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.88-ttydefaults.patch
@@ -0,0 +1,10 @@
+--- sysvinit/trunk/src/init.c 2014/01/26 16:40:03 134
++++ sysvinit/trunk/src/init.c 2014/01/26 22:00:42 135
+@@ -49,6 +49,7 @@
+ #include <utmp.h>
+ #include <ctype.h>
+ #include <stdarg.h>
++#include <sys/ttydefaults.h>
+ #include <sys/syslog.h>
+ #include <sys/time.h>
+
diff --git a/sys-apps/sysvinit/metadata.xml b/sys-apps/sysvinit/metadata.xml
new file mode 100644
index 000000000000..56c124413057
--- /dev/null
+++ b/sys-apps/sysvinit/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-apps/sysvinit/sysvinit-2.88-r9.ebuild b/sys-apps/sysvinit/sysvinit-2.88-r9.ebuild
new file mode 100644
index 000000000000..06533bd44b12
--- /dev/null
+++ b/sys-apps/sysvinit/sysvinit-2.88-r9.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="/sbin/init - parent of all processes"
+HOMEPAGE="https://savannah.nongnu.org/projects/sysvinit"
+SRC_URI="mirror://nongnu/${PN}/${P}dsf.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
+IUSE="selinux ibm static kernel_FreeBSD"
+
+CDEPEND="
+ selinux? (
+ >=sys-libs/libselinux-1.28
+ )"
+DEPEND="${CDEPEND}
+ virtual/os-headers"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-shutdown )
+ !<sys-apps/openrc-0.13
+"
+
+S=${WORKDIR}/${P}dsf
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.86-kexec.patch" #80220
+ "${FILESDIR}/${PN}-2.86-shutdown-single.patch" #158615
+ "${FILESDIR}/${P}-makefile.patch" #319197
+ "${FILESDIR}/${P}-selinux.patch" #326697
+ "${FILESDIR}/${P}-shutdown-h.patch" #449354
+ "${FILESDIR}/${PN}-2.88-sysmacros.patch"
+ "${FILESDIR}/${PN}-2.88-ttydefaults.patch" #551626
+)
+
+src_prepare() {
+ epatch "${PATCHES[@]}"
+ sed -i '/^CPPFLAGS =$/d' src/Makefile || die
+
+ # last/lastb/mesg/mountpoint/sulogin/utmpdump/wall have moved to util-linux
+ sed -i -r \
+ -e '/^(USR)?S?BIN/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)\>::g' \
+ -e '/^MAN[18]/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)[.][18]\>::g' \
+ src/Makefile || die
+
+ # pidof has moved to >=procps-3.3.9
+ sed -i -r \
+ -e '/\/bin\/pidof/d' \
+ -e '/^MAN8/s:\<pidof.8\>::g' \
+ src/Makefile || die
+
+ # Mung inittab for specific architectures
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/inittab-2.88 inittab || die "cp inittab"
+ local insert=()
+ use ppc && insert=( '#psc0:12345:respawn:/sbin/agetty 115200 ttyPSC0 linux' )
+ use arm && insert=( '#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100' )
+ use arm64 && insert=( 'f0:12345:respawn:/sbin/agetty 9600 ttyAMA0 vt100' )
+ use hppa && insert=( 'b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100' )
+ use s390 && insert=( 's0:12345:respawn:/sbin/agetty 38400 console dumb' )
+ if use ibm ; then
+ insert+=(
+ '#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0'
+ '#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0'
+ )
+ fi
+ (use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab
+ if use kernel_FreeBSD ; then
+ sed -i \
+ -e 's/linux/cons25/g' \
+ -e 's/ttyS0/cuaa0/g' \
+ -e 's/ttyS1/cuaa1/g' \
+ inittab #121786
+ fi
+ if use x86 || use amd64 ; then
+ sed -i \
+ -e '/ttyS[01]/s:9600:115200:' \
+ inittab
+ fi
+ if [[ ${#insert[@]} -gt 0 ]] ; then
+ printf '%s\n' '' '# Architecture specific features' "${insert[@]}" >> inittab
+ fi
+}
+
+src_compile() {
+ local myconf
+
+ tc-export CC
+ append-lfs-flags
+ export DISTRO= #381311
+ use static && append-ldflags -static
+ use selinux && myconf=WITH_SELINUX=yes
+ emake -C src ${myconf} || die
+}
+
+src_install() {
+ emake -C src install ROOT="${D}"
+ dodoc README doc/*
+
+ insinto /etc
+ doins "${WORKDIR}"/inittab
+
+ # dead symlink
+ rm "${D}"/usr/bin/lastb || die
+}
+
+pkg_postinst() {
+ # Reload init to fix unmounting problems of / on next reboot.
+ # This is really needed, as without the new version of init cause init
+ # not to quit properly on reboot, and causes a fsck of / on next reboot.
+ if [[ ${ROOT} == / ]] ; then
+ # Do not return an error if this fails
+ /sbin/telinit U &>/dev/null
+ fi
+
+ elog "The last/lastb/mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to"
+ elog "sys-apps/util-linux. The pidof tool has been moved to sys-process/procps."
+}