]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/busybox/busybox_1.01.bb
busybox: apply patch to fix "df <path>".
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / busybox / busybox_1.01.bb
1 DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single \
2 small executable. It provides minimalist replacements for most of the \
3 utilities you usually find in GNU fileutils, shellutils, etc. The utilities \
4 in BusyBox generally have fewer options than their full-featured GNU \
5 cousins; however, the options that are included provide the expected \
6 functionality and behave very much like their GNU counterparts. BusyBox \
7 provides a fairly complete POSIX environment for any small or embedded \
8 system."
9 HOMEPAGE = "http://www.busybox.net"
10 LICENSE = "GPL"
11 SECTION = "base"
12 PRIORITY = "required"
13 PR = "r1"
14
15 DEFAULT_PREFERENCE = "-1"
16 DEFAULT_PREFERENCE_nslu2 = ""
17
18 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
19            file://udhcppidfile.patch;patch=1 \
20            file://udhcppidfile-breakage.patch;patch=1 \
21            file://add-getkey-applet.patch;patch=1 \
22            file://below.patch;patch=1 \
23            file://dhcp-hostname.patch;patch=1 \
24            file://dhcpretrytime.patch;patch=1 \
25            file://fbset.patch;patch=1 \
26            file://hdparm_M.patch;patch=1 \
27            file://ifupdown-spurious-environ.patch;patch=1 \
28            file://iproute-flush-cache.patch;patch=1;pnum=0 \
29            file://mount-all-type.patch;patch=1 \
30            file://readlink.patch;patch=1 \
31            file://rmmod.patch;patch=1 \
32            file://df.patch;patch=1 \
33            file://udhcpscript.patch;patch=1 \
34            file://defconfig \
35            file://busybox-cron \
36            file://busybox-httpd \
37            file://busybox-udhcpd \
38            file://syslog \
39            file://hwclock.sh \
40            file://default.script \
41            file://syslog.conf \
42            file://mount.busybox \
43            file://umount.busybox"
44
45 S = "${WORKDIR}/busybox-${PV}"
46
47 export EXTRA_CFLAGS = "${CFLAGS}"
48 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
49 PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
50
51 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
52 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
53
54 FILES_${PN} += " ${datadir}/udhcpc"
55
56 INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
57 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
58 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 
59 INITSCRIPT_NAME_${PN} = "syslog"
60 CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
61
62 # This disables the syslog startup links in openslug (see openslug-init)
63 INITSCRIPT_PARAMS_${PN}_openslug = "start 20 ."
64
65 inherit cml1 update-rc.d
66
67 do_configure () {
68         install -m 0644 ${WORKDIR}/defconfig ${S}/.config
69         cml1_do_configure
70 }
71
72 do_compile () {
73         unset CFLAGS
74         base_do_compile
75 }
76
77 do_install () {
78         install -d ${D}${sysconfdir}/init.d
79         oe_runmake 'PREFIX=${D}' install
80
81         # Move everything to /busybox (not supposed to end up in any package)
82         install -d ${D}/busybox
83         mv ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
84         # Move the busybox binary back to /bin
85         install -d ${D}${base_bindir}
86         mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
87         # Move back the sh symlink
88         mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
89
90         install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
91         install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
92         if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then 
93                 # Move crond back to /usr/sbin/crond
94                 install -d ${D}${sbindir}
95                 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
96
97                 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
98         fi
99         if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then 
100                 # Move httpd back to /usr/sbin/httpd
101                 install -d ${D}${sbindir}
102                 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
103                                         
104                 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
105                 install -d ${D}/srv/www
106         fi
107         if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then 
108                 # Move udhcpd back to /usr/sbin/udhcpd
109                 install -d ${D}${sbindir}
110                 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
111                                         
112                 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
113         fi
114         if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then 
115                 # Move hwclock back to /sbin/hwclock
116                 install -d ${D}${base_sbindir}
117                 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
118                                         
119                 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
120         fi
121         if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then 
122                 # Move dhcpc back to /usr/sbin/udhcpc
123                 install -d ${D}${base_sbindir}
124                 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
125
126                 install -d ${D}${sysconfdir}/udhcpc.d
127                 install -d ${D}${datadir}/udhcpc
128                 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
129                 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
130         fi
131
132         install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
133 }
134
135 pkg_postinst_${PN} () {
136         # If we are not making an image we create links for the utilities that doesn't exist
137         # so the update-alternatives script will get the utilities it needs
138         # (update-alternatives have no problem replacing links later anyway)
139         test -n 2> /dev/null || alias test='busybox test'
140         if test "x$D" = "x"; then while read link; do if test ! -h "$link"; then case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; busybox ln -s $to $link; fi; done </etc/busybox.links; fi
141         
142         # This adds the links, remember that this has to work when building an image too, hence the $D
143         while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; update-alternatives --install $link $bn $to 50; done <$D/etc/busybox.links
144 }
145
146 pkg_prerm_${PN} () {
147         # This is so you can make busybox commit suicide - removing busybox with no other packages
148         # providing its files, this will make update-alternatives work, but the update-rc.d part
149         # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
150         tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
151         ln -s /bin/busybox $tmpdir/[
152         ln -s /bin/busybox $tmpdir/test
153         ln -s /bin/busybox $tmpdir/head
154         ln -s /bin/busybox $tmpdir/sh
155         ln -s /bin/busybox $tmpdir/basename
156         ln -s /bin/busybox $tmpdir/echo
157         ln -s /bin/busybox $tmpdir/mv
158         ln -s /bin/busybox $tmpdir/ln
159         ln -s /bin/busybox $tmpdir/dirname
160         ln -s /bin/busybox $tmpdir/rm
161         ln -s /bin/busybox $tmpdir/sed
162         ln -s /bin/busybox $tmpdir/sort
163         export PATH=$PATH:$tmpdir
164         while read link; do case "$link" in /*/*/*) to="../../bin/busybox";; /bin/*) to="busybox";; /*/*) to="../bin/busybox";; esac; bn=`basename $link`; sh /usr/bin/update-alternatives --remove $bn $to; done </etc/busybox.links
165 }