summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-core/sysvinit
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-core/sysvinit')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch23
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch81
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/bootlogd.init85
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/inittab30
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/need6
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/postinst17
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/prerm9
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/provide6
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc179
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rcS34
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/rcS-default25
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb135
12 files changed, 630 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..b9511f088e
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
@@ -0,0 +1,23 @@
1# The src Makefile was checking for libcrypt.a on the host, not in the
2# build environment. This patch checks for $LCRYPT in the environment
3# and uses it if it's there.
4# - jdike@linux.intel.com
5
6Index: sysvinit-2.88dsf/src/Makefile
7===================================================================
8--- sysvinit-2.88dsf.orig/src/Makefile
9+++ sysvinit-2.88dsf/src/Makefile
10@@ -85,9 +85,13 @@ else
11 endif
12
13 # Additional libs for GNU libc.
14+ifneq ($(LCRYPT),)
15+ SULOGINLIBS += $(LCRYPT)
16+else
17 ifneq ($(wildcard /usr/lib*/libcrypt.a),)
18 SULOGINLIBS += -lcrypt
19 endif
20+endif
21
22 all: $(BIN) $(SBIN) $(USRBIN)
23
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..5978cea076
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
@@ -0,0 +1,81 @@
1diff --git a/src/Makefile b/src/Makefile
2index e2b8028..3e11e92 100644
3--- a/src/Makefile
4+++ b/src/Makefile
5@@ -65,7 +65,14 @@ else
6 INSTALL_DATA = install -m 644
7 endif
8 INSTALL_DIR = install -m 755 -d
9-MANDIR = /usr/share/man
10+
11+ROOT ?=
12+base_bindir ?= /bin
13+base_sbindir ?= /sbin
14+bindir ?= /usr/bin
15+sysconfdir ?= /etc
16+includedir ?= /usr/include
17+mandir ?= /usr/share/man
18
19 ifeq ($(WITH_SELINUX),yes)
20 SELINUX_DEF = -DWITH_SELINUX
21@@ -138,39 +145,39 @@ clobber: cleanobjs
22 distclean: clobber
23
24 install:
25- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
26- $(INSTALL_DIR) $(ROOT)/usr/bin/
27+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
28+ $(INSTALL_DIR) $(ROOT)$(bindir)/
29 for i in $(BIN); do \
30- $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
31+ $(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
32 done
33 for i in $(SBIN); do \
34- $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
35+ $(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
36 done
37 for i in $(USRBIN); do \
38- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
39+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
40 done
41- # $(INSTALL_DIR) $(ROOT)/etc/
42- # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
43- ln -sf halt $(ROOT)/sbin/reboot
44- ln -sf halt $(ROOT)/sbin/poweroff
45- ln -sf init $(ROOT)/sbin/telinit
46- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
47- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
48- ln -sf last $(ROOT)/usr/bin/lastb; \
49+ # $(INSTALL_DIR) $(ROOT)$(sysconfdir)/
50+ # $(INSTALL_EXEC) initscript.sample $(ROOT)$(sysconfdir)/
51+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
52+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
53+ ln -sf init $(ROOT)$(base_sbindir)/telinit
54+ ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
55+ if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
56+ ln -sf last $(ROOT)$(bindir)/lastb; \
57 fi
58- $(INSTALL_DIR) $(ROOT)/usr/include/
59- $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
60- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
61- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
62- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
63+ $(INSTALL_DIR) $(ROOT)$(includedir)/
64+ $(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
65+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
66+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
67+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
68 for i in $(MAN1); do \
69- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
70+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man1/; \
71 done
72 for i in $(MAN5); do \
73- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
74+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man5/; \
75 done
76 for i in $(MAN8); do \
77- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
78+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man8/; \
79 done
80 ifeq ($(ROOT),)
81 #
diff --git a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
new file mode 100755
index 0000000000..f8f07a050f
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
@@ -0,0 +1,85 @@
1#! /bin/sh
2#
3# bootlogd One of the first scripts to be executed. Starts or stops
4# the bootlogd log program. If this script is called as
5# "stop-bootlogd", it will stop the daemon instead of
6# starting it even when called with the "start" argument.
7#
8# Version: @(#)bootlogd 2.85-12 21-Mar-2004 miquels@cistron.nl
9#
10
11PATH=/sbin:/bin:/usr/sbin:/usr/bin
12DAEMON=/sbin/bootlogd
13NAME=bootlogd
14DESC="Bootlog daemon"
15
16test -f $DAEMON || exit 0
17
18[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
19
20## set -e # not needed
21
22case "$BOOTLOGD_ENABLE" in
23 [Nn]*)
24 exit 0
25 ;;
26esac
27
28STOPPER=
29ACTION="$1"
30case "$0" in
31 *stop-bootlog*)
32 STOPPER=Y
33 if [ "$ACTION" = start ]
34 then
35 ACTION=stop
36 fi
37 ;;
38esac
39
40case "$ACTION" in
41 start)
42 echo -n "Starting $DESC: "
43 if [ -d /proc/1/. ]
44 then
45 umask 027
46 start-stop-daemon --start --quiet \
47 --exec $DAEMON -- -r
48 else
49 $DAEMON -r
50 fi
51 echo "$NAME."
52 ;;
53 stop)
54 echo -n "Stopping $DESC: "
55 start-stop-daemon --stop --quiet --exec $DAEMON
56
57 if [ "$STOPPER" ] && [ -f /var/log/boot ] && \
58 [ -f /var/log/boot~ ]
59 then
60 cd /var/log
61 chgrp adm boot
62 savelog -p -c 5 boot > /dev/null 2>&1
63 mv boot.0 boot
64 mv boot~ boot.0
65 fi
66
67 echo "$NAME."
68 ;;
69 restart|force-reload)
70 echo -n "Restarting $DESC: "
71 start-stop-daemon --stop --quiet --exec $DAEMON
72 sleep 1
73 start-stop-daemon --start --quiet --exec $DAEMON
74 echo "$NAME."
75 ;;
76 *)
77 N=${0##*/}
78 N=${N#[SK]??}
79 echo "Usage: $N {start|stop|restart|force-reload}" >&2
80 exit 1
81 ;;
82esac
83
84exit 0
85
diff --git a/meta/recipes-core/sysvinit/sysvinit/inittab b/meta/recipes-core/sysvinit/sysvinit/inittab
new file mode 100644
index 0000000000..6abbdf4558
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/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/need b/meta/recipes-core/sysvinit/sysvinit/need
new file mode 100644
index 0000000000..4d84bbeee7
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/need
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3# need binary that doesnt do anything, supplied for simpleinit
4# vs sysvinit compatibility for the supplied startup scripts
5
6exit 0
diff --git a/meta/recipes-core/sysvinit/sysvinit/postinst b/meta/recipes-core/sysvinit/sysvinit/postinst
new file mode 100644
index 0000000000..b6fe547fa4
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/postinst
@@ -0,0 +1,17 @@
1#!/bin/busybox ash
2
3action="$1"
4oldversion="$2"
5
6umask 022
7
8if [ "$action" != configure ]
9then
10 exit 0
11fi
12
13update-alternatives --install /sbin/init init /sbin/sysvinit 25
14update-alternatives --install /sbin/need need /sbin/need.sysvinit 25
15update-alternatives --install /sbin/provide provide /sbin/provide.sysvinit 25
16
17exit 0
diff --git a/meta/recipes-core/sysvinit/sysvinit/prerm b/meta/recipes-core/sysvinit/sysvinit/prerm
new file mode 100644
index 0000000000..704a29ffd5
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/prerm
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3if [ "$1" != "upgrade" ]; then
4 update-alternatives --remove need /sbin/need.sysvinit
5 update-alternatives --remove provide /sbin/provide.sysvinit
6 update-alternatives --remove init /sbin/sysvinit
7fi
8
9exit 0
diff --git a/meta/recipes-core/sysvinit/sysvinit/provide b/meta/recipes-core/sysvinit/sysvinit/provide
new file mode 100644
index 0000000000..c90cf3537b
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/provide
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3# provide binary that doesnt do anything, supplied for simpleinit
4# vs sysvinit compatibility for the supplied startup scripts
5
6exit 0
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
new file mode 100755
index 0000000000..dce31a5c98
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -0,0 +1,179 @@
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 # Now find out what the current and what the previous runlevel are.
69
70 runlevel=$RUNLEVEL
71 # Get first argument. Set new runlevel to this argument.
72 [ "$1" != "" ] && runlevel=$1
73 if [ "$runlevel" = "" ]
74 then
75 echo "Usage: $0 <runlevel>" >&2
76 exit 1
77 fi
78 previous=$PREVLEVEL
79 [ "$previous" = "" ] && previous=N
80
81 export runlevel previous
82
83 # Is there an rc directory for this new runlevel?
84 if [ -d /etc/rc$runlevel.d ]
85 then
86 # Find out where in the progress bar the initramfs got to.
87 PROGRESS_STATE=0
88 #if [ -f /dev/.initramfs/progress_state ]; then
89 # . /dev/.initramfs/progress_state
90 #fi
91
92 # Split the remaining portion of the progress bar into thirds
93 progress_size=$(((100 - $PROGRESS_STATE) / 3))
94
95 case "$runlevel" in
96 0|6)
97 # Count down from -100 to 0 and use the entire bar
98 first_step=-100
99 progress_size=100
100 step_change=1
101 ;;
102 S)
103 # Begin where the initramfs left off and use 2/3
104 # of the remaining space
105 first_step=$PROGRESS_STATE
106 progress_size=$(($progress_size * 2))
107 step_change=1
108 ;;
109 *)
110 # Begin where rcS left off and use the final 1/3 of
111 # the space (by leaving progress_size unchanged)
112 first_step=$(($progress_size * 2 + $PROGRESS_STATE))
113 step_change=1
114 ;;
115 esac
116
117 num_steps=0
118 for s in /etc/rc$runlevel.d/[SK]*; do
119 case "${s##/etc/rc$runlevel.d/S??}" in
120 gdm|xdm|kdm|reboot|halt)
121 break
122 ;;
123 esac
124 num_steps=$(($num_steps + 1))
125 done
126 step=0
127
128 # First, run the KILL scripts.
129 if [ $previous != N ]
130 then
131 for i in /etc/rc$runlevel.d/K[0-9][0-9]*
132 do
133 # Check if the script is there.
134 [ ! -f $i ] && continue
135
136 # Stop the service.
137 startup $i stop
138 done
139 fi
140
141 # Now run the START scripts for this runlevel.
142 for i in /etc/rc$runlevel.d/S*
143 do
144 [ ! -f $i ] && continue
145
146 if [ $previous != N ] && [ $previous != S ]
147 then
148 #
149 # Find start script in previous runlevel and
150 # stop script in this runlevel.
151 #
152 suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
153 stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
154 previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
155 #
156 # If there is a start script in the previous level
157 # and _no_ stop script in this level, we don't
158 # have to re-start the service.
159 #
160 [ -f $previous_start ] && [ ! -f $stop ] && continue
161 fi
162 case "$runlevel" in
163 0|6)
164 startup $i stop
165 ;;
166 *)
167 startup $i start
168 ;;
169 esac
170 done
171 fi
172
173#Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
174#if [ "x$runlevel" != "xS" ]; then
175# if type psplash-write >/dev/null 2>&1; then
176# TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
177# umount /mnt/.psplash
178# fi
179#fi
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..7ad3c7bf8f
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS-default
@@ -0,0 +1,25 @@
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# Set UTC=yes if your system clock is set to UTC (GMT), and UTC=no if not.
13# UTC=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 editted 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
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..db38064548
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -0,0 +1,135 @@
1DESCRIPTION = "System-V like init."
2HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/"
3SECTION = "base"
4LICENSE = "GPLv2+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
6 file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
7PR = "r1"
8
9# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
10# Set PACKAGE_ARCH appropriately.
11PACKAGE_ARCH_${PN}-inittab = "${MACHINE_ARCH}"
12
13RDEPENDS_${PN} = "${PN}-inittab"
14
15PACKAGES =+ "bootlogd ${PN}-inittab"
16FILES_bootlogd = "/etc/init.d/bootlogd /etc/init.d/stop-bootlogd /etc/rc?.d/S*bootlogd /sbin/bootlogd"
17FILES_${PN}-inittab = "${sysconfdir}/inittab"
18CONFFILES_${PN}-inittab = "${sysconfdir}/inittab"
19
20USE_VT ?= "1"
21SYSVINIT_ENABLED_GETTYS ?= "1"
22
23SRC_URI = "http://download.savannah.gnu.org/releases-noredirect/sysvinit/sysvinit-${PV}.tar.bz2 \
24 file://install.patch \
25 file://crypt-lib.patch \
26 file://need \
27 file://provide \
28 file://inittab \
29 file://rcS-default \
30 file://rc \
31 file://rcS \
32 file://bootlogd.init"
33
34S = "${WORKDIR}/sysvinit-${PV}"
35B = "${S}/src"
36
37inherit update-alternatives
38
39ALTERNATIVE_NAME = "init"
40ALTERNATIVE_LINK = "${base_sbindir}/init"
41ALTERNATIVE_PATH = "${base_sbindir}/init.sysvinit"
42ALTERNATIVE_PRIORITY = "50"
43
44PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
45FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*"
46FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit"
47FILES_sysvinit-sulogin = "${base_sbindir}/sulogin"
48
49CFLAGS_prepend = "-D_GNU_SOURCE "
50export LCRYPT = "-lcrypt"
51EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
52 'base_sbindir=${base_sbindir}' \
53 'bindir=${bindir}' \
54 'sbindir=${sbindir}' \
55 'sysconfdir=${sysconfdir}' \
56 'includedir=${includedir}' \
57 'mandir=${mandir}'"
58
59do_install () {
60 oe_runmake 'ROOT=${D}' install
61 install -d ${D}${sysconfdir} \
62 ${D}${sysconfdir}/default \
63 ${D}${sysconfdir}/init.d
64 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
65 if [ ! -z "${SERIAL_CONSOLE}" ]; then
66 echo "S:2345:respawn:${base_sbindir}/getty ${SERIAL_CONSOLE}" >> ${D}${sysconfdir}/inittab
67 fi
68 if [ "${USE_VT}" = "1" ]; then
69 cat <<EOF >>${D}${sysconfdir}/inittab
70# ${base_sbindir}/getty invocations for the runlevels.
71#
72# The "id" field MUST be the same as the last
73# characters of the device (after "tty").
74#
75# Format:
76# <id>:<runlevels>:<action>:<process>
77#
78
79EOF
80
81 for n in ${SYSVINIT_ENABLED_GETTYS}
82 do
83 echo "$n:2345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
84 done
85 echo "" >> ${D}${sysconfdir}/inittab
86 fi
87 install -m 0644 ${WORKDIR}/rcS-default ${D}${sysconfdir}/default/rcS
88 install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d
89 install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd
91 ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd
92 install -d ${D}${sysconfdir}/rcS.d
93 ln -sf ../init.d/bootlogd ${D}${sysconfdir}/rcS.d/S07bootlogd
94 for level in 2 3 4 5; do
95 install -d ${D}${sysconfdir}/rc$level.d
96 ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
97 done
98 mv ${D}${base_sbindir}/init ${D}${base_sbindir}/init.${PN}
99 mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN}
100 mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
101 mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
102 mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}
103 mv ${D}${base_sbindir}/poweroff ${D}${base_sbindir}/poweroff.${PN}
104 mv ${D}${bindir}/last ${D}${bindir}/last.${PN}
105 mv ${D}${bindir}/mesg ${D}${bindir}/mesg.${PN}
106 mv ${D}${bindir}/wall ${D}${bindir}/wall.${PN}
107}
108
109pkg_postinst_${PN} () {
110 update-alternatives --install ${base_sbindir}/halt halt halt.${PN} 200
111 update-alternatives --install ${base_sbindir}/reboot reboot reboot.${PN} 200
112 update-alternatives --install ${base_sbindir}/shutdown shutdown shutdown.${PN} 200
113 update-alternatives --install ${base_sbindir}/poweroff poweroff poweroff.${PN} 200
114 update-alternatives --install ${bindir}/last last last.${PN} 200
115 update-alternatives --install ${bindir}/mesg mesg mesg.${PN} 200
116 update-alternatives --install ${bindir}/wall wall wall.${PN} 200
117}
118
119pkg_prerm_${PN} () {
120 update-alternatives --remove halt halt.${PN}
121 update-alternatives --remove reboot reboot.${PN}
122 update-alternatives --remove shutdown shutdown.${PN}
123 update-alternatives --remove poweroff poweroff.${PN}
124 update-alternatives --remove last last.${PN}
125 update-alternatives --remove mesg mesg.${PN}
126 update-alternatives --remove wall wall.${PN}
127}
128
129pkg_postinst_sysvinit-pidof () {
130 update-alternatives --install ${base_bindir}/pidof pidof pidof.${PN} 200
131}
132
133pkg_prerm_sysvinit-pidof () {
134 update-alternatives --remove pidof pidof.${PN}
135}