aboutsummaryrefslogtreecommitdiffstats
path: root/packages/busybox/busybox_1.00.bb
diff options
context:
space:
mode:
authorDavid Karlstrom <daka@thg.se>2005-07-23 13:36:38 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-07-23 13:36:38 +0000
commit5e01906b8433bc6a8c03be2e31758589641124c9 (patch)
treec400790ffa5ebb896c464da84752a4937d889400 /packages/busybox/busybox_1.00.bb
parent57808a977840bce11bdbab373d9eacaba7ef88c1 (diff)
downloadopenembedded-5e01906b8433bc6a8c03be2e31758589641124c9.tar.gz
Updated to use update-alternatives and fix some FHS bugs
Diffstat (limited to 'packages/busybox/busybox_1.00.bb')
-rw-r--r--packages/busybox/busybox_1.00.bb68
1 files changed, 59 insertions, 9 deletions
diff --git a/packages/busybox/busybox_1.00.bb b/packages/busybox/busybox_1.00.bb
index 1a5b392b7d..056213c82c 100644
--- a/packages/busybox/busybox_1.00.bb
+++ b/packages/busybox/busybox_1.00.bb
@@ -10,7 +10,7 @@ HOMEPAGE = "http://www.busybox.net"
LICENSE = "GPL"
SECTION = "base"
PRIORITY = "required"
-PR = "r27"
+PR = "r28"
SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
file://add-getkey-applet.patch;patch=1 \
@@ -73,39 +73,89 @@ do_compile () {
do_install () {
install -d ${D}${sysconfdir}/init.d
oe_runmake 'PREFIX=${D}' install
+
+ # Move everything to /busybox (not supposed to end up in any package)
+ install -d ${D}/busybox
+ mv ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ${D}/busybox/
+ # Move the busybox binary back to /bin
+ install -d ${D}${base_bindir}
+ mv ${D}/busybox${base_bindir}/busybox ${D}${base_bindir}/
+ # Move back the sh symlink
+ mv ${D}/busybox${base_bindir}/sh ${D}${base_bindir}/
+
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
+ # Move crond back to /usr/sbin/crond
+ install -d ${D}${sbindir}
+ mv ${D}/busybox${sbindir}/crond ${D}${sbindir}/
+
install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
fi
if grep "CONFIG_HTTPD=y" ${WORKDIR}/defconfig; then
+ # Move httpd back to /usr/sbin/httpd
+ install -d ${D}${sbindir}
+ mv ${D}/busybox${sbindir}/httpd ${D}${sbindir}/
+
install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
install -d ${D}/srv/www
fi
if grep "CONFIG_UDHCPD=y" ${WORKDIR}/defconfig; then
+ # Move udhcpd back to /usr/sbin/udhcpd
+ install -d ${D}${sbindir}
+ mv ${D}/busybox${sbindir}/udhcpd ${D}${sbindir}/
+
install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
fi
if grep "CONFIG_HWCLOCK=y" ${WORKDIR}/defconfig; then
+ # Move hwclock back to /sbin/hwclock
+ install -d ${D}${base_sbindir}
+ mv ${D}/busybox${base_sbindir}/hwclock ${D}${base_sbindir}/
+
install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
fi
if grep "CONFIG_UDHCPC=y" ${WORKDIR}/defconfig; then
+ # Move dhcpc back to /usr/sbin/udhcpc
+ install -d ${D}${base_sbindir}
+ mv ${D}/busybox${base_sbindir}/udhcpc ${D}${base_sbindir}/
+
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}/
+
+ install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
}
pkg_postinst_${PN} () {
- update-alternatives --install /bin/mount mount /bin/mount.busybox 50
- update-alternatives --install /bin/umount umount /bin/umount.busybox 50
+ # If we are not making an image we create links for the utilities that doesn't exist
+ # so the update-alternatives script will get the utilities it needs
+ # (update-alternatives have no problem replacing links later anyway)
+ alias test='busybox test'
+ 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
+
+ # This adds the links, remember that this has to work when building an image too, hence the $D
+ 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
}
pkg_prerm_${PN} () {
- update-alternatives --remove mount /bin/mount.busybox
- update-alternatives --remove umount /bin/umount.busybox
+ # This is so you can make busybox commit suicide - removing busybox with no other packages
+ # providing its files, this will make update-alternatives work, but the update-rc.d part
+ # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
+ tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
+ ln -s /bin/busybox $tmpdir/[
+ ln -s /bin/busybox $tmpdir/test
+ ln -s /bin/busybox $tmpdir/head
+ ln -s /bin/busybox $tmpdir/sh
+ ln -s /bin/busybox $tmpdir/basename
+ ln -s /bin/busybox $tmpdir/echo
+ ln -s /bin/busybox $tmpdir/mv
+ ln -s /bin/busybox $tmpdir/ln
+ ln -s /bin/busybox $tmpdir/dirname
+ ln -s /bin/busybox $tmpdir/rm
+ ln -s /bin/busybox $tmpdir/sed
+ ln -s /bin/busybox $tmpdir/sort
+ export PATH=$PATH:$tmpdir
+ 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
}