Merge oe-devel@oe-devel.bkbits.net:packages
[openembedded.git] / sysvinit / sysvinit_2.85.oe
1 SECTION = "base"
2 DESCRIPTION = "System-V like init.\
3  Init is the first program to run after your system is booted, and\
4  continues to run as process number 1 until your system halts. Inits\
5  job is to start other programs that are essential to the operation of\
6  your system. All processes are descended from init. For more information,\
7  see the manual page init(8)."
8 PACKAGES = "sysvinit"
9 FILES_${PN} = "/sbin ${bindir} ${sysconfdir}"
10 FILES_sysv-rc = "${sbindir}"
11 PR = "r1"
12
13 # USE_VT and SERIAL_CONSLE are generally defined by the MACHINE .conf.
14 # Set PACKAGE_ARCH appropriately.
15 PACKAGE_ARCH := "${MACHINE_ARCH}"
16
17 USE_VT ?= "1"
18
19 SRC_URI = "ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-${PV}.tar.gz \
20            file://need \
21            file://provide \
22            file://inittab \
23            file://rcS-default \
24            file://rc \
25            file://rcS"
26 S = "${WORKDIR}/sysvinit-${PV}/src"
27
28 CFLAGS_prepend = "-D_GNU_SOURCE "
29 export LCRYPT = "-lcrypt"
30
31
32 do_install () {
33         install -d ${D}/${bindir} ${D}/${sbindir} \
34                    ${D}/sbin ${D}/${sysconfdir}/default \
35                    ${D}/${sysconfdir}/init.d
36         install -m 755 halt killall5 \
37                 runlevel shutdown ${D}/sbin/
38         install -m 755 init ${D}/sbin/sysvinit
39         install -m 755 mesg last ${D}${bindir}
40         install -m 0755 ${WORKDIR}/need         ${D}/sbin/need.sysvinit
41         install -m 0755 ${WORKDIR}/provide              ${D}/sbin/provide.sysvinit
42         ln -sf halt ${D}/sbin/reboot
43         ln -sf halt ${D}/sbin/poweroff
44         ln -sf init ${D}/sbin/telinit
45         ln -sf killall5 ${D}/sbin/pidof
46         ln -sf last ${D}${bindir}/lastb
47         install -m 0644 ${WORKDIR}/inittab ${D}/${sysconfdir}/inittab
48         if [ ! -z "${SERIAL_CONSOLE}" ]; then
49                 echo "S:2345:respawn:/sbin/getty ${SERIAL_CONSOLE}" >> ${D}/etc/inittab
50         fi
51         if [ "${USE_VT}" == "1" ]; then
52                 cat <<EOF >>${D}/etc/inittab
53 # /sbin/getty invocations for the runlevels.
54 #
55 # The "id" field MUST be the same as the last
56 # characters of the device (after "tty").
57 #
58 # Format:
59 #  <id>:<runlevels>:<action>:<process>
60 #
61 1:2345:respawn:/sbin/getty 38400 tty1
62 # 2:23:respawn:/sbin/getty 38400 tty2
63 # 3:23:respawn:/sbin/getty 38400 tty3
64 # 4:23:respawn:/sbin/getty 38400 tty4
65 EOF
66         fi
67         install -m 0644    ${WORKDIR}/rcS-default       ${D}/etc/default/rcS
68         install -m 0755    ${WORKDIR}/rc                ${D}/etc/init.d
69         install -m 0755    ${WORKDIR}/rcS               ${D}/etc/init.d
70 }
71
72
73 do_install_append_ramses () {
74         cat <<EOF >>${D}/etc/inittab
75 # Bluetooth
76 #1:2345:respawn:/sbin/getty -L 115200 tts/1
77 # External serial port
78 4:2345:respawn:/sbin/getty -L 115200 tts/4
79 # Framebuffer
80 v1:2345:respawn:/sbin/getty -L 115200 vc/1
81 EOF
82 }
83
84
85 pkg_postinst () {
86 set -e
87 # FIXME: use update-alternatives.. but what if the user doesnt have it?
88 #if [ -n "`which update-alternatives 2>/dev/null`" ]; then
89 #       update-alternatives blah
90 #else
91         ln -sf sysvinit $D/sbin/init
92 #fi
93 exit 0
94 }