diff options
Diffstat (limited to 'meta/packages/busybox/busybox.inc')
-rw-r--r-- | meta/packages/busybox/busybox.inc | 127 |
1 files changed, 111 insertions, 16 deletions
diff --git a/meta/packages/busybox/busybox.inc b/meta/packages/busybox/busybox.inc index ab17d96db4..0fb3b5efff 100644 --- a/meta/packages/busybox/busybox.inc +++ b/meta/packages/busybox/busybox.inc | |||
@@ -11,19 +11,21 @@ LICENSE = "GPL" | |||
11 | SECTION = "base" | 11 | SECTION = "base" |
12 | PRIORITY = "required" | 12 | PRIORITY = "required" |
13 | 13 | ||
14 | SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \ | 14 | SRC_URI = "\ |
15 | file://busybox-cron \ | 15 | http://www.busybox.net/downloads/busybox-${PV}.tar.gz \ |
16 | file://busybox-httpd \ | 16 | file://busybox-cron \ |
17 | file://busybox-udhcpd \ | 17 | file://busybox-httpd \ |
18 | file://default.script \ | 18 | file://busybox-udhcpd \ |
19 | file://dhcp-hostname.patch;patch=1 \ | 19 | file://default.script \ |
20 | file://hwclock.sh \ | 20 | file://dhcp-hostname.patch;patch=1 \ |
21 | file://ifupdown-spurious-environ.patch;patch=1 \ | 21 | file://hwclock.sh \ |
22 | file://mount.busybox \ | 22 | file://ifupdown-spurious-environ.patch;patch=1 \ |
23 | file://syslog \ | 23 | file://mount.busybox \ |
24 | file://syslog.conf \ | 24 | file://syslog \ |
25 | file://udhcpscript.patch;patch=1 \ | 25 | file://syslog.conf \ |
26 | file://umount.busybox" | 26 | file://udhcpscript.patch;patch=1 \ |
27 | file://umount.busybox \ | ||
28 | " | ||
27 | 29 | ||
28 | SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1" | 30 | SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1" |
29 | 31 | ||
@@ -34,7 +36,7 @@ PACKAGES =+ "${PN}-httpd ${PN}-udhcpd" | |||
34 | FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www" | 36 | FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www" |
35 | FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" | 37 | FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" |
36 | 38 | ||
37 | FILES_${PN} += " ${datadir}/udhcpc" | 39 | FILES_${PN} += "${datadir}/udhcpc" |
38 | 40 | ||
39 | INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd" | 41 | INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd" |
40 | INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd" | 42 | INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd" |
@@ -47,11 +49,73 @@ INITSCRIPT_PARAMS_${PN}_slugos = "start 20 ." | |||
47 | 49 | ||
48 | inherit cml1 update-rc.d | 50 | inherit cml1 update-rc.d |
49 | 51 | ||
50 | do_compile () { | 52 | do_compile() { |
51 | unset CFLAGS | 53 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
52 | base_do_compile | 54 | base_do_compile |
53 | } | 55 | } |
54 | 56 | ||
57 | do_install () { | ||
58 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS | ||
59 | install -d ${D}${sysconfdir}/init.d | ||
60 | oe_runmake "PREFIX=${D}" install | ||
61 | cp -pPR ${S}/_install/* ${D}/ | ||
62 | |||
63 | # Move everything to /busybox (not supposed to end up in any package) | ||
64 | install -d ${D}/busybox | ||
65 | ls ${D} -R | ||
66 | |||
67 | cp -dPr ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/ | ||
68 | # Move the busybox binary back to /bin | ||
69 | install -d ${D}${base_bindir} | ||
70 | mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/ | ||
71 | # Move back the sh symlink | ||
72 | test -h ${D}/busybox${base_bindir}/sh && mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/ | ||
73 | |||
74 | install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/ | ||
75 | install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/ | ||
76 | if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then | ||
77 | # Move crond back to /usr/sbin/crond | ||
78 | install -d ${D}${sbindir} | ||
79 | mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/ | ||
80 | |||
81 | install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/ | ||
82 | fi | ||
83 | if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then | ||
84 | # Move httpd back to /usr/sbin/httpd | ||
85 | install -d ${D}${sbindir} | ||
86 | mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/ | ||
87 | |||
88 | install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/ | ||
89 | install -d ${D}/srv/www | ||
90 | fi | ||
91 | if grep "CONFIG_APP_UDHCPD=y" ${WORKDIR}/defconfig; then | ||
92 | # Move udhcpd back to /usr/sbin/udhcpd | ||
93 | install -d ${D}${sbindir} | ||
94 | mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/ | ||
95 | |||
96 | install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/ | ||
97 | fi | ||
98 | if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then | ||
99 | # Move hwclock back to /sbin/hwclock | ||
100 | install -d ${D}${base_sbindir} | ||
101 | mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/ | ||
102 | |||
103 | install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/ | ||
104 | fi | ||
105 | if grep "CONFIG_APP_UDHCPC=y" ${WORKDIR}/defconfig; then | ||
106 | # Move dhcpc back to /usr/sbin/udhcpc | ||
107 | install -d ${D}${base_sbindir} | ||
108 | mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/ | ||
109 | |||
110 | install -d ${D}${sysconfdir}/udhcpc.d | ||
111 | install -d ${D}${datadir}/udhcpc | ||
112 | install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default | ||
113 | install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script | ||
114 | fi | ||
115 | |||
116 | install -m 0644 ${S}/busybox.links ${D}${sysconfdir} | ||
117 | } | ||
118 | |||
55 | pkg_postinst_${PN} () { | 119 | pkg_postinst_${PN} () { |
56 | # If we are not making an image we create links for the utilities that doesn't exist | 120 | # If we are not making an image we create links for the utilities that doesn't exist |
57 | # so the update-alternatives script will get the utilities it needs | 121 | # so the update-alternatives script will get the utilities it needs |
@@ -62,3 +126,34 @@ pkg_postinst_${PN} () { | |||
62 | # This adds the links, remember that this has to work when building an image too, hence the $D | 126 | # This adds the links, remember that this has to work when building an image too, hence the $D |
63 | 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 | 127 | 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 |
64 | } | 128 | } |
129 | |||
130 | pkg_prerm_${PN} () { | ||
131 | # This is so you can make busybox commit suicide - removing busybox with no other packages | ||
132 | # providing its files, this will make update-alternatives work, but the update-rc.d part | ||
133 | # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh | ||
134 | tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX` | ||
135 | ln -s /bin/busybox $tmpdir/[ | ||
136 | ln -s /bin/busybox $tmpdir/test | ||
137 | ln -s /bin/busybox $tmpdir/head | ||
138 | ln -s /bin/busybox $tmpdir/sh | ||
139 | ln -s /bin/busybox $tmpdir/basename | ||
140 | ln -s /bin/busybox $tmpdir/echo | ||
141 | ln -s /bin/busybox $tmpdir/mv | ||
142 | ln -s /bin/busybox $tmpdir/ln | ||
143 | ln -s /bin/busybox $tmpdir/dirname | ||
144 | ln -s /bin/busybox $tmpdir/rm | ||
145 | ln -s /bin/busybox $tmpdir/sed | ||
146 | ln -s /bin/busybox $tmpdir/sort | ||
147 | export PATH=$PATH:$tmpdir | ||
148 | |||
149 | while read link | ||
150 | do | ||
151 | case "$link" in | ||
152 | /*/*/*) to="../../bin/busybox";; | ||
153 | /bin/*) to="busybox";; | ||
154 | /*/*) to="../bin/busybox";; | ||
155 | esac | ||
156 | bn=`basename $link` | ||
157 | sh /usr/bin/update-alternatives --remove $bn $to | ||
158 | done </etc/busybox.links | ||
159 | } | ||