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