# Contributor: Ɓukasz Jendrysik # Contributor: Oliver Smith # Maintainer: Natanael Copa pkgname=busybox pkgver=1.27.0 pkgrel=0 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" license="GPL2" makedepends_build="" makedepends_host="linux-headers" makedepends="$makedepends_build $makedepends_host" checkdepends="zip" install="$pkgname.post-install $pkgname.post-upgrade $pkgname-extras.post-install $pkgname-extras.pre-deinstall" subpackages="$pkgname-static $pkgname-suid $pkgname-extras" options="suid !check" triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*" source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 0001-ash-exec-busybox.static.patch 0002-app-location-for-cpio-vi-and-lspci.patch 0003-udhcpc-set-default-discover-retries-to-5.patch 0004-ping-make-ping-work-without-root-privileges.patch 0005-fbsplash-support-console-switching.patch 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch 0007-depmod-support-generating-kmod-binary-index-files.patch 0008-diff-add-support-for-no-dereference.patch 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch 0010-udhcpc-Don-t-background-if-n-is-given.patch 0011-testsuite-fix-cpio-tests.patch acpid.logrotate busyboxconfig busyboxconfig-extras bbsuid.c dad.if-up nologin.c " builddir="$srcdir"/$pkgname-$pkgver _staticdir="$srcdir"/build-static _dyndir="$srcdir"/build-dynamic _dyndir_extras="$srcdir"/build-dynamic-extras _config="$srcdir"/busyboxconfig _config_extras="$srcdir"/busyboxconfig-extras prepare() { default_prepare cd "$builddir" mkdir -p "$_staticdir" "$_dyndir" "$_dyndir_extras" cp "$srcdir"/nologin.c loginutils/ } build() { # build bbsuid msg "Building bbsuid" ${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \ ${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid # build dynamic cd "$_dyndir" msg "Building dynamic busybox" cp "$_config" .config [ "$CLIBC" = musl ] && sed -i \ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \ .config make -C "$builddir" O="$PWD" silentoldconfig make # build dynamic (extras) cd "$_dyndir_extras" msg "Building dynamic busybox-extras" cp "$_config_extras" .config [ "$CLIBC" = musl ] && sed -i \ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \ .config make -C "$builddir" O="$PWD" silentoldconfig make # build static cd "$_staticdir" msg "Building static busybox" sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \ -e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \ "$_config" > .config # musl does not support GNU regex [ "$CLIBC" = musl ] && sed -i \ -e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \ .config make -C "$builddir" O="$PWD" silentoldconfig make mv busybox busybox.static } check() { cd "$_dyndir" SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check cd "$_dyndir_extras" SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check } package() { cd "$_dyndir" mkdir -p "$pkgdir"/usr/sbin "$pkgdir"/usr/bin "$pkgdir"/tmp \ "$pkgdir"/var/cache/misc "$pkgdir"/bin "$pkgdir"/sbin chmod 1777 "$pkgdir"/tmp install -m755 busybox "$pkgdir"/bin/busybox || return 1 # we need /bin/sh to be able to execute post-install ln -s /bin/busybox "$pkgdir"/bin/sh #ifupdown needs those dirs to be present mkdir -p \ "$pkgdir"/etc/network/if-down.d \ "$pkgdir"/etc/network/if-post-down.d \ "$pkgdir"/etc/network/if-post-up.d \ "$pkgdir"/etc/network/if-pre-down.d \ "$pkgdir"/etc/network/if-pre-up.d \ "$pkgdir"/etc/network/if-up.d install -m775 "$srcdir"/dad.if-up "$pkgdir"/etc/network/if-up.d/dad install -Dm644 "$srcdir"/acpid.logrotate \ "$pkgdir/etc/logrotate.d/acpid" mkdir -p "$pkgdir"/var/lib/udhcpd install -Dm644 "$builddir"/examples/udhcp/udhcpd.conf \ "$pkgdir"/etc/udhcpd.conf cat >"$pkgdir"/etc/securetty <