summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-09 22:59:03 +0200
commit972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch)
tree97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-core/sysvinit
downloadpoky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/sysvinit')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch25
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch83
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch189
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/inittab30
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb82
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/01_bootlogd1
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/bootlogd.init98
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc182
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rcS34
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/rcS-default29
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb102
11 files changed, 855 insertions, 0 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
new file mode 100644
index 0000000000..7b342901e1
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
@@ -0,0 +1,25 @@
1Upstream-Status: Inappropriate [configuration]
2
3# The src Makefile was checking for libcrypt.a on the host, not in the
4# build environment. This patch checks for $LCRYPT in the environment
5# and uses it if it's there.
6# - jdike@linux.intel.com
7
8Index: sysvinit-2.88dsf/src/Makefile
9===================================================================
10--- sysvinit-2.88dsf.orig/src/Makefile
11+++ sysvinit-2.88dsf/src/Makefile
12@@ -85,9 +85,13 @@ else
13 endif
14
15 # Additional libs for GNU libc.
16+ifneq ($(LCRYPT),)
17+ SULOGINLIBS += $(LCRYPT)
18+else
19 ifneq ($(wildcard /usr/lib*/libcrypt.a),)
20 SULOGINLIBS += -lcrypt
21 endif
22+endif
23
24 all: $(BIN) $(SBIN) $(USRBIN)
25
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
new file mode 100644
index 0000000000..6c4225a678
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
@@ -0,0 +1,83 @@
1Upstream-Status: Pending
2
3diff --git a/src/Makefile b/src/Makefile
4index e2b8028..3e11e92 100644
5--- a/src/Makefile
6+++ b/src/Makefile
7@@ -65,7 +65,14 @@ else
8 INSTALL_DATA = install -m 644
9 endif
10 INSTALL_DIR = install -m 755 -d
11-MANDIR = /usr/share/man
12+
13+ROOT ?=
14+base_bindir ?= /bin
15+base_sbindir ?= /sbin
16+bindir ?= /usr/bin
17+sysconfdir ?= /etc
18+includedir ?= /usr/include
19+mandir ?= /usr/share/man
20
21 ifeq ($(WITH_SELINUX),yes)
22 SELINUX_DEF = -DWITH_SELINUX
23@@ -138,39 +145,39 @@ clobber: cleanobjs
24 distclean: clobber
25
26 install:
27- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
28- $(INSTALL_DIR) $(ROOT)/usr/bin/
29+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
30+ $(INSTALL_DIR) $(ROOT)$(bindir)/
31 for i in $(BIN); do \
32- $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
33+ $(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
34 done
35 for i in $(SBIN); do \
36- $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
37+ $(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
38 done
39 for i in $(USRBIN); do \
40- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
41+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
42 done
43- # $(INSTALL_DIR) $(ROOT)/etc/
44- # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
45- ln -sf halt $(ROOT)/sbin/reboot
46- ln -sf halt $(ROOT)/sbin/poweroff
47- ln -sf init $(ROOT)/sbin/telinit
48- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
49- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
50- ln -sf last $(ROOT)/usr/bin/lastb; \
51+ # $(INSTALL_DIR) $(ROOT)$(sysconfdir)/
52+ # $(INSTALL_EXEC) initscript.sample $(ROOT)$(sysconfdir)/
53+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
54+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
55+ ln -sf init $(ROOT)$(base_sbindir)/telinit
56+ ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
57+ if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
58+ ln -sf last $(ROOT)$(bindir)/lastb; \
59 fi
60- $(INSTALL_DIR) $(ROOT)/usr/include/
61- $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
62- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
63- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
64- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
65+ $(INSTALL_DIR) $(ROOT)$(includedir)/
66+ $(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
67+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
68+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
69+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
70 for i in $(MAN1); do \
71- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
72+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man1/; \
73 done
74 for i in $(MAN5); do \
75- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
76+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man5/; \
77 done
78 for i in $(MAN8); do \
79- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
80+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man8/; \
81 done
82 ifeq ($(ROOT),)
83 #
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
new file mode 100644
index 0000000000..5b5dfdc001
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
@@ -0,0 +1,189 @@
1pidof: add -m option
2
3When used with -o, will also omit any processes that have the same
4argv[0] and argv[1] as any explicitly omitted process ids. This can be
5used to avoid multiple shell scripts concurrently calling pidof returning
6each other's pids.
7
8https://bugzilla.redhat.com/show_bug.cgi?id=883856
9
10Upstream-Status: backport
11Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166
12
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 man/pidof.8 | 6 ++++++
16 src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
17 2 files changed, 65 insertions(+), 3 deletions(-)
18
19diff --git a/man/pidof.8 b/man/pidof.8
20--- a/man/pidof.8
21+++ b/man/pidof.8
22@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
23 .RB [ \-c ]
24 .RB [ \-n ]
25 .RB [ \-x ]
26+.RB [ \-m ]
27 .RB [ \-o
28 .IR omitpid[,omitpid..] ]
29 .RB [ \-o
30@@ -63,6 +64,11 @@ shells running the named scripts.
31 Tells \fIpidof\fP to omit processes with that process id. The special
32 pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
33 program, in other words the calling shell or shell script.
34+.IP -m
35+When used with -o, will also omit any processes that have the same
36+argv[0] and argv[1] as any explicitly omitted process ids. This can be
37+used to avoid multiple shell scripts concurrently calling pidof returning
38+each other's pids.
39 .SH "EXIT STATUS"
40 .TP
41 .B 0
42diff --git a/src/killall5.c b/src/killall5.c
43index 5937d98..e73885e 100644
44--- a/src/killall5.c
45+++ b/src/killall5.c
46@@ -118,6 +118,7 @@ typedef struct _s_nfs
47
48 /* List of processes. */
49 PROC *plist;
50+PROC *olist;
51
52 /* List of processes to omit. */
53 OMIT *omit;
54@@ -345,6 +346,20 @@ static void clear_mnt(void)
55 }
56 }
57
58+static void clear_omit(void)
59+{
60+ OMIT *o;
61+ PROC *p;
62+ for (o = omit; o; o = omit) {
63+ omit = omit->next;
64+ free(o);
65+ }
66+ for (p = olist; p; p = olist) {
67+ olist = olist->next;
68+ free(p);
69+ }
70+}
71+
72 /*
73 * Check if path is ia shadow off a NFS partition.
74 */
75@@ -452,6 +467,7 @@ int readproc(int do_stat)
76 DIR *dir;
77 FILE *fp;
78 PROC *p, *n;
79+ OMIT *o, *m;
80 struct dirent *d;
81 struct stat st;
82 char path[PATH_MAX+1];
83@@ -624,6 +640,17 @@ int readproc(int do_stat)
84 p->next = plist;
85 plist = p;
86 p->pid = pid;
87+ /* Could be smarter, but it's a small list. */
88+ m = omit;
89+ for (o = omit; m; o = m) {
90+ m = o->next;
91+ if (o->pid == p->pid) {
92+ n = (PROC*)xmalloc(sizeof(PROC));
93+ *n = *p;
94+ n->next = olist;
95+ olist = n;
96+ }
97+ }
98 }
99 closedir(dir);
100
101@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
102 return q;
103 }
104
105+int matches(PROC *o, PROC *p)
106+{
107+ int ret = 0;
108+ char *oargv1, *pargv1;
109+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
110+ if (o->argv1 && p->argv1) {
111+ if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
112+ oargv1 = strdup(o->argv1);
113+ if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
114+ pargv1 = strdup(p->argv1);
115+ if (! strcmp(oargv1, pargv1)) {
116+ ret = 1;
117+ }
118+ free(oargv1);
119+ free(pargv1);
120+ }
121+ }
122+ return ret;
123+}
124+
125 /* Give usage message and exit. */
126 void usage(void)
127 {
128@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
129 #define PIDOF_SINGLE 0x01
130 #define PIDOF_OMIT 0x02
131 #define PIDOF_NETFS 0x04
132+#define PIDOF_OMIT_OMIT_MATCHES 0x08
133
134 /*
135 * Pidof functionality.
136@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
137 struct stat st;
138 char tmp[512];
139
140+ olist = (PROC*)0;
141 omit = (OMIT*)0;
142 nlist = (NFS*)0;
143 opterr = 0;
144@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
145 if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
146 flags |= PIDOF_NETFS;
147
148- while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
149+ while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
150 case '?':
151 nsyslog(LOG_ERR,"invalid options on command line!\n");
152 closelog();
153@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
154 case 'x':
155 scripts_too++;
156 break;
157+ case 'm':
158+ flags |= PIDOF_OMIT_OMIT_MATCHES;
159+ break;
160 case 'n':
161 flags |= PIDOF_NETFS;
162 break;
163@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
164 pid_t spid = 0;
165 while ((p = get_next_from_pid_q(q))) {
166 if ((flags & PIDOF_OMIT) && omit) {
167- OMIT * optr;
168- for (optr = omit; optr; optr = optr->next) {
169+ PROC * optr;
170+ for (optr = olist; optr; optr = optr->next) {
171 if (optr->pid == p->pid)
172 break;
173+ if (flags & PIDOF_OMIT_OMIT_MATCHES)
174+ if (matches(optr, p))
175+ break;
176 }
177
178 /*
179@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
180 if (!first)
181 printf("\n");
182
183+ clear_omit();
184 clear_mnt();
185
186 closelog();
187--
1881.8.1.2
189
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/inittab b/meta/recipes-core/sysvinit/sysvinit-inittab/inittab
new file mode 100644
index 0000000000..6abbdf4558
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/inittab
@@ -0,0 +1,30 @@
1# /etc/inittab: init(8) configuration.
2# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
3
4# The default runlevel.
5id:5:initdefault:
6
7# Boot-time system configuration/initialization script.
8# This is run first except when booting in emergency (-b) mode.
9si::sysinit:/etc/init.d/rcS
10
11# What to do in single-user mode.
12~~:S:wait:/sbin/sulogin
13
14# /etc/init.d executes the S and K scripts upon change
15# of runlevel.
16#
17# Runlevel 0 is halt.
18# Runlevel 1 is single-user.
19# Runlevels 2-5 are multi-user.
20# Runlevel 6 is reboot.
21
22l0:0:wait:/etc/init.d/rc 0
23l1:1:wait:/etc/init.d/rc 1
24l2:2:wait:/etc/init.d/rc 2
25l3:3:wait:/etc/init.d/rc 3
26l4:4:wait:/etc/init.d/rc 4
27l5:5:wait:/etc/init.d/rc 5
28l6:6:wait:/etc/init.d/rc 6
29# Normally not reached, but fallthrough in case of emergency.
30z6:6:respawn:/sbin/sulogin
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
new file mode 100644
index 0000000000..657ef02204
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -0,0 +1,82 @@
1SUMMARY = "Inittab configuration for SysVinit"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
5PR = "r10"
6
7SRC_URI = "file://inittab"
8
9S = "${WORKDIR}/sysvinit-${PV}"
10
11INHIBIT_DEFAULT_DEPS = "1"
12
13do_compile() {
14 :
15}
16
17do_install() {
18 install -d ${D}${sysconfdir}
19 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
20
21 tmp="${SERIAL_CONSOLES}"
22 for i in $tmp
23 do
24 j=`echo ${i} | sed s/\;/\ /g`
25 label=`echo ${i} | sed -e 's/^.*;tty//' -e 's/;.*//'`
26 echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
27 done
28
29 if [ "${USE_VT}" = "1" ]; then
30 cat <<EOF >>${D}${sysconfdir}/inittab
31# ${base_sbindir}/getty invocations for the runlevels.
32#
33# The "id" field MUST be the same as the last
34# characters of the device (after "tty").
35#
36# Format:
37# <id>:<runlevels>:<action>:<process>
38#
39
40EOF
41
42 for n in ${SYSVINIT_ENABLED_GETTYS}
43 do
44 echo "$n:2345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
45 done
46 echo "" >> ${D}${sysconfdir}/inittab
47 fi
48}
49
50pkg_postinst_${PN} () {
51# run this on the target
52if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
53 tmp="${SERIAL_CONSOLES_CHECK}"
54 for i in $tmp
55 do
56 j=`echo ${i} | sed s/^.*\;//g`
57 if [ -z "`grep ${j} /proc/consoles`" ]; then
58 sed -i /^.*${j}$/d /etc/inittab
59 fi
60 done
61 kill -HUP 1
62else
63 if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
64 exit 0
65 else
66 exit 1
67 fi
68fi
69}
70
71# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
72# Set PACKAGE_ARCH appropriately.
73PACKAGE_ARCH = "${MACHINE_ARCH}"
74
75FILES_${PN} = "${sysconfdir}/inittab"
76CONFFILES_${PN} = "${sysconfdir}/inittab"
77
78USE_VT ?= "1"
79SYSVINIT_ENABLED_GETTYS ?= "1"
80
81
82
diff --git a/meta/recipes-core/sysvinit/sysvinit/01_bootlogd b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
new file mode 100644
index 0000000000..a689d92d63
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
@@ -0,0 +1 @@
f root root 0644 /var/log/boot none
diff --git a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
new file mode 100755
index 0000000000..df5aa430cf
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
@@ -0,0 +1,98 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: bootlogd
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop: 2 3 4 5
8# Short-Description: One of the first scripts to be executed. Starts or stops
9# the bootlogd log program. If this script is called as
10# "stop-bootlogd", it will stop the daemon instead of
11# starting it even when called with the "start" argument.
12#
13### END INIT INFO
14
15PATH=/sbin:/bin:/usr/sbin:/usr/bin
16DAEMON=/sbin/bootlogd
17NAME=bootlogd
18DESC="Bootlog daemon"
19
20# source function library
21. /etc/init.d/functions
22
23test -f $DAEMON || exit 0
24
25[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
26
27## set -e # not needed
28
29case "$BOOTLOGD_ENABLE" in
30 [Nn]*)
31 exit 0
32 ;;
33esac
34
35STOPPER=
36ACTION="$1"
37case "$0" in
38 *stop-bootlog*)
39 STOPPER=Y
40 if [ "$ACTION" = start ]
41 then
42 ACTION=stop
43 fi
44 ;;
45esac
46
47case "$ACTION" in
48 start)
49 [ "${VERBOSE}" != "no" ] && echo -n "Starting $DESC: "
50 if [ -d /proc/1/. ]
51 then
52 umask 027
53 start-stop-daemon --start --quiet \
54 --exec $DAEMON -- -r -c
55 else
56 $DAEMON -r -c
57 fi
58 [ "${VERBOSE}" != "no" ] && echo "$NAME."
59 ;;
60 stop)
61 # stop may get called during bootup, so let it honor
62 # rcS VERBOSE setting
63 [ "${VERBOSE}" != "no" ] && echo -n "Stopping $DESC: "
64 start-stop-daemon --stop --quiet --exec $DAEMON
65
66 if [ "$STOPPER" ] && [ "$(which savelog 2>/dev/null)" ] && \
67 [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
68 then
69 cd /var/log
70 chgrp adm boot
71 savelog -p -c 5 boot > /dev/null 2>&1
72 mv boot.0 boot
73 mv boot~ boot.0
74 fi
75
76 [ "${VERBOSE}" != "no" ] && echo "$NAME."
77 ;;
78 restart|force-reload)
79 echo -n "Restarting $DESC: "
80 start-stop-daemon --stop --quiet --exec $DAEMON
81 sleep 1
82 start-stop-daemon --start --quiet --exec $DAEMON
83 echo "$NAME."
84 ;;
85 status)
86 status $DAEMON
87 exit $?
88 ;;
89 *)
90 N=${0##*/}
91 N=${N#[SK]??}
92 echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
93 exit 1
94 ;;
95esac
96
97exit 0
98
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
new file mode 100755
index 0000000000..7ca41ae1ae
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -0,0 +1,182 @@
1#!/bin/sh
2#
3# rc This file is responsible for starting/stopping
4# services when the runlevel changes.
5#
6# Optimization feature:
7# A startup script is _not_ run when the service was
8# running in the previous runlevel and it wasn't stopped
9# in the runlevel transition (most Debian services don't
10# have K?? links in rc{1,2,3,4,5} )
11#
12# Author: Miquel van Smoorenburg <miquels@cistron.nl>
13# Bruce Perens <Bruce@Pixar.com>
14#
15# Version: @(#)rc 2.78 07-Nov-1999 miquels@cistron.nl
16#
17
18. /etc/default/rcS
19export VERBOSE
20
21startup_progress() {
22 step=$(($step + $step_change))
23 if [ "$num_steps" != "0" ]; then
24 progress=$((($step * $progress_size / $num_steps) + $first_step))
25 else
26 progress=$progress_size
27 fi
28 #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
29 #if type psplash-write >/dev/null 2>&1; then
30 # TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
31 #fi
32 if [ -e /mnt/.psplash/psplash_fifo ]; then
33 echo "PROGRESS $progress" > /mnt/.psplash/psplash_fifo
34 fi
35}
36
37
38#
39# Start script or program.
40#
41startup() {
42 # Handle verbosity
43 [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
44
45 case "$1" in
46 *.sh)
47 # Source shell script for speed.
48 (
49 trap - INT QUIT TSTP
50 scriptname=$1
51 shift
52 . $scriptname
53 )
54 ;;
55 *)
56 "$@"
57 ;;
58 esac
59 startup_progress
60}
61
62 # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
63 trap ":" INT QUIT TSTP
64
65 # Set onlcr to avoid staircase effect.
66 stty onlcr 0>&1
67
68 # Limit stack size for startup scripts
69 [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
70
71 # Now find out what the current and what the previous runlevel are.
72
73 runlevel=$RUNLEVEL
74 # Get first argument. Set new runlevel to this argument.
75 [ "$1" != "" ] && runlevel=$1
76 if [ "$runlevel" = "" ]
77 then
78 echo "Usage: $0 <runlevel>" >&2
79 exit 1
80 fi
81 previous=$PREVLEVEL
82 [ "$previous" = "" ] && previous=N
83
84 export runlevel previous
85
86 # Is there an rc directory for this new runlevel?
87 if [ -d /etc/rc$runlevel.d ]
88 then
89 # Find out where in the progress bar the initramfs got to.
90 PROGRESS_STATE=0
91 #if [ -f /dev/.initramfs/progress_state ]; then
92 # . /dev/.initramfs/progress_state
93 #fi
94
95 # Split the remaining portion of the progress bar into thirds
96 progress_size=$(((100 - $PROGRESS_STATE) / 3))
97
98 case "$runlevel" in
99 0|6)
100 # Count down from -100 to 0 and use the entire bar
101 first_step=-100
102 progress_size=100
103 step_change=1
104 ;;
105 S)
106 # Begin where the initramfs left off and use 2/3
107 # of the remaining space
108 first_step=$PROGRESS_STATE
109 progress_size=$(($progress_size * 2))
110 step_change=1
111 ;;
112 *)
113 # Begin where rcS left off and use the final 1/3 of
114 # the space (by leaving progress_size unchanged)
115 first_step=$(($progress_size * 2 + $PROGRESS_STATE))
116 step_change=1
117 ;;
118 esac
119
120 num_steps=0
121 for s in /etc/rc$runlevel.d/[SK]*; do
122 case "${s##/etc/rc$runlevel.d/S??}" in
123 gdm|xdm|kdm|reboot|halt)
124 break
125 ;;
126 esac
127 num_steps=$(($num_steps + 1))
128 done
129 step=0
130
131 # First, run the KILL scripts.
132 if [ $previous != N ]
133 then
134 for i in /etc/rc$runlevel.d/K[0-9][0-9]*
135 do
136 # Check if the script is there.
137 [ ! -f $i ] && continue
138
139 # Stop the service.
140 startup $i stop
141 done
142 fi
143
144 # Now run the START scripts for this runlevel.
145 for i in /etc/rc$runlevel.d/S*
146 do
147 [ ! -f $i ] && continue
148
149 if [ $previous != N ] && [ $previous != S ]
150 then
151 #
152 # Find start script in previous runlevel and
153 # stop script in this runlevel.
154 #
155 suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
156 stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
157 previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
158 #
159 # If there is a start script in the previous level
160 # and _no_ stop script in this level, we don't
161 # have to re-start the service.
162 #
163 [ -f $previous_start ] && [ ! -f $stop ] && continue
164 fi
165 case "$runlevel" in
166 0|6)
167 startup $i stop
168 ;;
169 *)
170 startup $i start
171 ;;
172 esac
173 done
174 fi
175
176#Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
177if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; then
178 if type psplash-write >/dev/null 2>&1; then
179 TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
180 umount -l /mnt/.psplash
181 fi
182fi
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS b/meta/recipes-core/sysvinit/sysvinit/rcS
new file mode 100755
index 0000000000..080b04f32f
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS
@@ -0,0 +1,34 @@
1#!/bin/sh
2#
3# rcS Call all S??* scripts in /etc/rcS.d in
4# numerical/alphabetical order.
5#
6# Version: @(#)/etc/init.d/rcS 2.76 19-Apr-1999 miquels@cistron.nl
7#
8
9PATH=/sbin:/bin:/usr/sbin:/usr/bin
10runlevel=S
11prevlevel=N
12umask 022
13export PATH runlevel prevlevel
14
15# Make sure proc is mounted
16#
17[ -d "/proc/1" ] || mount /proc
18
19#
20# Source defaults.
21#
22. /etc/default/rcS
23
24#
25# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
26#
27trap ":" INT QUIT TSTP
28
29#
30# Call all parts in order.
31#
32exec /etc/init.d/rc S
33
34
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS-default b/meta/recipes-core/sysvinit/sysvinit/rcS-default
new file mode 100644
index 0000000000..709cdf6ec5
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS-default
@@ -0,0 +1,29 @@
1#
2# Defaults for the boot scripts in /etc/rcS.d
3#
4
5# Time files in /tmp are kept in days.
6TMPTIME=0
7# Set to yes if you want sulogin to be spawned on bootup
8SULOGIN=no
9# Set to no if you want to be able to login over telnet/rlogin
10# before system startup is complete (as soon as inetd is started)
11DELAYLOGIN=no
12# Assume that the BIOS clock is set to UTC time (recommended)
13UTC=yes
14# Set VERBOSE to "no" if you would like a more quiet bootup.
15VERBOSE=no
16# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
17EDITMOTD=no
18# Whether to fsck root on boot
19ENABLE_ROOTFS_FSCK=no
20# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
21FSCKFIX=yes
22# Set TICKADJ to the correct tick value for this specific machine
23#TICKADJ=10000
24# Enable caching in populate-volatile.sh
25VOLATILE_ENABLE_CACHE=yes
26# Indicate whether the rootfs is intended to be read-only or not.
27# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
28# Normally you should not change this value.
29ROOTFS_READ_ONLY=no
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
new file mode 100644
index 0000000000..00d333323e
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -0,0 +1,102 @@
1SUMMARY = "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."
3HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/"
4SECTION = "base"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
7 file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
8PR = "r14"
9
10RDEPENDS_${PN} = "${PN}-inittab"
11
12SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.bz2 \
13 file://install.patch \
14 file://crypt-lib.patch \
15 file://pidof-add-m-option.patch \
16 file://rcS-default \
17 file://rc \
18 file://rcS \
19 file://bootlogd.init \
20 file://01_bootlogd \
21"
22
23SRC_URI[md5sum] = "6eda8a97b86e0a6f59dabbf25202aa6f"
24SRC_URI[sha256sum] = "60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519"
25
26S = "${WORKDIR}/sysvinit-${PV}"
27B = "${S}/src"
28
29inherit update-alternatives
30DEPENDS_append = " update-rc.d-native base-passwd"
31
32ALTERNATIVE_${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last mesg utmpdump wall"
33
34ALTERNATIVE_PRIORITY = "200"
35
36ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
37ALTERNATIVE_PRIORITY[init] = "50"
38
39ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
40ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
41ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
42ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
43ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
44ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
45
46ALTERNATIVE_${PN}-pidof = "pidof"
47ALTERNATIVE_LINK_NAME[pidof] = "${base_bindir}/pidof"
48
49ALTERNATIVE_${PN}-sulogin = "sulogin"
50ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
51
52ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1"
53
54ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
55ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
56ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
57ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
58ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
59ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
60
61PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
62FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*"
63FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5"
64FILES_sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit"
65
66RDEPENDS_${PN} += "sysvinit-pidof initscripts-functions"
67
68CFLAGS_prepend = "-D_GNU_SOURCE "
69export LCRYPT = "-lcrypt"
70EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
71 'base_sbindir=${base_sbindir}' \
72 'bindir=${bindir}' \
73 'sbindir=${sbindir}' \
74 'sysconfdir=${sysconfdir}' \
75 'includedir=${includedir}' \
76 'mandir=${mandir}'"
77
78do_install () {
79 oe_runmake 'ROOT=${D}' install
80
81 install -d ${D}${sysconfdir} \
82 ${D}${sysconfdir}/default \
83 ${D}${sysconfdir}/init.d
84 for level in S 0 1 2 3 4 5 6; do
85 install -d ${D}${sysconfdir}/rc$level.d
86 done
87
88 install -m 0644 ${WORKDIR}/rcS-default ${D}${sysconfdir}/default/rcS
89 install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd
92 ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd
93
94 update-rc.d -r ${D} bootlogd start 07 S .
95 update-rc.d -r ${D} stop-bootlogd start 99 2 3 4 5 .
96
97 install -d ${D}${sysconfdir}/default/volatiles
98 install -m 0644 ${WORKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles
99
100 chown root.shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
101 chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
102}