summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-11-20 12:37:37 +0000
committerMike Frysinger <vapier@gentoo.org>2005-11-20 12:37:37 +0000
commitab26148484e0b0161e8c4e0b1beb4e6ddd059d48 (patch)
treeecb85953a46d077ad3ee1e9d2fcc92d1f16675ed /sys-apps/sysvinit
parentold (diff)
downloadgentoo-2-ab26148484e0b0161e8c4e0b1beb4e6ddd059d48.tar.gz
gentoo-2-ab26148484e0b0161e8c4e0b1beb4e6ddd059d48.tar.bz2
gentoo-2-ab26148484e0b0161e8c4e0b1beb4e6ddd059d48.zip
Fix some warnings and add support for POSIX capabilites #5818 by Sascha Silbe.
(Portage version: 2.0.53_rc7)
Diffstat (limited to 'sys-apps/sysvinit')
-rw-r--r--sys-apps/sysvinit/ChangeLog10
-rw-r--r--sys-apps/sysvinit/files/digest-sysvinit-2.86-r32
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.86-POSIX-1003.1e.patch67
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.86-execl.patch11
-rw-r--r--sys-apps/sysvinit/files/sysvinit-2.86-utmp-64bit.patch43
-rw-r--r--sys-apps/sysvinit/sysvinit-2.86-r3.ebuild82
6 files changed, 214 insertions, 1 deletions
diff --git a/sys-apps/sysvinit/ChangeLog b/sys-apps/sysvinit/ChangeLog
index 38e0fb83d2cf..e79d4dc7c0b9 100644
--- a/sys-apps/sysvinit/ChangeLog
+++ b/sys-apps/sysvinit/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for sys-apps/sysvinit
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/ChangeLog,v 1.23 2005/10/28 02:14:27 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/ChangeLog,v 1.24 2005/11/20 12:37:37 vapier Exp $
+
+*sysvinit-2.86-r3 (20 Nov 2005)
+
+ 20 Nov 2005; Mike Frysinger <vapier@gentoo.org>
+ +files/sysvinit-2.86-POSIX-1003.1e.patch,
+ +files/sysvinit-2.86-execl.patch, +files/sysvinit-2.86-utmp-64bit.patch,
+ +sysvinit-2.86-r3.ebuild:
+ Fix some warnings and add support for POSIX capabilites #5818 by Sascha Silbe.
*sysvinit-2.86-r2 (28 Oct 2005)
diff --git a/sys-apps/sysvinit/files/digest-sysvinit-2.86-r3 b/sys-apps/sysvinit/files/digest-sysvinit-2.86-r3
new file mode 100644
index 000000000000..36e59eb1e93b
--- /dev/null
+++ b/sys-apps/sysvinit/files/digest-sysvinit-2.86-r3
@@ -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/files/sysvinit-2.86-POSIX-1003.1e.patch b/sys-apps/sysvinit/files/sysvinit-2.86-POSIX-1003.1e.patch
new file mode 100644
index 000000000000..01864ee59116
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.86-POSIX-1003.1e.patch
@@ -0,0 +1,67 @@
+add support for POSIX capabilites
+
+http://original.killa.net/infosec/caps/
+http://bugs.gentoo.org/5818
+
+--- sysvinit/src/init.c
++++ sysvinit/src/init.c
+@@ -21,6 +21,15 @@
+ */
+
+ #include <sys/types.h>
++
++#ifdef __linux__
++#include <linux/capability.h>
++#include <linux/unistd.h>
++
++_syscall2(int, capget, cap_user_header_t, header, cap_user_data_t, data)
++_syscall2(int, capset, cap_user_header_t, header, const cap_user_data_t, data)
++#endif
++
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/wait.h>
+@@ -2348,6 +2357,11 @@ int init_main()
+ pid_t rc;
+ int f, st;
+
++#ifdef __linux__
++ cap_user_header_t head;
++ cap_user_data_t data;
++#endif
++
+ if (!reload) {
+
+ #if INITDEBUG
+@@ -2438,6 +2452,31 @@ int init_main()
+ SETSIG(sa, SIGCHLD, chld_handler, SA_RESTART);
+ }
+
++#ifdef __linux__
++ /*
++ * This seems like the right place to do this, just before
++ * we read /etc/inittab...
++ */
++
++ head = malloc(sizeof(head));
++ if ((data = malloc(sizeof(data))) == NULL)
++ free(head);
++
++ if (head && data) {
++ head->pid = 0;
++ head->version = _LINUX_CAPABILITY_VERSION;
++
++ if (capget(head, data) == 0) {
++ /* Max out the inheritable capability set. */
++ data->inheritable = data->effective;
++ capset(head, data);
++ }
++
++ free(head);
++ free(data);
++ }
++#endif
++
+ /*
+ * Start normal boot procedure.
+ */
diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-execl.patch b/sys-apps/sysvinit/files/sysvinit-2.86-execl.patch
new file mode 100644
index 000000000000..051472519be0
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.86-execl.patch
@@ -0,0 +1,11 @@
+--- sysvinit/src/init.c
++++ sysvinit/src/init.c
+@@ -1893,7 +1893,7 @@ void re_exec(void)
+ * The existing init process execs a new init binary.
+ */
+ env = init_buildenv(0);
+- execl(myname, myname, "--init", NULL, env);
++ execle(myname, myname, "--init", NULL, env);
+
+ /*
+ * We shouldn't be here, something failed.
diff --git a/sys-apps/sysvinit/files/sysvinit-2.86-utmp-64bit.patch b/sys-apps/sysvinit/files/sysvinit-2.86-utmp-64bit.patch
new file mode 100644
index 000000000000..26d1161b7936
--- /dev/null
+++ b/sys-apps/sysvinit/files/sysvinit-2.86-utmp-64bit.patch
@@ -0,0 +1,43 @@
+On 64bit arches which have 32bit multilib support, the utmp struct is
+the same ... thus we cannot assume that utmp.ut_tv is of type time_t
+
+--- sysvinit/src/utmp.c
++++ sysvinit/src/utmp.c
+@@ -47,6 +47,7 @@ void write_wtmp
+ int fd;
+ struct utmp utmp;
+ struct utsname uname_buf;
++ struct timeval tv;
+
+ /*
+ * Try to open the wtmp file. Note that we even try
+@@ -76,7 +77,9 @@ void write_wtmp
+ */
+ memset(&utmp, 0, sizeof(utmp));
+ #if defined(__GLIBC__)
+- gettimeofday(&utmp.ut_tv, NULL);
++ gettimeofday(&tv, NULL);
++ utmp.ut_tv.tv_sec = tv.tv_sec;
++ utmp.ut_tv.tv_usec = tv.tv_usec;
+ #else
+ time(&utmp.ut_time);
+ #endif
+@@ -113,6 +116,7 @@ static void write_utmp
+ struct utmp utmp;
+ struct utmp tmp;
+ struct utmp *utmptr;
++ struct timeval tv;
+
+ /*
+ * Can't do much if UTMP_FILE is not present.
+@@ -144,7 +148,9 @@ static void write_utmp
+ utmp.ut_pid = pid;
+ strncpy(utmp.ut_id, id, sizeof(utmp.ut_id));
+ #if defined(__GLIBC__)
+- gettimeofday(&utmp.ut_tv, NULL);
++ gettimeofday(&tv, NULL);
++ utmp.ut_tv.tv_sec = tv.tv_sec;
++ utmp.ut_tv.tv_usec = tv.tv_usec;
+ #else
+ time(&utmp.ut_time);
+ #endif
diff --git a/sys-apps/sysvinit/sysvinit-2.86-r3.ebuild b/sys-apps/sysvinit/sysvinit-2.86-r3.ebuild
new file mode 100644
index 000000000000..d8256aaab58d
--- /dev/null
+++ b/sys-apps/sysvinit/sysvinit-2.86-r3.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/sysvinit/sysvinit-2.86-r3.ebuild,v 1.1 2005/11/20 12:37:37 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.18 sys-libs/libsepol )"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ cd "${S}"
+ 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.patch
+ cp "${FILESDIR}"/inittab "${WORKDIR}"/ || die "cp inittab"
+
+ if use ibm ; then
+ cat <<-EOF >> "${WORKDIR}"/inittab
+ #HVC / HVSI CONSOLE
+ #hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0
+ #hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0
+ EOF
+ fi
+}
+
+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" \
+ || die
+}
+
+src_install() {
+ dodoc README doc/*
+
+ cd src
+ make install DISTRO="Gentoo" ROOT="${D}" || die "make install"
+
+ 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/init U &>/dev/null
+ fi
+}