From 5884c94b1f92c00406d137c9f308c098e5268a59 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Tue, 13 Jul 2021 19:47:04 +0200 Subject: Initial commit --- sys-apps/sysvinit/Manifest | 10 ++ sys-apps/sysvinit/files/bootlogd.initd | 8 ++ sys-apps/sysvinit/files/halt.sh | 6 + sys-apps/sysvinit/files/inittab-2.98-r1 | 63 +++++++++ sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch | 142 ++++++++++++++++++++ .../files/sysvinit-2.94_beta-shutdown-single.patch | 39 ++++++ .../files/sysvinit-2.99-force-poweroff.patch | 16 +++ .../sysvinit/files/sysvinit-2.99-shutdown-h.patch | 82 ++++++++++++ sys-apps/sysvinit/metadata.xml | 12 ++ sys-apps/sysvinit/sysvinit-2.99.ebuild | 146 +++++++++++++++++++++ 10 files changed, 524 insertions(+) create mode 100644 sys-apps/sysvinit/Manifest create mode 100644 sys-apps/sysvinit/files/bootlogd.initd create mode 100644 sys-apps/sysvinit/files/halt.sh create mode 100644 sys-apps/sysvinit/files/inittab-2.98-r1 create mode 100644 sys-apps/sysvinit/files/sysvinit-2.86-kexec.patch create mode 100644 sys-apps/sysvinit/files/sysvinit-2.94_beta-shutdown-single.patch create mode 100644 sys-apps/sysvinit/files/sysvinit-2.99-force-poweroff.patch create mode 100644 sys-apps/sysvinit/files/sysvinit-2.99-shutdown-h.patch create mode 100644 sys-apps/sysvinit/metadata.xml create mode 100644 sys-apps/sysvinit/sysvinit-2.99.ebuild (limited to 'sys-apps/sysvinit') diff --git a/sys-apps/sysvinit/Manifest b/sys-apps/sysvinit/Manifest new file mode 100644 index 0000000..bd46056 --- /dev/null +++ b/sys-apps/sysvinit/Manifest @@ -0,0 +1,10 @@ +AUX bootlogd.initd 259 BLAKE2B 78c1a1fe8583685656edb85e29f8dbed40bdd7272590bbdaccb52fe6e54cce0a077a28501c7c87bec55f046172545d940c52345551cd3c01cff0895d12b32a15 SHA512 05a3c2542ceaff85c02c5c30a52be8f1bb95741fffef306777ad1b248b527cdd921f009571e1f43d7a6ede0cc61cf490a1dbbbfe0a50b234c258ad7688a37ad9 +AUX halt.sh 101 BLAKE2B f3b8a24b6efce0ccffeb76f401af9f9bce752a541ea646dd6d357eaaa834be2049411148ec18b591283d85f42b0c3c1e41f442ba95c5f5b4cd9e87b39a83d51e SHA512 aaf46f9c74ae58027e59f32e5e929ff6529206d07fdf4e3f17962ccbc46c68d34e4e2839019708a763dead93b83ca8f457379491830ab43d6407247fd7ac2a77 +AUX inittab-2.98-r1 2124 BLAKE2B 57e40e8410a31ec73f581e2feb142c600e2ce687745a6135961c0f1ea31e77f1acf9b9be1cf4c1d55685802a913304056cf1f137686f14d89caa9ec973d751c2 SHA512 6ce22ba933158d1a0fc7d0eaa9536b1cdcd8baa90cddfe8b1bf7a1f7292ba7fc14b6b46968848301a2e573939b4e21ce8d64bf3a9eaeb4d038de7d113fd3b9fb +AUX sysvinit-2.86-kexec.patch 3910 BLAKE2B fb62326925c78960142123da82ffd1de6319153cce234b0d1dc7546beecf67296f8b7d6e3eb0f633d8a4ebc83fc4cc586c4f92cdb48df1f766aa4af72b0fa0e1 SHA512 6ce3adf698554d15394edbe6dbfc62822859854d503b201c9f96bd81c2a8cd249ed44229a85dd8b97f454f9311abc5792e349f5cc512ff6d5570500d88044bee +AUX sysvinit-2.94_beta-shutdown-single.patch 1261 BLAKE2B 571b7cf40ccdbb27e65b31e507ea8331ae1e9b8b012570cdc4099a15c864f2abc92f84c44ef9dbd35dfe43c68e491d347266abaa0156536edae4c35231f17ccb SHA512 2f26201e8634b380dafdf42678cd0241a93f0e473f5c8680d4206d97dfe3510c2ceeb4cd066d1af3ae97fe411f7a5452a9586f8f5c5e65653bf9241fea1edaf0 +AUX sysvinit-2.99-force-poweroff.patch 470 BLAKE2B 9d7ec8d81641b57a3ffac35a8fe53491028dd6b71866cf43593e5d9a9f270af31c5fa959aded213e3bd38a5c5bb0e055015545c35aa627f4d9a427cff627e174 SHA512 d28654a122055169b4bc51f4081d5f770885e6ae13d9467308f26721cb9774a37623d7e1f4e8da993944f35328a82cd157d6f5bedcbb5d4baf172da752b84d72 +AUX sysvinit-2.99-shutdown-h.patch 2684 BLAKE2B 57c27b8646a0b47f66eb103450e645fa45220a1bf79da86207ffa1393c311cb4c4a2ad9b8b7bf81cc4ae2ccb2acb19b66fd575935d8a0b0a2a9b3899c0088c9f SHA512 ef33da0d5673180275c8120c6904a4214cf1308827a626d8d6a2aab67d7d25b5407f9efcaf6a7a4a09a8c409899242943f6a95881cc8c8898b780224f991f2f7 +DIST sysvinit-2.99.tar.xz 126908 BLAKE2B b82c745d5b695f918d4a163e7b9eaceccc07a46f73c3782c7771cc29a8600be13de4ff30891086df5773d60f37fa3b0f58566ccaf72cd70af68083b51152a38b SHA512 34f328d7d2e6ceddcddfebab49eb9c34e90dc96decf2caeb89dffd2ade54322fa4a3cb9fa1e1a4bc687e07fcb0a13e5aebe6186582a9f5c9153e1513baa87ddd +EBUILD sysvinit-2.99.ebuild 4089 BLAKE2B a9893ec8278e5f53528e15dab927b4f14e083861ef6017302ea6c5023bf108544c457c4d1a75c83801db10f3784694150828432e8986bdaf114aeb4d85ea876e SHA512 c53a1713ca68fccab0ad9e5483ecc0281546a14f7b04f59cb2bb949ad42a4b645ba2c31b4fc1a1a75b0431110bd22fb6e6dcb9ed5e8a12cd876f8c4e1db134f7 +MISC metadata.xml 358 BLAKE2B c1093363e2c2f9cbce13e3a7025cf2f767b526e90bcdbe32714aba5aef411483e013facfc014c89ac591feae0fa733902be185ac8a0c673e56799b8168ad77ed SHA512 37306b4ebf69803889059875a22ceccde18725cc21e5a598496c30a377e6cb1d3d9ca88123121b2a70c2436b3a77530415169b53165de93ea8510cc41fbb589f diff --git a/sys-apps/sysvinit/files/bootlogd.initd b/sys-apps/sysvinit/files/bootlogd.initd new file mode 100644 index 0000000..a422192 --- /dev/null +++ b/sys-apps/sysvinit/files/bootlogd.initd @@ -0,0 +1,8 @@ +#!/sbin/openrc-run +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="bootlogd - record boot messages (sysvinit)" +pidfile="/run/bootlogd" +command="/sbin/bootlogd" +command_args="-p ${pidfile}" diff --git a/sys-apps/sysvinit/files/halt.sh b/sys-apps/sysvinit/files/halt.sh new file mode 100644 index 0000000..ff68c42 --- /dev/null +++ b/sys-apps/sysvinit/files/halt.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if [ "${INIT_HALT}" = HALT ]; then + exec /sbin/halt -dhn +else + exec /sbin/poweroff -dhn +fi diff --git a/sys-apps/sysvinit/files/inittab-2.98-r1 b/sys-apps/sysvinit/files/inittab-2.98-r1 new file mode 100644 index 0000000..89c8bd9 --- /dev/null +++ b/sys-apps/sysvinit/files/inittab-2.98-r1 @@ -0,0 +1,63 @@ +# +# /etc/inittab: This file describes how the INIT process should set up +# the system in a certain run-level. +# +# Author: Miquel van Smoorenburg, +# Modified by: Patrick J. Volkerding, +# Modified by: Daniel Robbins, +# Modified by: Martin Schlemmer, +# Modified by: Mike Frysinger, +# Modified by: Robin H. Johnson, +# Modified by: William Hubbs, +# Modified by: Lars Wendler, +# Modified by: Aisha Tammy, +# + +# 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 + +l0u:0:wait:/sbin/telinit u +l0:0:wait:/sbin/openrc shutdown +l0s:0:wait:/sbin/halt.sh +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 +l6u:6:wait:/sbin/telinit u +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 --noclear 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/display-manager to control DM startup. +# Read the comments in /etc/init.d/display-manager for more +# info. Do NOT remove, as this will start nothing +# extra at boot if /etc/init.d/display-manager is not added +# to the "default" runlevel. +x:a:once:/usr/bin/startDM 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 0000000..4948806 --- /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.94_beta-shutdown-single.patch b/sys-apps/sysvinit/files/sysvinit-2.94_beta-shutdown-single.patch new file mode 100644 index 0000000..9aa8522 --- /dev/null +++ b/sys-apps/sysvinit/files/sysvinit-2.94_beta-shutdown-single.patch @@ -0,0 +1,39 @@ +This patch makes shutdown use the Single User runlevel by default so +the gettys are shutdown too. + +Roy Marples + +Forward-ported from v2.86 to v2.94_beta +Lars Wendler + +--- sysvinit-2.94/man/shutdown.8 ++++ sysvinit-2.94/man/shutdown.8 +@@ -44,7 +44,7 @@ + \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 +--- sysvinit-2.94/src/shutdown.c ++++ sysvinit-2.94/src/shutdown.c +@@ -547,7 +547,7 @@ + usage(); + exit(1); + } +- strcpy(down_level, "1"); ++ strcpy(down_level, "S"); + halttype = NULL; + memset(when, '\0', WHEN_SIZE); + +@@ -734,6 +734,8 @@ + strncpy(newstate, "for reboot", STATELEN); + break; + case '1': ++ case 'S': ++ case 's': + strncpy(newstate, "to maintenance mode", STATELEN); + break; + default: diff --git a/sys-apps/sysvinit/files/sysvinit-2.99-force-poweroff.patch b/sys-apps/sysvinit/files/sysvinit-2.99-force-poweroff.patch new file mode 100644 index 0000000..d9dc0ef --- /dev/null +++ b/sys-apps/sysvinit/files/sysvinit-2.99-force-poweroff.patch @@ -0,0 +1,16 @@ +diff -Naur sysvinit-2.99/src/halt.c sysvinit-2.99-mod/src/halt.c +--- sysvinit-2.99/src/halt.c 2021-02-21 19:02:25.000000000 +0100 ++++ sysvinit-2.99-mod/src/halt.c 2021-06-26 17:00:41.577268981 +0200 +@@ -209,6 +209,12 @@ + if (!strcmp(progname, "reboot")) do_reboot = 1; + if (!strcmp(progname, "poweroff")) do_poweroff = 1; + ++ /* The unmatched doen't reboot, so force poweroff */ ++ if (do_reboot) { ++ do_reboot = 0; ++ do_poweroff = 1; ++ } ++ + /* + * Get flags + */ diff --git a/sys-apps/sysvinit/files/sysvinit-2.99-shutdown-h.patch b/sys-apps/sysvinit/files/sysvinit-2.99-shutdown-h.patch new file mode 100644 index 0000000..a4ceeda --- /dev/null +++ b/sys-apps/sysvinit/files/sysvinit-2.99-shutdown-h.patch @@ -0,0 +1,82 @@ +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.99/man/shutdown.8 ++++ sysvinit-2.99/man/shutdown.8 +@@ -66,22 +66,19 @@ + .\"}}} + .\"{{{ -h + .IP \fB\-h\fP +-Halt or power off after shutdown. Usually used with the \fI-P\fP or \fI-H\fP flags, +-depending on whether we want to poweroff or simply stop the operating system. ++Equivalent to \fI-P\fP, unless \fI-H\fP is specified. + .\"}}} + .\"{{{ -P + .IP \fB\-P\fP +-Modifier to the \fI-h\fP flag. Halt action is to turn off the power. +-Must be used with the \fI-h\fP flag. ++Halt action is to turn off the power. + .\"}}} + .\"{{{ -H + .IP \fB\-H\fP +-Modifier to the \fI-h\fP flag. Halt action is to halt or drop into boot +-monitor on systems that support it. Must be used with the \fI-h\fP flag. ++Action is to halt or drop into boot monitor on systems that support it. + Halting is often used to run through the shutdown process and leave + output on the screen for debugging purposes. Or when the user wants the OS to + stop, but leave the power on. To power off at the end of the shutdown sequence +-use the \fI-P\fP modifier instead. ++use the \fI-P\fP option instead. + .\"}}} + .\"{{{ -f + .IP \fB\-f\fP +--- sysvinit-2.99/src/shutdown.c ++++ sysvinit-2.99/src/shutdown.c +@@ -144,9 +144,7 @@ + "\t\t -r: reboot after shutdown.\n" + "\t\t -h: halt after shutdown.\n" + "\t\t -P: halt action is to turn off power.\n" +- "\t\t can only be used along with -h flag.\n" + "\t\t -H: halt action is to just halt.\n" +- "\t\t can only be used along with -h flag.\n" + "\t\t -f: do a 'fast' reboot (skip fsck).\n" + "\t\t -F: Force fsck on reboot.\n" + "\t\t -n: do not go through \"init\" but go down real fast.\n" +@@ -556,9 +554,11 @@ + switch(c) { + case 'H': + halttype = "HALT"; ++ down_level[0] = '0'; + break; + case 'P': + halttype = "POWEROFF"; ++ down_level[0] = '0'; + break; + case 'a': /* Access control. */ + useacl = 1; +@@ -574,6 +574,8 @@ + break; + case 'h': /* Halt after shutdown */ + down_level[0] = '0'; ++ if (!halttype) ++ halttype = "POWEROFF"; + break; + case 'f': /* Don't perform fsck after next boot */ + fastboot = 1; +@@ -613,12 +615,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/metadata.xml b/sys-apps/sysvinit/metadata.xml new file mode 100644 index 0000000..53e0495 --- /dev/null +++ b/sys-apps/sysvinit/metadata.xml @@ -0,0 +1,12 @@ + + + + + williamh@gentoo.org + William Hubbs + + + base-system@gentoo.org + Gentoo Base System + + diff --git a/sys-apps/sysvinit/sysvinit-2.99.ebuild b/sys-apps/sysvinit/sysvinit-2.99.ebuild new file mode 100644 index 0000000..24ce189 --- /dev/null +++ b/sys-apps/sysvinit/sysvinit-2.99.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit 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/_/-}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +[[ "${PV}" == *beta* ]] || \ +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 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 ) + !::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:\::g' \ + src/Makefile || die + + # logsave is already in e2fsprogs + sed -i -r \ + -e '/^(USR)?S?BIN/s:\::g' \ + -e '/^MAN8/s:\::g' \ + src/Makefile || die + + # Mung inittab for specific architectures + cd "${WORKDIR}" || die + cp "${FILESDIR}"/inittab-2.98-r1 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' ) + use riscv && insert=( 'sif0:12345:respawn:/sbin/agetty -L 115200 ttySIF0 vt100' ) + 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 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() { + tc-export CC + append-lfs-flags + export DISTRO= #381311 + export VERSION="${PV}" + use static && append-ldflags -static + emake -C src $(usex selinux 'WITH_SELINUX=yes' '') +} + +src_install() { + emake -C src install ROOT="${D}" + dodoc README doc/* + + insinto /etc + doins "${WORKDIR}"/inittab + + newinitd "${FILESDIR}"/bootlogd.initd bootlogd + into / + dosbin "${FILESDIR}"/halt.sh + + keepdir /etc/inittab.d + + # dead symlink + find "${ED}" -xtype l -delete || die + + find "${ED}" -type d -empty -delete || 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 [[ -z ${ROOT} ]] ; then + if [[ -e /dev/initctl ]] && [[ ! -e /run/initctl ]] ; then + ln -s /dev/initctl /run/initctl \ + || ewarn "Failed to set /run/initctl symlink!" + fi + # 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." + + # Required for new bootlogd service + if [[ ! -e "${EROOT}/var/log/boot" ]] ; then + touch "${EROOT}/var/log/boot" + fi +} -- cgit v1.2.3