# $Id$ PNAME="busybox" PVER="1.32.0" PBUILD="r1" PCAT="sys-apps" DESCRIPTION="BusyBox combines tiny versions of many common UNIX utilities into a single small executable." HOMEPAGE="http://www.busybox.net/" PROVIDE="virtual/bzip2 virtual/cron virtual/debianutils virtual/dhcp virtual/eject virtual/grep virtual/gzip virtual/inetutils virtual/kbd virtual/less virtual/net-tools virtual/pciutils virtual/procps virtual/psmisc virtual/sed virtual/shadow virtual/sysvinit virtual/sysvinit-tools virtual/tar virtual/unzip virtual/usbutils virtual/which virtual/xz-utils" # busbox config revision CFG_REV=1.24 # udhcpc client script revision UDHCPC_REV=1.1 # busybox.tmpfilesd revision TMP_REV=1.2 # agetty emulation script revision AGETTY_REV=1.3 # loadkeys emulation script revision LOADKEYS_REV=1.4 # server services revisions HTTPD_SVC_REV=1.2 UDHCPD_SVC_REV=1.2 TFTPD_SVC_REV=1.4 TFTPD_CONFD_REV=1.2 SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" SDEPEND=">= virtual/sed" sminclude mtools systemd alx # we do not provide wget applet anymore, so depend on wget too DEPEND=">= net-misc/wget-1.17" SRC_URI=( http://www.busybox.net/downloads/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/config-${CFG_REV} mirror://${PNAME}/udhcpc.sh-${UDHCPC_REV} mirror://${PNAME}/de.kmap.gz mirror://${PNAME}/zgrep.sh #mirror://${PNAME}/nologin.c mirror://${PNAME}/crond.service mirror://${PNAME}/busybox.tmpfilesd-${TMP_REV} mirror://${PNAME}/loadkeys.sh-${LOADKEYS_REV} mirror://${PNAME}/agetty.sh-${AGETTY_REV} mirror://${PNAME}/autologin.sh mirror://${PNAME}/lat9w-16.psfu.gz mirror://${PNAME}/LatArCyrHeb-16.psfu.gz mirror://${PNAME}/httpd.service-${HTTPD_SVC_REV} mirror://${PNAME}/httpd.confd mirror://${PNAME}/httpd.tmpfilesd mirror://${PNAME}/udhcpd.service-${UDHCPD_SVC_REV} mirror://${PNAME}/udhcpd.confd mirror://${PNAME}/udhcpd.tmpfilesd mirror://${PNAME}/tftpd.service-${TFTPD_SVC_REV} mirror://${PNAME}/tftpd.socket mirror://${PNAME}/tftpd.confd-${TFTPD_CONFD_REV} mirror://${PNAME}/tftpd.tmpfilesd mirror://${PNAME}/8859-1_to_uni.trans mirror://${PNAME}/${PNAME}-1.29.2-cp-ignore-onefilesystem.patch mirror://${PNAME}/${PNAME}-1.27.1-no-send-signals.patch ) UP2DATE="updatecmd https://busybox.net/downloads/ | grep ${PNAME}-[0-9] | highesttarball" src_prepare() { munpack ${SRCFILE} || die munpack de.kmap.gz ${SRCDIR} || die munpack lat9w-16.psfu.gz ${SRCDIR} || die munpack LatArCyrHeb-16.psfu.gz ${SRCDIR} || die cd ${SRCDIR} # official patches # magellan patches # let cp ignore the onefilesystem mode switch (cp -x prints an error) mpatch ${PNAME}-1.29.2-cp-ignore-onefilesystem.patch || die # do not send any signals on shutdown/reboot, we doing this via sendsignals rc mpatch ${PNAME}-1.27.1-no-send-signals.patch || die # using a custom config cp ${SOURCEDIR}/${PNAME}/config-${CFG_REV} .config || die # not required for busybox-1.29 anymore # # fix a missing include with linux-musl-headers # sed -i '1i#include ' include/libbb.h || die # now included in config 1.19 # # disable swapon & swapoff; systemd requires the util-linux version # # because it depends on some options the busybox version does not provide # sed -i -e 's/.*\(CONFIG_SWAPONOFF\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_SWAPON_DISCARD\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_SWAPON_PRI\).*/#\ \1 is not set/' \ # .config || die # now included in config 1.19 # # use full blown wget to support ssl # sed -i -e 's/.*\(CONFIG_WGET\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_WGET_STATUSBAR\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_WGET_AUTHENTICATION\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_WGET_LONG_OPTIONS\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_WGET_TIMEOUT\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_WGET_OPENSSL\).*/#\ \1 is not set/' \ # .config || die # now included in config 1.20 # # do not use ifup/ifdown from busybox as dracut implements its own # sed -i -e 's/.*\(CONFIG_IFUP\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_IFDOWN\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_IFUPDOWN_IFSTATE_PATH\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IP\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IPV4\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_IPV6\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_MAPPING\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP\).*/#\ \1 is not set/' \ # .config || die # now included in config 1.21 # # use full blown losetup cmd from util-linux to fix dracuts losetup -f --show statements # sed -i -e 's/.*\(CONFIG_LOSETUP\).*/#\ \1 is not set/' .config || die # # # use full blown ed to fix build issues with bc # sed -i -e 's/.*\(CONFIG_ED\).*/#\ \1 is not set/' .config || die # # # use full blown tee from coreutils to fix build errors with smage while logging is enabled # sed -i -e 's/.*\(CONFIG_TEE\).*/#\ \1 is not set/' .config || die # # # use full blown sed stat and date from coreutils to fix segfault issues with i686 and busybox 1.27.x # sed -i -e 's/.*\(CONFIG_SED\).*/#\ \1 is not set/' .config || die # sed -i -e 's/.*\(CONFIG_STAT\).*/#\ \1 is not set/' .config || die # sed -i -e 's/.*\(CONFIG_DATE\).*/#\ \1 is not set/' .config || die # now included in config 1.22 # # re-enable date, stat, sed # sed -i -e 's/#\ \(CONFIG_DATE\) is not set/\1=y/' \ # -e 's/#\ \(CONFIG_FEATURE_DATE_ISOFMT\) is not set/\1=y/' \ # -e 's/#\ \(CONFIG_FEATURE_DATE_NANO\) is not set/\1=y/' \ # -e 's/#\ \(CONFIG_FEATURE_DATE_COMPAT\) is not set/\1=y/' \ # .config || die # sed -i -e 's/#\ \(CONFIG_STAT\) is not set/\1=y/' \ # -e 's/#\ \(CONFIG_FEATURE_STAT_FORMAT\) is not set/\1=y/' \ # -e 's/#\ \(CONFIG_FEATURE_STAT_FILESYSTEM\) is not set/\1=y/' \ # .config || die # sed -i -e 's/#\ \(CONFIG_SED\) is not set/\1=y/' .config || die # now included in config-1.22 # # build a static busybox with musl # sed -i -e 's/#\ \(CONFIG_STATIC\) is not set/\1=y/' .config || die # # # these vi options breaks with musl-gcc # sed -i -e 's/.*\(CONFIG_FEATURE_VI_8BIT\).*/#\ \1 is not set/' \ # -e 's/.*\(CONFIG_FEATURE_VI_REGEX_SEARCH\).*/#\ \1 is not set/' \ # .config || die # now included in config-1.23 # # use solib busybox build with system gcc to try to fix some i686 segfaults # sed -i -e 's/#\ \(CONFIG_STATIC\)=y/\1 is not set/' .config || die } src_compile() { cd ${SRCDIR} # fortify_source not supported export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} make oldconfig || die mmake -j1 V=1 || die # create a busybox.links file HOSTCC=gcc sh applets/busybox.mkll | sort > busybox.links || die # now included in config 1.19 # # do not use ash as default sh, we want bin/bash # sed -i '/bin\/sh$/d' busybox.links || die # setfont resides in /bin on newer systems sed -i 's:/sbin/setfont:/bin/setfont:' busybox.links || die # honor usr move sed -i -e 's:^/bin:/usr/bin:' -e 's:^/sbin:/usr/sbin:' busybox.links || die # now provided by >= busybox-1.30.1 # # build nologin program # gcc ${CFLAGS} -o nologin ${SOURCEDIR}/${PNAME}/nologin.c || die } src_install() { cd ${SRCDIR} minstallexec busybox || die # set suid bit for suid applets like su mchmod +s /usr/bin/busybox || die minstalldir /usr/share/busybox || die minstallfile busybox.links /usr/share/busybox || die # systemd needs the keymaps in /usr/share/kbd/keymaps and no! symlinks are allowed # keymaps must end with .map or .map.gz # dracut uses /usr/share/kbd/keymaps too minstalldir /usr/share/kbd/keymaps || die minstallfile de.kmap /usr/share/kbd/keymaps/de.map || die minstalldir /usr/share/udhcpc || die minstallexec -s udhcpc.sh-${UDHCPC_REV} /usr/share/udhcpc/default.script || die # install example udhcpd.conf minstalletc examples/udhcp/udhcpd.conf || die # install initsystem services minstallunit crond.service || die minstalltmp busybox.tmpfilesd-${TMP_REV} busybox.conf || die # install server system services # udhcpd minstallunit udhcpd.service-${UDHCPD_SVC_REV} udhcpd.service || die minstallconf udhcpd.confd udhcpd || die minstalltmp udhcpd.tmpfilesd udhcpd.conf || die # tftpd minstallunit tftpd.service-${TFTPD_SVC_REV} tftpd.service || die minstallunit tftpd.socket || die minstallconf tftpd.confd-${TFTPD_CONFD_REV} tftpd || die minstalltmp tftpd.tmpfilesd tftpd.conf || die # httpd minstallunit httpd.service-${HTTPD_SVC_REV} httpd.service || die minstallconf httpd.confd httpd || die minstalltmp httpd.tmpfilesd httpd.conf || die # loadkeys emulation script minstallexec -s loadkeys.sh-${LOADKEYS_REV} /usr/bin/loadkeys || die # agetty emulation script minstalldir /usr/sbin || die minstallexec -s agetty.sh-${AGETTY_REV} /usr/sbin/agetty || die # autologin helper script minstallexec -s autologin.sh /usr/sbin/autologin || die # install service configuration files and keep needed directories mkeepdir /var/spool/cron/crontabs || die # install a busybox compilant zgrep script, at least needed by plymouth minstallexec -s zgrep.sh /usr/bin/zgrep || die # install consolefont and trans from kbd-1.15.5 to fully emulate kbd # for systemd without any configfile changes # busybox cmds requires the base name without any extension, we provide symlinks for systemd minstalldir /usr/share/kbd/consolefonts || die minstallfile lat9w-16.psfu /usr/share/kbd/consolefonts/lat9w-16 || die mlink lat9w-16 /usr/share/kbd/consolefonts/lat9w-16.psfu || die minstallfile LatArCyrHeb-16.psfu /usr/share/kbd/consolefonts/LatArCyrHeb-16 || die mlink LatArCyrHeb-16 /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu || die minstalldir /usr/share/kbd/consoletrans || die minstallfile -s 8859-1_to_uni.trans /usr/share/kbd/consoletrans/8859-1_to_uni || die mlink 8859-1_to_uni /usr/share/kbd/consoletrans/8859-1_to_uni.trans || die # now provided by >= busybox-1.30.1 # # install nologin program # minstalldir /usr/sbin || die # minstallexec nologin /usr/sbin/nologin || die # install unimaps directory and a README to suppress warning messages by dracut minstalldir /usr/share/kbd/unimaps || die MCONFIG=/usr/share/kbd/unimaps/README mclearconfig || die maddconfig '# This directory only exist for compatibility reasons' || die # install login.defs to satisfy meson minstalldir /etc || die MCONFIG=/etc/login.defs mclearconfig || die maddconfig '# This file only exist for compatibility reasons' || die } postinstall() { if [ -x ${MROOT}/usr/bin/busybox ] then echo "Setting suid bit for ${MROOT}/usr/bin/busybox" chmod +s ${MROOT}/usr/bin/busybox fi if [ -f ${MROOT}/usr/share/busybox/busybox.links ] then echo "Setting up busybox links ... " local i for i in $(< ${MROOT}/usr/share/busybox/busybox.links) do ln -snf /usr/bin/busybox ${MROOT}/${i} done fi }