summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-22 00:05:32 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-22 00:05:32 +0000
commit8848c8f8e06212e2311d2d19a5ecb1e6c1521962 (patch)
treeaeb1a6a4f45a18be3b9ede5d357ab61fbf3c1218 /sys-apps/sysvinit
parentMark 0.2.3 ~ia64 (diff)
downloadgentoo-2-8848c8f8e06212e2311d2d19a5ecb1e6c1521962.tar.gz
gentoo-2-8848c8f8e06212e2311d2d19a5ecb1e6c1521962.tar.bz2
gentoo-2-8848c8f8e06212e2311d2d19a5ecb1e6c1521962.zip
Add change_console utility from Fedora #123508 by Carl Anderson.
(Portage version: 2.1_pre4-r1)
Diffstat (limited to 'sys-apps/sysvinit')
-rw-r--r--sys-apps/sysvinit/ChangeLog8
-rw-r--r--sys-apps/sysvinit/files/change_console.833
-rw-r--r--sys-apps/sysvinit/files/change_console.c49
-rw-r--r--sys-apps/sysvinit/files/digest-sysvinit-2.86-r52
-rw-r--r--sys-apps/sysvinit/sysvinit-2.86-r5.ebuild92
5 files changed, 183 insertions, 1 deletions
diff --git a/sys-apps/sysvinit/ChangeLog b/sys-apps/sysvinit/ChangeLog
index a76ae00c47e0..cc06d26b8c8a 100644
--- a/sys-apps/sysvinit/ChangeLog
+++ b/sys-apps/sysvinit/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-apps/sysvinit
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/ChangeLog,v 1.25 2006/02/07 01:22:59 pebenito Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/ChangeLog,v 1.26 2006/02/22 00:05:32 vapier Exp $
+
+*sysvinit-2.86-r5 (22 Feb 2006)
+
+ 22 Feb 2006; Mike Frysinger <vapier@gentoo.org> +files/change_console.8,
+ +files/change_console.c, +sysvinit-2.86-r5.ebuild:
+ Add change_console utility from Fedora #123508 by Carl Anderson.
*sysvinit-2.86-r4 (07 Feb 2006)
diff --git a/sys-apps/sysvinit/files/change_console.8 b/sys-apps/sysvinit/files/change_console.8
new file mode 100644
index 000000000000..c1ea01c9b332
--- /dev/null
+++ b/sys-apps/sysvinit/files/change_console.8
@@ -0,0 +1,33 @@
+.TH CHANGE_CONSOLE 8 "23 September 2003" "" "Linux User's Manual"
+
+.SH NAME
+change_console -- change console used by init
+
+.SH SYNOPSIS
+.B change_console
+.RB [ \-f ]
+.RB [ \-r ]
+.RB [device]
+
+.SH DESCRIPTION
+.B change_console
+changes the console used by
+.IR init (8)
+to spawn commands.
+.SH OPTIONS
+.IP \fB\-f\fn
+Remain in the foreground after sending the command to init
+.PP
+.IP \fB\-r\fn
+Reset the console file used by init to its compiled-in default
+(usually /dev/console).
+
+.IP \fBdevice\fn
+The device file to use as the console. If none is specified,
+the result of running ttyname on stdin is used.
+
+.SH SEE ALSO
+.IR init (8)
+
+.SH AUTHOR
+Red Hat, Inc.
diff --git a/sys-apps/sysvinit/files/change_console.c b/sys-apps/sysvinit/files/change_console.c
new file mode 100644
index 000000000000..4f4fbe31767c
--- /dev/null
+++ b/sys-apps/sysvinit/files/change_console.c
@@ -0,0 +1,49 @@
+#include "initreq.h"
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <getopt.h>
+#include <unistd.h>
+
+void signal_handler(int sig) {
+ exit(0);
+}
+
+int main(int argc, char **argv) {
+ int foreground = 0, reset = 0, fd, x = 1;
+ char *device = NULL;
+ struct init_request req;
+
+ while (x < argc) {
+ if (!strcmp(argv[x], "-f")) {
+ foreground = 1;
+ } else if (!strcmp(argv[x], "-r")) {
+ reset = 1;
+ } else {
+ device = argv[x];
+ }
+ x++;
+ }
+ if (!device)
+ device = ttyname(0);
+
+ memset(&req, 0, sizeof(req));
+ req.magic = INIT_MAGIC;
+ req.cmd = INIT_CMD_CHANGECONS;
+ if (!reset)
+ snprintf(req.i.bsd.reserved, 127, device);
+ else
+ req.i.bsd.reserved[0] = '\0';
+ signal(SIGALRM, signal_handler);
+ alarm(3);
+ if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0) {
+ write(fd, &req, sizeof(req)) == sizeof(req);
+ close(fd);
+ }
+ alarm(0);
+ if (foreground)
+ pause();
+ return 0;
+}
diff --git a/sys-apps/sysvinit/files/digest-sysvinit-2.86-r5 b/sys-apps/sysvinit/files/digest-sysvinit-2.86-r5
new file mode 100644
index 000000000000..36e59eb1e93b
--- /dev/null
+++ b/sys-apps/sysvinit/files/digest-sysvinit-2.86-r5
@@ -0,0 +1,2 @@
+MD5 7d5d61c026122ab791ac04c8a84db967 sysvinit-2.86.tar.gz 99009
+MD5 650af823f937d386e81520b1741d4d45 sysvinit-2.86-kexec.patch 4139
diff --git a/sys-apps/sysvinit/sysvinit-2.86-r5.ebuild b/sys-apps/sysvinit/sysvinit-2.86-r5.ebuild
new file mode 100644
index 000000000000..99bffc8cc6dd
--- /dev/null
+++ b/sys-apps/sysvinit/sysvinit-2.86-r5.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/sysvinit-2.86-r5.ebuild,v 1.1 2006/02/22 00:05:32 vapier Exp $
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="/sbin/init - parent of all processes"
+HOMEPAGE="http://freshmeat.net/projects/sysvinit/"
+SRC_URI="ftp://ftp.cistron.nl/pub/people/miquels/software/${P}.tar.gz
+ ftp://sunsite.unc.edu/pub/Linux/system/daemons/init/${P}.tar.gz
+ http://www.gc-linux.org/down/isobel/kexec/sysvinit/sysvinit-2.86-kexec.patch"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="selinux bootstrap build ibm static"
+
+RDEPEND="selinux? ( >=sys-libs/libselinux-1.28 )"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ cd "${S}"
+ cp "${FILESDIR}"/change_console.{c,8} src/ || die
+ epatch "${FILESDIR}"/${P}-docs.patch
+ epatch "${FILESDIR}"/${P}-shutdown-usage.patch
+ epatch "${FILESDIR}"/sysvinit-2.86-off-by-one.patch
+ epatch "${DISTDIR}"/sysvinit-2.86-kexec.patch
+ epatch "${FILESDIR}"/sysvinit-2.86-POSIX-1003.1e.patch #5818
+ epatch "${FILESDIR}"/sysvinit-2.86-execl.patch
+ epatch "${FILESDIR}"/sysvinit-2.86-utmp-64bit.patch
+ cd src
+ epatch "${FILESDIR}"/${PV}-gentoo.patch
+ use selinux && epatch "${FILESDIR}"/${PV}-selinux-1.patch
+
+ # Mung inittab for specific architectures
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/inittab . || die "cp inittab"
+ local insert=""
+ if use ibm ; then
+ insert="#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0"$'\n'
+ insert="${insert}#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0"
+ fi
+ use arm && insert='#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100'
+ use hppa && insert='b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100'
+ (use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab
+ [[ -n ${insert} ]] && echo "# Architecture specific features"$'\n'"${insert}" >> inittab
+}
+
+src_compile() {
+ use static && append-ldflags -static
+
+ # Note: The LCRYPT define below overrides the test in
+ # sysvinit's Makefile. This is because sulogin must be linked
+ # to libcrypt in any case, but when building stage2 in
+ # catalyst, /usr/lib/libcrypt.a isn't available. In truth
+ # this doesn't change how sulogin is built since ld would use
+ # the shared obj by default anyway! The other option is to
+ # refrain from building sulogin, but that isn't a good option.
+ # (09 Jul 2004 agriffis)
+ emake -C src \
+ CC="$(tc-getCC)" \
+ DISTRO="Gentoo" \
+ LCRYPT="-lcrypt" \
+ all change_console \
+ || die
+}
+
+src_install() {
+ dodoc README doc/*
+
+ cd src
+ make install DISTRO="Gentoo" ROOT="${D}" || die "make install"
+
+ into /
+ dosbin change_console || die
+ doman change_console.8
+
+ insinto /etc
+ doins "${WORKDIR}"/inittab || die "inittab"
+}
+
+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} == / ]] && ! use build && ! use bootstrap; then
+ # Do not return an error if this fails
+ /sbin/telinit U &>/dev/null
+ fi
+}