| 1 |
DESCRIPTION = "System-V like init." |
|---|
| 2 |
SECTION = "base" |
|---|
| 3 |
LICENSE = "GPL" |
|---|
| 4 |
HOMEPAGE = "http://freshmeat.net/projects/sysvinit/" |
|---|
| 5 |
PR = "r40" |
|---|
| 6 |
|
|---|
| 7 |
# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf. |
|---|
| 8 |
# Set PACKAGE_ARCH appropriately. |
|---|
| 9 |
PACKAGE_ARCH_${PN}-inittab = "${MACHINE_ARCH}" |
|---|
| 10 |
|
|---|
| 11 |
RDEPENDS_${PN} = "${PN}-inittab" |
|---|
| 12 |
|
|---|
| 13 |
PACKAGES =+ "bootlogd ${PN}-inittab" |
|---|
| 14 |
FILES_bootlogd = "/etc/init.d/bootlogd /etc/init.d/stop-bootlogd /etc/rc?.d/S*bootlogd /sbin/bootlogd" |
|---|
| 15 |
FILES_${PN}-inittab = "${sysconfdir}/inittab" |
|---|
| 16 |
CONFFILES_${PN}-inittab = "${sysconfdir}/inittab" |
|---|
| 17 |
|
|---|
| 18 |
USE_VT ?= "1" |
|---|
| 19 |
SYSVINIT_ENABLED_GETTYS ?= "1" |
|---|
| 20 |
|
|---|
| 21 |
SRC_URI = "ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-${PV}.tar.gz \ |
|---|
| 22 |
file://install.patch;patch=1 \ |
|---|
| 23 |
file://try-dev-tty0-first.patch;patch=1 \ |
|---|
| 24 |
file://need \ |
|---|
| 25 |
file://provide \ |
|---|
| 26 |
file://inittab \ |
|---|
| 27 |
file://rcS-default \ |
|---|
| 28 |
file://rc \ |
|---|
| 29 |
file://rcS \ |
|---|
| 30 |
file://bootlogd.init" |
|---|
| 31 |
|
|---|
| 32 |
S = "${WORKDIR}/sysvinit-${PV}" |
|---|
| 33 |
B = "${S}/src" |
|---|
| 34 |
|
|---|
| 35 |
inherit update-alternatives |
|---|
| 36 |
|
|---|
| 37 |
ALTERNATIVE_NAME = "init" |
|---|
| 38 |
ALTERNATIVE_LINK = "${base_sbindir}/init" |
|---|
| 39 |
ALTERNATIVE_PATH = "${base_sbindir}/init.sysvinit" |
|---|
| 40 |
ALTERNATIVE_PRIORITY = "50" |
|---|
| 41 |
|
|---|
| 42 |
PACKAGES =+ "sysvinit-pidof sysvinit-sulogin" |
|---|
| 43 |
FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*" |
|---|
| 44 |
FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit" |
|---|
| 45 |
FILES_sysvinit-sulogin = "${base_sbindir}/sulogin" |
|---|
| 46 |
|
|---|
| 47 |
CFLAGS_prepend = "-D_GNU_SOURCE " |
|---|
| 48 |
export LCRYPT = "-lcrypt" |
|---|
| 49 |
EXTRA_OEMAKE += "'INSTALL=install' \ |
|---|
| 50 |
'bindir=${base_bindir}' \ |
|---|
| 51 |
'sbindir=${base_sbindir}' \ |
|---|
| 52 |
'usrbindir=${bindir}' \ |
|---|
| 53 |
'usrsbindir=${sbindir}' \ |
|---|
| 54 |
'includedir=${includedir}' \ |
|---|
| 55 |
'mandir=${mandir}' \ |
|---|
| 56 |
DISTRO=''" |
|---|
| 57 |
|
|---|
| 58 |
do_install () { |
|---|
| 59 |
oe_runmake 'ROOT=${D}' install |
|---|
| 60 |
install -d ${D}${sysconfdir} |
|---|
| 61 |
install -d ${D}${sysconfdir}/default |
|---|
| 62 |
install -d ${D}${sysconfdir}/init.d |
|---|
| 63 |
install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab |
|---|
| 64 |
if [ ! -z "${SERIAL_CONSOLE}" ]; then |
|---|
| 65 |
echo "S:2345:respawn:${base_sbindir}/getty ${SERIAL_CONSOLE}" >> ${D}${sysconfdir}/inittab |
|---|
| 66 |
fi |
|---|
| 67 |
if [ "${USE_VT}" = "1" ]; then |
|---|
| 68 |
cat <<EOF >>${D}${sysconfdir}/inittab |
|---|
| 69 |
# ${base_sbindir}/getty invocations for the runlevels. |
|---|
| 70 |
# |
|---|
| 71 |
# The "id" field MUST be the same as the last |
|---|
| 72 |
# characters of the device (after "tty"). |
|---|
| 73 |
# |
|---|
| 74 |
# Format: |
|---|
| 75 |
# <id>:<runlevels>:<action>:<process> |
|---|
| 76 |
# |
|---|
| 77 |
|
|---|
| 78 |
EOF |
|---|
| 79 |
|
|---|
| 80 |
for n in ${SYSVINIT_ENABLED_GETTYS} |
|---|
| 81 |
do |
|---|
| 82 |
echo "$n:2345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab |
|---|
| 83 |
done |
|---|
| 84 |
echo "" >> ${D}${sysconfdir}/inittab |
|---|
| 85 |
fi |
|---|
| 86 |
install -m 0644 ${WORKDIR}/rcS-default ${D}${sysconfdir}/default/rcS |
|---|
| 87 |
install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d |
|---|
| 88 |
install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d |
|---|
| 89 |
install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd |
|---|
| 90 |
ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd |
|---|
| 91 |
install -d ${D}${sysconfdir}/rcS.d |
|---|
| 92 |
ln -sf ../init.d/bootlogd ${D}${sysconfdir}/rcS.d/S07bootlogd |
|---|
| 93 |
for level in 2 3 4 5; do |
|---|
| 94 |
install -d ${D}${sysconfdir}/rc$level.d |
|---|
| 95 |
ln -sf ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd |
|---|
| 96 |
done |
|---|
| 97 |
mv ${D}${base_sbindir}/init ${D}${base_sbindir}/init.${PN} |
|---|
| 98 |
mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN} |
|---|
| 99 |
mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN} |
|---|
| 100 |
mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN} |
|---|
| 101 |
mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN} |
|---|
| 102 |
mv ${D}${bindir}/last ${D}${bindir}/last.${PN} |
|---|
| 103 |
mv ${D}${bindir}/mesg ${D}${bindir}/mesg.${PN} |
|---|
| 104 |
mv ${D}${bindir}/wall ${D}${bindir}/wall.${PN} |
|---|
| 105 |
} |
|---|
| 106 |
|
|---|
| 107 |
pkg_postinst_${PN} () { |
|---|
| 108 |
#!/bin/sh |
|---|
| 109 |
update-alternatives --install ${base_sbindir}/halt halt halt.${PN} 200 |
|---|
| 110 |
update-alternatives --install ${base_sbindir}/reboot reboot reboot.${PN} 200 |
|---|
| 111 |
update-alternatives --install ${base_sbindir}/shutdown shutdown shutdown.${PN} 200 |
|---|
| 112 |
update-alternatives --install ${bindir}/last last last.${PN} 200 |
|---|
| 113 |
update-alternatives --install ${bindir}/mesg mesg mesg.${PN} 200 |
|---|
| 114 |
update-alternatives --install ${bindir}/wall wall wall.${PN} 200 |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
pkg_prerm_${PN} () { |
|---|
| 118 |
#!/bin/sh |
|---|
| 119 |
update-alternatives --remove halt halt.${PN} |
|---|
| 120 |
update-alternatives --remove reboot reboot.${PN} |
|---|
| 121 |
update-alternatives --remove shutdown shutdown.${PN} |
|---|
| 122 |
update-alternatives --remove last last.${PN} |
|---|
| 123 |
update-alternatives --remove mesg mesg.${PN} |
|---|
| 124 |
update-alternatives --remove wall wall.${PN} |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
pkg_postinst_sysvinit-pidof () { |
|---|
| 128 |
#!/bin/sh |
|---|
| 129 |
update-alternatives --install ${base_bindir}/pidof pidof pidof.${PN} 200 |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
pkg_prerm_sysvinit-pidof () { |
|---|
| 133 |
#!/bin/sh |
|---|
| 134 |
update-alternatives --remove pidof pidof.${PN} |
|---|
| 135 |
} |
|---|