summaryrefslogtreecommitdiff
path: root/sysvinit/sysvinit_2.85.oe
blob: 182a93a3dda5a729363e54f84c6b79043783dc66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
DEPENDS = "virtual/libc"
DESCRIPTION = "System-V like init.\
 Init is the first program to run after your system is booted, and\
 continues to run as process number 1 until your system halts. Inits\
 job is to start other programs that are essential to the operation of\
 your system. All processes are descended from init. For more information,\
 see the manual page init(8)."
PACKAGES = "sysvinit sysv-rc"
FILES_${PN} = "/sbin ${bindir} ${sysconfdir}"
FILES_sysv-rc = "${sbindir}"

SRC_URI = "ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-${PV}.tar.gz \
	   cvs://anoncvs:anoncvs@cvs.handhelds.org/cvs;module=apps/update-rc.d"
S = "${WORKDIR}/sysvinit-${PV}/src"

CFLAGS_prepend = "-D_GNU_SOURCE "
export LCRYPT = "-lcrypt"

do_install () {
	install -d ${D}/${bindir} ${D}/${sbindir} \
		   ${D}/sbin ${D}/${sysconfdir}/default \
		   ${D}/${sysconfdir}/init.d
#	install -m 755 debian/sysv-rc/sbin/invoke-rc.d \
#		debian/sysv-rc/sbin/update-rc.d ${D}${sbindir}/
	install -m 755 halt killall5 \
		runlevel shutdown ${D}/sbin/
	install -m 755 init ${D}/sbin/sysvinit
	install -m 755 mesg last ${D}${bindir}
	install -m 0755 ${FILESDIR}/need		${D}/sbin/need.sysvinit
	install -m 0755 ${FILESDIR}/provide		${D}/sbin/provide.sysvinit
	ln -sf halt ${D}/sbin/reboot
	ln -sf halt ${D}/sbin/poweroff
	ln -sf init ${D}/sbin/telinit
	ln -sf killall5 ${D}/sbin/pidof
	ln -sf last ${D}${bindir}/lastb
#	echo "/etc/inittab" > ${D}/CONTROL/conffiles
#	echo "/etc/default/rcS" >> ${D}/CONTROL/conffiles
#	install -m 0755    ${FILESDIR}/prerm		${D}/CONTROL/
#	install -m 0755    ${FILESDIR}/postinst		${D}/CONTROL/
	if [ -e ${FILESDIR}/inittab_${MACHINE} ]; then
		install -m 0644    ${FILESDIR}/inittab_${MACHINE}	${D}/etc/inittab
	else
		install -m 0644    ${FILESDIR}/inittab	${D}/etc/inittab
	fi
	if [ ! -z "${SERIAL_CONSOLE}" ]; then
		echo "S:2345:respawn:/sbin/getty ${SERIAL_CONSOLE}" >> ${D}/etc/inittab
	fi
	install -m 0644    ${FILESDIR}/rcS-default	${D}/etc/default/rcS
	install -m 0755    ${FILESDIR}/rc		${D}/etc/init.d
	install -m 0755    ${FILESDIR}/rcS		${D}/etc/init.d
	install -m 0755    ${WORKDIR}/update-rc.d/update-rc.d ${D}/${sbindir}/
}

do_stage () {
	install -m 0755    ${WORKDIR}/update-rc.d/update-rc.d ${STAGING_BINDIR}/
}

pkg_postinst () {
	set -e

# FIXME: use update-alternatives.. but what if the user doesnt have it?
#	if [ -n "`which update-alternatives 2>/dev/null`" ]; then
#		update-alternatives blah
#	else
		ln -sf sysvinit $D/sbin/init
#	fi
	exit 0
}

#pkg_prerm () {
#	set -e
# FIXME: use update-alternatives
#	exit 0
#}