increase dvbapp PR.
[vuplus_openembedded] / recipes / busybox / busybox_1.3.1.bb
1 require busybox.inc
2
3 PR = "${INC_PR}.1"
4
5 DEFAULT_PREFERENCE = "-1"
6
7 SRC_URI = "file://defconfig"
8
9 do_configure () {
10         install -m 0644 ${WORKDIR}/defconfig ${S}/.config.oe
11
12         echo "CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"" > ${S}/.config
13         echo "USING_CROSS_COMPILER=y" >> ${S}/.config
14
15         sed -e  '/CROSS_COMPILER_PREFIX/d' \
16             -e  '/USING_CROSS_COMPILER/d' \
17                 '${S}/.config.oe' >>'${S}/.config'
18         cml1_do_configure
19 }
20
21 do_install () {
22         install -d ${D}${sysconfdir}/init.d
23         oe_runmake "PREFIX=${D}" install
24         cp -pPR ${S}/_install/* ${D}/
25
26         # Move everything to /busybox (not supposed to end up in any package)
27         install -d ${D}/busybox
28         ls ${D} -R
29
30         cp -dPr ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
31         # Move the busybox binary back to /bin
32         install -d ${D}${base_bindir}
33         mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
34         # Move back the sh symlink
35         test -h ${D}/busybox${base_bindir}/sh && mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
36
37         install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
38         install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
39         if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
40                 # Move crond back to /usr/sbin/crond
41                 install -d ${D}${sbindir}
42                 mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
43
44                 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
45         fi
46         if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
47                 # Move httpd back to /usr/sbin/httpd
48                 install -d ${D}${sbindir}
49                 mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
50
51                 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
52                 install -d ${D}/srv/www
53         fi
54         if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then
55                 # Move udhcpd back to /usr/sbin/udhcpd
56                 install -d ${D}${sbindir}
57                 mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
58
59                 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
60         fi
61         if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
62                 # Move hwclock back to /sbin/hwclock
63                 install -d ${D}${base_sbindir}
64                 mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
65
66                 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
67         fi
68         if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then
69                 # Move dhcpc back to /usr/sbin/udhcpc
70                 install -d ${D}${base_sbindir}
71                 mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
72
73                 install -d ${D}${sysconfdir}/udhcpc.d
74                 install -d ${D}${datadir}/udhcpc
75                 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
76                 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
77         fi
78
79         install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
80 }
81
82 pkg_prerm_${PN} () {
83         # This is so you can make busybox commit suicide - removing busybox with no other packages
84         # providing its files, this will make update-alternatives work, but the update-rc.d part
85         # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
86         tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
87         ln -s /bin/busybox $tmpdir/[
88         ln -s /bin/busybox $tmpdir/test
89         ln -s /bin/busybox $tmpdir/head
90         ln -s /bin/busybox $tmpdir/sh
91         ln -s /bin/busybox $tmpdir/basename
92         ln -s /bin/busybox $tmpdir/echo
93         ln -s /bin/busybox $tmpdir/mv
94         ln -s /bin/busybox $tmpdir/ln
95         ln -s /bin/busybox $tmpdir/dirname
96         ln -s /bin/busybox $tmpdir/rm
97         ln -s /bin/busybox $tmpdir/sed
98         ln -s /bin/busybox $tmpdir/sort
99         export PATH=$PATH:$tmpdir
100         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
101 }