summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/sysvinit')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/start_getty45
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb58
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch50
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch28
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/install.patch97
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch191
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/realpath.patch59
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_3.14.bb (renamed from meta/recipes-core/sysvinit/sysvinit_2.99.bb)47
8 files changed, 56 insertions, 519 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
index dfa799adac..f5671ee53d 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -1,17 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2###############################################################################
3# This script is used to automatically set up the serial console(s) on startup.
4# The variable SERIAL_CONSOLES can be set in meta/conf/machine/*.conf.
5# Script enhancement has been done based on Bug YOCTO #10844.
6# Most of the information is retrieved from /proc virtual filesystem containing
7# all the runtime system information (eg. system memory, device mount, etc).
8###############################################################################
9 2
10# Get active serial filename. 3SPEED=$1
11active_serial=$(grep "serial" /proc/tty/drivers | cut -d/ -f1 | sed "s/ *$//") 4DEVICE=$2
12 5TERM=$3
13# Rephrase input parameter from ttyS target index (ttyS1, ttyS2, ttyAMA0, etc).
14runtime_tty=$(echo $2 | grep -oh '[0-9]\+')
15 6
16# busybox' getty does this itself, util-linux' agetty needs extra help 7# busybox' getty does this itself, util-linux' agetty needs extra help
17getty="/sbin/getty" 8getty="/sbin/getty"
@@ -22,34 +13,8 @@ case $(readlink -f "${getty}") in
22 if [ -x "/usr/bin/setsid" ] ; then 13 if [ -x "/usr/bin/setsid" ] ; then
23 setsid="/usr/bin/setsid" 14 setsid="/usr/bin/setsid"
24 fi 15 fi
16 options=""
25 ;; 17 ;;
26esac 18esac
27 19
28# Backup $IFS. 20${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM
29DEFAULT_IFS=$IFS
30# Customize Internal Field Separator.
31IFS="$(printf '\n\t')"
32
33for line in $active_serial; do
34 # Check we have the file containing current active serial target index.
35 if [ -e "/proc/tty/driver/$line" ]
36 then
37 # Remove all unknown entries and discard the first line (desc).
38 activetty=$(grep -v "unknown" "/proc/tty/driver/$line" \
39 | tail -n +2 | grep -oh "^\s*\S*[0-9]\+")
40 for active in $activetty; do
41 # If indexes do match then enable the serial console.
42 if [ $active -eq $runtime_tty ]
43 then
44 if [ -c /dev/$2 ]
45 then
46 ${setsid:-} ${getty} -L $1 $2 $3
47 fi
48 break
49 fi
50 done
51 fi
52done
53
54# Restore $IFS.
55IFS=$DEFAULT_IFS
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index d95d1a63f5..c77266e71e 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -1,13 +1,11 @@
1SUMMARY = "Inittab configuration for SysVinit" 1SUMMARY = "Inittab configuration for SysVinit"
2LICENSE = "GPLv2" 2LICENSE = "GPL-2.0-only"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" 3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
4 4
5PR = "r10"
6
7SRC_URI = "file://inittab \ 5SRC_URI = "file://inittab \
8 file://start_getty" 6 file://start_getty"
9 7
10S = "${WORKDIR}" 8S = "${UNPACKDIR}"
11 9
12INHIBIT_DEFAULT_DEPS = "1" 10INHIBIT_DEFAULT_DEPS = "1"
13 11
@@ -17,19 +15,19 @@ do_compile() {
17 15
18do_install() { 16do_install() {
19 install -d ${D}${sysconfdir} 17 install -d ${D}${sysconfdir}
20 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab 18 install -m 0644 ${S}/inittab ${D}${sysconfdir}/inittab
21 install -d ${D}${base_bindir} 19 install -d ${D}${base_bindir}
22 install -m 0755 ${WORKDIR}/start_getty ${D}${base_bindir}/start_getty 20 install -m 0755 ${S}/start_getty ${D}${base_bindir}/start_getty
23 sed -e 's,/usr/bin,${bindir},g' -i ${D}${base_bindir}/start_getty 21 sed -e 's,/usr/bin,${bindir},g' -i ${D}${base_bindir}/start_getty
24 22
25 set -x 23 CONSOLES="${SERIAL_CONSOLES}"
26 tmp="${SERIAL_CONSOLES}" 24 for s in $CONSOLES
27 for i in $tmp
28 do 25 do
29 j=`echo ${i} | sed s/\;/\ /g` 26 speed=$(echo $s | cut -d\; -f 1)
30 l=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'` 27 device=$(echo $s | cut -d\; -f 2)
31 label=`echo $l | sed 's/.*\(....\)/\1/'` 28 label=$(echo $device | sed -e 's/tty//' | tail --bytes=5)
32 echo "$label:12345:respawn:${base_bindir}/start_getty ${j} vt102" >> ${D}${sysconfdir}/inittab 29
30 echo "$label:12345:respawn:${sbindir}/ttyrun $device ${base_bindir}/start_getty $speed $device vt102" >> ${D}${sysconfdir}/inittab
33 done 31 done
34 32
35 if [ "${USE_VT}" = "1" ]; then 33 if [ "${USE_VT}" = "1" ]; then
@@ -53,41 +51,15 @@ EOF
53 fi 51 fi
54} 52}
55 53
56pkg_postinst_${PN} () {
57# run this on host and on target
58if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
59 exit 0
60fi
61}
62
63pkg_postinst_ontarget_${PN} () {
64# run this on the target
65if [ -e /proc/consoles ]; then
66 tmp="${SERIAL_CONSOLES_CHECK}"
67 for i in $tmp
68 do
69 j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
70 k=`echo ${i} | sed s/^.*\://g`
71 if [ -z "`grep ${j} /proc/consoles`" ]; then
72 if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
73 sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
74 fi
75 fi
76 done
77 kill -HUP 1
78else
79 exit 1
80fi
81}
82
83# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf. 54# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
84# Set PACKAGE_ARCH appropriately. 55# Set PACKAGE_ARCH appropriately.
85PACKAGE_ARCH = "${MACHINE_ARCH}" 56PACKAGE_ARCH = "${MACHINE_ARCH}"
86 57
87FILES_${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty" 58FILES:${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty"
88CONFFILES_${PN} = "${sysconfdir}/inittab" 59CONFFILES:${PN} = "${sysconfdir}/inittab"
89 60
90USE_VT ?= "1" 61USE_VT ?= "1"
91SYSVINIT_ENABLED_GETTYS ?= "1" 62SYSVINIT_ENABLED_GETTYS ?= "1"
92 63
93RCONFLICTS_${PN} = "busybox-inittab" 64RDEPENDS:${PN} = "ttyrun"
65RCONFLICTS:${PN} = "busybox-inittab"
diff --git a/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch b/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch
deleted file mode 100644
index 60fbd87534..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From c710a3accd1fabdb671274e1a458405282d51e0c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 6 Aug 2018 15:38:58 -0700
4Subject: [PATCH] include sys/sysmacros.h for major/minor definitions
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8
9---
10 src/bootlogd.c | 1 +
11 src/mountpoint.c | 1 +
12 src/shutdown.c | 1 +
13 3 files changed, 3 insertions(+)
14
15diff --git a/src/bootlogd.c b/src/bootlogd.c
16index 787db87..8b07903 100644
17--- a/src/bootlogd.c
18+++ b/src/bootlogd.c
19@@ -29,6 +29,7 @@
20 #include <sys/types.h>
21 #include <sys/time.h>
22 #include <sys/stat.h>
23+#include <sys/sysmacros.h>
24 #include <sys/ioctl.h>
25 #include <sys/utsname.h>
26 #include <time.h>
27diff --git a/src/mountpoint.c b/src/mountpoint.c
28index 5f20522..94df7a1 100644
29--- a/src/mountpoint.c
30+++ b/src/mountpoint.c
31@@ -25,6 +25,7 @@
32
33 #include <sys/types.h>
34 #include <sys/stat.h>
35+#include <sys/sysmacros.h>
36 #include <unistd.h>
37 #include <stdlib.h>
38 #include <string.h>
39diff --git a/src/shutdown.c b/src/shutdown.c
40index b744a2c..40b7faf 100644
41--- a/src/shutdown.c
42+++ b/src/shutdown.c
43@@ -40,6 +40,7 @@
44 #endif
45 #include <sys/types.h>
46 #include <sys/stat.h>
47+#include <sys/sysmacros.h>
48 #include <sys/wait.h>
49 #ifdef __linux__
50 #include <sys/sysmacros.h> /* brought in my LFS patch */
diff --git a/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch
index 5c39fb001b..1ac54fb667 100644
--- a/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch
+++ b/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch
@@ -1,33 +1,33 @@
1From c3a068cf24a22bea7349849ec111ae8d91a54db4 Mon Sep 17 00:00:00 2001 1From f040b04c50d13755b2063c4db0e0be0647cf5d14 Mon Sep 17 00:00:00 2001
2From: Jeff Dike <jdike@x86_64.user-mode-linux.org> 2From: Jeff Dike <jdike@x86_64.user-mode-linux.org>
3Date: Wed, 14 Jul 2010 14:35:52 -0400 3Date: Wed, 14 Jul 2010 14:35:52 -0400
4Subject: [PATCH] sysvinit - Remove sulogin dependency on /usr/lib*/libcrypt.a 4Subject: [PATCH] sysvinit - Remove sulogin dependency on /usr/lib*/libcrypt.a
5 5
6Upstream-Status: Inappropriate [configuration] 6The src Makefile was checking for libcrypt.a on the host, not in the
7 7build environment. This patch checks for $LCRYPT in the environment
8# The src Makefile was checking for libcrypt.a on the host, not in the 8and uses it if it's there.
9# build environment. This patch checks for $LCRYPT in the environment 9jdike@linux.intel.com
10# and uses it if it's there.
11# - jdike@linux.intel.com
12 10
11Upstream-Status: Inappropriate [configuration]
13--- 12---
14 src/Makefile | 11 ++--------- 13 src/Makefile | 12 ++----------
15 1 file changed, 2 insertions(+), 9 deletions(-) 14 1 file changed, 2 insertions(+), 10 deletions(-)
16 15
17diff --git a/src/Makefile b/src/Makefile 16diff --git a/src/Makefile b/src/Makefile
18index 5b1a5a2..b686394 100644 17index 6d9f01c..b12a233 100644
19--- a/src/Makefile 18--- a/src/Makefile
20+++ b/src/Makefile 19+++ b/src/Makefile
21@@ -97,15 +97,8 @@ else 20@@ -97,16 +97,8 @@ else
21 SULOGINLIBS =
22 endif 22 endif
23 23
24 # Additional libs for GNU libc. 24-# Additional libs for GNU libc.
25-ifneq ($(wildcard $(ROOT)/usr/lib*/libcrypt.*),) 25-ifneq ($(wildcard $(ROOT)/$(usrdir)/lib*/libcrypt.*),)
26- SULOGINLIBS += -lcrypt 26- SULOGINLIBS += -lcrypt
27-endif 27-endif
28- 28-
29-# Additional libs for GNU libc / multiarch on Debian based systems. 29-# Additional libs for GNU libc / multiarch on Debian based systems.
30-ifneq ($(wildcard $(ROOT)/usr/lib/*/libcrypt.*),) 30-ifneq ($(wildcard $(ROOT)/$(usrdir)/lib/*/libcrypt.*),)
31-ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt) 31-ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt)
32- SULOGINLIBS += -lcrypt 32- SULOGINLIBS += -lcrypt
33-endif 33-endif
diff --git a/meta/recipes-core/sysvinit/sysvinit/install.patch b/meta/recipes-core/sysvinit/sysvinit/install.patch
deleted file mode 100644
index 90563a6294..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit/install.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From 5e35aa105e7a2e85db2a89fee4114090b1ac55be Mon Sep 17 00:00:00 2001
2From: Qing He <qing.he@intel.com>
3Date: Fri, 18 Jun 2010 09:40:30 +0800
4Subject: [PATCH] sysvinit: upgrade to version 2.88dsf
5
6Upstream-Status: Pending
7
8---
9 src/Makefile | 53 +++++++++++++++++++++++++++++-----------------------
10 1 file changed, 30 insertions(+), 23 deletions(-)
11
12diff --git a/src/Makefile b/src/Makefile
13index 1b368dc..5b1a5a2 100644
14--- a/src/Makefile
15+++ b/src/Makefile
16@@ -77,7 +77,14 @@ else
17 INSTALL_DATA = install -m 644
18 endif
19 INSTALL_DIR = install -m 755 -d
20-MANDIR = /usr/share/man
21+
22+ROOT ?=
23+base_bindir ?= /bin
24+base_sbindir ?= /sbin
25+bindir ?= /usr/bin
26+sysconfdir ?= /etc
27+includedir ?= /usr/include
28+mandir ?= /usr/share/man
29
30 ifeq ($(WITH_SELINUX),yes)
31 SELINUX_DEF = -DWITH_SELINUX
32@@ -191,43 +198,43 @@ clobber: cleanobjs
33 distclean: clobber
34
35 install: all
36- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
37- $(INSTALL_DIR) $(ROOT)/usr/bin/
38+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
39+ $(INSTALL_DIR) $(ROOT)$(bindir)/
40 for i in $(BIN); do \
41- $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
42+ $(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
43 done
44 for i in $(SBIN); do \
45- $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
46+ $(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
47 done
48 for i in $(USRBIN); do \
49- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
50+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
51 done
52 # $(INSTALL_DIR) $(ROOT)/etc/
53 $(INSTALL_DIR) $(ROOT)/etc/inittab.d
54 # $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/
55- ln -sf halt $(ROOT)/sbin/reboot
56- ln -sf halt $(ROOT)/sbin/poweroff
57- ln -sf init $(ROOT)/sbin/telinit
58- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
59- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
60- ln -sf last $(ROOT)/usr/bin/lastb; \
61+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
62+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
63+ ln -sf init $(ROOT)$(base_sbindir)/telinit
64+ ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
65+ if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
66+ ln -sf last $(ROOT)$(bindir)/lastb; \
67 fi
68- $(INSTALL_DIR) $(ROOT)/usr/include/
69- $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
70- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
71- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
72- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
73+ $(INSTALL_DIR) $(ROOT)$(includedir)/
74+ $(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
75+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
76+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
77+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
78 for man in $(MAN1); do \
79- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
80- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
81+ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man1/; \
82+ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man1/$$man ; \
83 done
84 for man in $(MAN5); do \
85- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
86- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
87+ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man5/; \
88+ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man5/$$man ; \
89 done
90 for man in $(MAN8); do \
91- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
92- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
93+ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man8/; \
94+ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man8/$$man ; \
95 done
96 ifeq ($(ROOT),)
97 #
diff --git a/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch
deleted file mode 100644
index 494aa0e012..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch
+++ /dev/null
@@ -1,191 +0,0 @@
1From 6c490ea6579a132fabb7dbd25387bb521f820371 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Wed, 24 Jul 2013 17:07:22 +0800
4Subject: [PATCH] pidof: add -m option
5
6When used with -o, will also omit any processes that have the same
7argv[0] and argv[1] as any explicitly omitted process ids. This can be
8used to avoid multiple shell scripts concurrently calling pidof returning
9each other's pids.
10
11https://bugzilla.redhat.com/show_bug.cgi?id=883856
12
13Upstream-Status: backport
14Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166
15
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17
18---
19 man/pidof.8 | 6 +++++
20 src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++---
21 2 files changed, 65 insertions(+), 3 deletions(-)
22
23diff --git a/man/pidof.8 b/man/pidof.8
24index ebe5f55..2fdc4d3 100644
25--- a/man/pidof.8
26+++ b/man/pidof.8
27@@ -25,6 +25,7 @@ pidof -- find the process ID of a running program.
28 .RB [ \-n ]
29 .RB [ \-x ]
30 .RB [ \-z ]
31+.RB [ \-m ]
32 .RB [ \-o
33 .IR omitpid[,omitpid...] ]
34 .RB [ \-o
35@@ -76,6 +77,11 @@ is shown. The default separator is a space.
36 Tells \fIpidof\fP to omit processes with that process id. The special
37 pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
38 program, in other words the calling shell or shell script.
39+.IP -m
40+When used with -o, will also omit any processes that have the same
41+argv[0] and argv[1] as any explicitly omitted process ids. This can be
42+used to avoid multiple shell scripts concurrently calling pidof returning
43+each other's pids.
44 .SH "EXIT STATUS"
45 .TP
46 .B 0
47diff --git a/src/killall5.c b/src/killall5.c
48index 8b5cb38..a664954 100644
49--- a/src/killall5.c
50+++ b/src/killall5.c
51@@ -126,6 +126,7 @@ typedef struct _s_nfs
52
53 /* List of processes. */
54 PROC *plist;
55+PROC *olist;
56
57 /* List of processes to omit. */
58 OMIT *omit;
59@@ -361,6 +362,20 @@ static void clear_mnt(void)
60 }
61 }
62
63+static void clear_omit(void)
64+{
65+ OMIT *o;
66+ PROC *p;
67+ for (o = omit; o; o = omit) {
68+ omit = omit->next;
69+ free(o);
70+ }
71+ for (p = olist; p; p = olist) {
72+ olist = olist->next;
73+ free(p);
74+ }
75+}
76+
77 /*
78 * Check if path is a shadow off a NFS partition.
79 */
80@@ -486,6 +501,7 @@ int readproc(int do_stat)
81 DIR *dir;
82 FILE *fp;
83 PROC *p, *n;
84+ OMIT *o, *m;
85 struct dirent *d;
86 struct stat st;
87 char path[PATH_MAX+1];
88@@ -733,6 +749,17 @@ int readproc(int do_stat)
89 p->next = plist;
90 plist = p;
91 p->pid = pid;
92+ /* Could be smarter, but it's a small list. */
93+ m = omit;
94+ for (o = omit; m; o = m) {
95+ m = o->next;
96+ if (o->pid == p->pid) {
97+ n = (PROC*)xmalloc(sizeof(PROC));
98+ *n = *p;
99+ n->next = olist;
100+ olist = n;
101+ }
102+ }
103 }
104 closedir(dir);
105
106@@ -944,6 +971,26 @@ PIDQ_HEAD *pidof(char *prog)
107 return q;
108 }
109
110+int matches(PROC *o, PROC *p)
111+{
112+ int ret = 0;
113+ char *oargv1, *pargv1;
114+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
115+ if (o->argv1 && p->argv1) {
116+ if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
117+ oargv1 = strdup(o->argv1);
118+ if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
119+ pargv1 = strdup(p->argv1);
120+ if (! strcmp(oargv1, pargv1)) {
121+ ret = 1;
122+ }
123+ free(oargv1);
124+ free(pargv1);
125+ }
126+ }
127+ return ret;
128+}
129+
130 /* Give usage message and exit. */
131 void usage(void)
132 {
133@@ -994,6 +1041,7 @@ void nsyslog(int pri, char *fmt, ...)
134 #define PIDOF_OMIT 0x02
135 #define PIDOF_NETFS 0x04
136 #define PIDOF_QUIET 0x08
137+#define PIDOF_OMIT_OMIT_MATCHES 0x08
138
139 /*
140 * Pidof functionality.
141@@ -1011,6 +1059,7 @@ int main_pidof(int argc, char **argv)
142 char tmp[512];
143 char sep = ' ';
144
145+ olist = (PROC*)0;
146 omit = (OMIT*)0;
147 nlist = (NFS*)0;
148 opterr = 0;
149@@ -1018,7 +1067,7 @@ int main_pidof(int argc, char **argv)
150 if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
151 flags |= PIDOF_NETFS;
152
153- while ((opt = getopt(argc,argv,"qhco:d:sxzn")) != EOF) switch (opt) {
154+ while ((opt = getopt(argc,argv,"qhcmo:d:sxzn")) != EOF) switch (opt) {
155 case '?':
156 nsyslog(LOG_ERR,"invalid options on command line!\n");
157 closelog();
158@@ -1069,6 +1118,9 @@ int main_pidof(int argc, char **argv)
159 case 'z':
160 list_dz_processes = TRUE;
161 break;
162+ case 'm':
163+ flags |= PIDOF_OMIT_OMIT_MATCHES;
164+ break;
165 case 'n':
166 flags |= PIDOF_NETFS;
167 break;
168@@ -1100,10 +1152,13 @@ int main_pidof(int argc, char **argv)
169 pid_t spid = 0;
170 while ((p = get_next_from_pid_q(q))) {
171 if ((flags & PIDOF_OMIT) && omit) {
172- OMIT * optr;
173- for (optr = omit; optr; optr = optr->next) {
174+ PROC * optr;
175+ for (optr = olist; optr; optr = optr->next) {
176 if (optr->pid == p->pid)
177 break;
178+ if (flags & PIDOF_OMIT_OMIT_MATCHES)
179+ if (matches(optr, p))
180+ break;
181 }
182
183 /*
184@@ -1145,6 +1200,7 @@ int main_pidof(int argc, char **argv)
185 printf("\n");
186 }
187
188+ clear_omit();
189 clear_mnt();
190
191 closelog();
diff --git a/meta/recipes-core/sysvinit/sysvinit/realpath.patch b/meta/recipes-core/sysvinit/sysvinit/realpath.patch
deleted file mode 100644
index 859fd8baad..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit/realpath.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From eb158c97f19d473d01befe96359a7f93ae834517 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 Nov 2015 00:10:03 +0000
4Subject: [PATCH] Fix build on musl use realpath() API its available on all
5 libcs
6
7realpath() API doesnt work on systems with PATH_MAX set to be unlimited e.g. GNU/Hurd
8However for Linux it should always work
9
10Upstream-Status: Inappropriate[Linux specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13
14---
15 src/killall5.c | 4 ++--
16 src/mountpoint.c | 1 +
17 src/wall.c | 1 +
18 3 files changed, 4 insertions(+), 2 deletions(-)
19
20diff --git a/src/killall5.c b/src/killall5.c
21index a664954..9798423 100644
22--- a/src/killall5.c
23+++ b/src/killall5.c
24@@ -977,9 +977,9 @@ int matches(PROC *o, PROC *p)
25 char *oargv1, *pargv1;
26 if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
27 if (o->argv1 && p->argv1) {
28- if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
29+ if ((oargv1 = realpath(o->argv1, NULL)) == NULL)
30 oargv1 = strdup(o->argv1);
31- if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
32+ if ((pargv1 = realpath(p->argv1, NULL)) == NULL)
33 pargv1 = strdup(p->argv1);
34 if (! strcmp(oargv1, pargv1)) {
35 ret = 1;
36diff --git a/src/mountpoint.c b/src/mountpoint.c
37index b24335e..5f20522 100644
38--- a/src/mountpoint.c
39+++ b/src/mountpoint.c
40@@ -23,6 +23,7 @@
41 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
42 */
43
44+#include <sys/types.h>
45 #include <sys/stat.h>
46 #include <unistd.h>
47 #include <stdlib.h>
48diff --git a/src/wall.c b/src/wall.c
49index d3a2c70..00826e9 100644
50--- a/src/wall.c
51+++ b/src/wall.c
52@@ -30,6 +30,7 @@
53 #include <pwd.h>
54 #include <syslog.h>
55 #include <sys/types.h>
56+#include <time.h>
57 #include "init.h"
58
59
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.99.bb b/meta/recipes-core/sysvinit/sysvinit_3.14.bb
index e39f22a8bb..d4bb797624 100644
--- a/meta/recipes-core/sysvinit/sysvinit_2.99.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_3.14.bb
@@ -2,38 +2,35 @@ SUMMARY = "System-V like init"
2DESCRIPTION = "This package is required to boot in most configurations. It provides the /sbin/init program. This is the first process started on boot, and the last process terminated before the system halts." 2DESCRIPTION = "This package is required to boot in most configurations. It provides the /sbin/init program. This is the first process started on boot, and the last process terminated before the system halts."
3HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/" 3HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/"
4SECTION = "base" 4SECTION = "base"
5LICENSE = "GPLv2+" 5LICENSE = "GPL-2.0-or-later"
6LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ 6LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
7 file://COPYRIGHT;endline=15;md5=a1d3b3526501d3546d530bbe6ab6cdbe \ 7 file://COPYRIGHT;endline=15;md5=a1d3b3526501d3546d530bbe6ab6cdbe \
8 " 8 "
9 9
10RDEPENDS_${PN} = "${PN}-inittab" 10RDEPENDS:${PN} = "${PN}-inittab"
11 11
12SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.xz \ 12GITHUB_BASE_URI = "https://github.com/slicer69/${BPN}/releases/"
13 file://install.patch \ 13SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.xz \
14 file://crypt-lib.patch \ 14 file://crypt-lib.patch \
15 file://pidof-add-m-option.patch \
16 file://realpath.patch \
17 file://0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch \
18 file://rcS-default \ 15 file://rcS-default \
19 file://rc \ 16 file://rc \
20 file://rcS \ 17 file://rcS \
21 file://bootlogd.init \ 18 file://bootlogd.init \
22 file://01_bootlogd \ 19 file://01_bootlogd \
23 " 20 "
24SRC_URI[sha256sum] = "b05c3677bb698afe64c997968b00c49b2a9bd320ce963523230ee7ea41197757" 21SRC_URI[sha256sum] = "c90874b8c054a35991fb8c4d30c443ed1e9b1815ff6165c7b483f558be4e4b53"
25 22
26S = "${WORKDIR}/sysvinit-${PV}" 23S = "${UNPACKDIR}/sysvinit-${PV}"
27 24
28inherit update-alternatives features_check 25inherit update-alternatives features_check github-releases
29DEPENDS_append = " update-rc.d-native base-passwd virtual/crypt" 26DEPENDS:append = " update-rc.d-native base-passwd virtual/crypt"
30do_package_setscene[depends] = "${MLPREFIX}base-passwd:do_populate_sysroot" 27do_package_setscene[depends] = "${MLPREFIX}base-passwd:do_populate_sysroot"
31 28
32PACKAGECONFIG[psplash-text-updates] = ",," 29PACKAGECONFIG[psplash-text-updates] = ",,"
33 30
34REQUIRED_DISTRO_FEATURES = "sysvinit" 31REQUIRED_DISTRO_FEATURES = "sysvinit"
35 32
36ALTERNATIVE_${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last lastb mesg utmpdump wall" 33ALTERNATIVE:${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last lastb mesg utmpdump wall"
37 34
38ALTERNATIVE_PRIORITY = "200" 35ALTERNATIVE_PRIORITY = "200"
39 36
@@ -49,13 +46,13 @@ ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
49ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" 46ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
50ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" 47ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
51 48
52ALTERNATIVE_${PN}-pidof = "pidof" 49ALTERNATIVE:${PN}-pidof = "pidof"
53ALTERNATIVE_LINK_NAME[pidof] = "${base_bindir}/pidof" 50ALTERNATIVE_LINK_NAME[pidof] = "${base_bindir}/pidof"
54 51
55ALTERNATIVE_${PN}-sulogin = "sulogin" 52ALTERNATIVE:${PN}-sulogin = "sulogin"
56ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin" 53ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
57 54
58ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 sulogin.8 utmpdump.1" 55ALTERNATIVE:${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 sulogin.8 utmpdump.1"
59 56
60ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1" 57ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
61ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1" 58ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
@@ -66,13 +63,13 @@ ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
66ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1" 63ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
67 64
68PACKAGES =+ "sysvinit-pidof sysvinit-sulogin" 65PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
69FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*" 66FILES:${PN} += "${base_sbindir}/* ${base_bindir}/*"
70FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5" 67FILES:sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5"
71FILES_sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit" 68FILES:sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit"
72 69
73RDEPENDS_${PN} += "sysvinit-pidof initd-functions base-passwd" 70RDEPENDS:${PN} += "sysvinit-pidof initd-functions base-passwd"
74 71
75CFLAGS_prepend = "-D_GNU_SOURCE " 72CFLAGS:prepend = "-D_GNU_SOURCE "
76export LCRYPT = "-lcrypt" 73export LCRYPT = "-lcrypt"
77EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \ 74EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
78 'base_sbindir=${base_sbindir}' \ 75 'base_sbindir=${base_sbindir}' \
@@ -95,18 +92,18 @@ do_install () {
95 92
96 sed -e \ 93 sed -e \
97 's:#PSPLASH_TEXT#:${@bb.utils.contains("PACKAGECONFIG","psplash-text-updates","yes","no", d)}:g' \ 94 's:#PSPLASH_TEXT#:${@bb.utils.contains("PACKAGECONFIG","psplash-text-updates","yes","no", d)}:g' \
98 ${WORKDIR}/rcS-default > ${D}${sysconfdir}/default/rcS 95 ${UNPACKDIR}/rcS-default > ${D}${sysconfdir}/default/rcS
99 chmod 0644 ${D}${sysconfdir}/default/rcS 96 chmod 0644 ${D}${sysconfdir}/default/rcS
100 install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d 97 install -m 0755 ${UNPACKDIR}/rc ${D}${sysconfdir}/init.d
101 install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d 98 install -m 0755 ${UNPACKDIR}/rcS ${D}${sysconfdir}/init.d
102 install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd 99 install -m 0755 ${UNPACKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd
103 ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd 100 ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd
104 101
105 update-rc.d -r ${D} bootlogd start 07 S . 102 update-rc.d -r ${D} bootlogd start 07 S .
106 update-rc.d -r ${D} stop-bootlogd start 99 2 3 4 5 . 103 update-rc.d -r ${D} stop-bootlogd start 99 2 3 4 5 .
107 104
108 install -d ${D}${sysconfdir}/default/volatiles 105 install -d ${D}${sysconfdir}/default/volatiles
109 install -m 0644 ${WORKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles 106 install -m 0644 ${UNPACKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles
110 107
111 chown root:shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown 108 chown root:shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
112 chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown 109 chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown