summaryrefslogtreecommitdiff
path: root/packages/busybox/busybox_1.00.bb
blob: ccea9e87188d70aa7dd5921fddf6f0a999d5d355 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single \
small executable. It provides minimalist replacements for most of the \
utilities you usually find in GNU fileutils, shellutils, etc. The utilities \
in BusyBox generally have fewer options than their full-featured GNU \
cousins; however, the options that are included provide the expected \
functionality and behave very much like their GNU counterparts. BusyBox \
provides a fairly complete POSIX environment for any small or embedded \
system."
HOMEPAGE = "http://www.busybox.net"
LICENSE = "GPL"
SECTION = "base"
PRIORITY = "required"
PR = "r24"

SPURION = "file://ifupdown-spurious-environ.patch;patch=1"
SPURION_nslu2 = ""

SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
           file://add-getkey-applet.patch;patch=1 \
	   file://udhcpscript.patch;patch=1 \
	   file://dhcpretrytime.patch;patch=1 \
	   file://hdparm_M.patch;patch=1 \
	   file://udhcppidfile.patch;patch=1 \
	   file://udhcppidfile-breakage.patch;patch=1 \
	   file://readlink.patch;patch=1 \
	   file://iproute-flush-cache.patch;patch=1;pnum=0 \
	   file://rmmod.patch;patch=1 \
	   file://below.patch;patch=1 \
	   file://fbset.patch;patch=1 \
	   file://mount-all-type.patch;patch=1 \
           file://celf-ash-builtins.patch;patch=1 \
	   file://dhcp-hostname.patch;patch=1 \
	   ${SPURION} \
	   file://gzip-spurious-const.patch;patch=1 \
           file://defconfig \
           file://busybox-cron \
	   file://busybox-httpd \
	   file://busybox-udhcpd \
	   file://syslog \
           file://hwclock.sh \
	   file://default.script \
	   file://syslog.conf \
	   file://mount.busybox \
	   file://umount.busybox"

S = "${WORKDIR}/busybox-${PV}"

export EXTRA_CFLAGS = "${CFLAGS}"
EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"

FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"

FILES_${PN} += " ${datadir}/udhcpc"

INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 
INITSCRIPT_NAME_${PN} = "syslog"

# This disables the syslog startup links in openslug (see openslug-init)
INITSCRIPT_PARAMS_${PN}_openslug = "start 20 ."

inherit cml1 update-rc.d

do_configure () {
	install -m 0644 ${WORKDIR}/defconfig ${S}/.config
	cml1_do_configure
}

do_compile () {
	unset CFLAGS
	base_do_compile
}

do_install () {
	install -d ${D}${sysconfdir}/init.d
	oe_runmake 'PREFIX=${D}' install
	install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
	install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
	if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then 
		install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
	fi
	if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then 
		install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
		install -d ${D}/srv/www
	fi
	if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then 
		install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
	fi
	if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then 
		install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
	fi
	if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then 
		install -d ${D}${sysconfdir}/udhcpc.d
		install -d ${D}${datadir}/udhcpc
		install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
		install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
	fi
	rm ${D}${base_bindir}/mount
	install -m 0755 ${WORKDIR}/mount.busybox ${D}${base_bindir}/
	rm ${D}${base_bindir}/umount
	install -m 0755 ${WORKDIR}/umount.busybox ${D}${base_bindir}/
}

pkg_postinst_${PN} () {
	update-alternatives --install /bin/mount mount /bin/mount.busybox 50
	update-alternatives --install /bin/umount umount /bin/umount.busybox 50
}

pkg_prerm_${PN} () {
	update-alternatives --remove mount /bin/mount.busybox
	update-alternatives --remove umount /bin/umount.busybox
}