# Contributor: Ɓukasz Jendrysik # Contributor: Oliver Smith # Maintainer: Natanael Copa pkgname=busybox pkgver=1.28.2 pkgrel=3 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" license="GPL-2.0" makedepends_build="" makedepends_host="linux-headers" makedepends="$makedepends_build $makedepends_host" checkdepends="zip" provides="/bin/sh" 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-add-support-for-command_not_found_handle-hook-fu.patch 0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch 0003-ash-exec-busybox.static.patch 0004-app-location-for-cpio-vi-and-lspci.patch 0005-udhcpc-set-default-discover-retries-to-5.patch 0006-ping-make-ping-work-without-root-privileges.patch 0007-fbsplash-support-console-switching.patch 0008-fbsplash-support-image-and-bar-alignment-and-positio.patch 0009-depmod-support-generating-kmod-binary-index-files.patch 0010-Add-flag-for-not-following-symlinks-when-recursing.patch 0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch 0012-udhcpc-Don-t-background-if-n-is-given.patch 0013-testsuite-fix-cpio-tests.patch 0014-miscutils-microcom-Fixed-segfault.patch 0015-ash-introduce-a-config-option-to-search-current-dire.patch 0016-top-handle-much-larger-VSZ-values.patch 0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch fix-cpio-symlinks.patch 0001-grep-fix-echo-aa-busybox-grep-F-w-a-should-not-match.patch acpid.logrotate busyboxconfig busyboxconfig-extras bbsuid.c dad.if-up nologin.c " # secfixes: # 1.27.2-r4: # - CVE-2017-16544 # - CVE-2017-15873 # - CVE-2017-15874 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 <