# Contributor: Ɓukasz Jendrysik # Maintainer: Natanael Copa pkgname=busybox pkgver=1.25.0 pkgrel=6 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" install="$pkgname.post-install $pkgname.post-upgrade" subpackages="$pkgname-static $pkgname-suid" options="suid" 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 0001-iproute-ensure-scope-is-correctly-initialised.patch 0002-set-applet-location-to-correspond-to-upstream-for-vi.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-login-move-check_securetty-to-libbb.patch 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch 0010-su-FEATURE_SU_NULLOK_SECURE.patch 0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch 0012-gzip-fix-compression-level-bug.-Closes-9131.patch 0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch 0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch 0015-diff-add-support-for-no-dereference.patch 0016-whois-make-it-actually-work.patch acpid.logrotate busyboxconfig bbsuid.c nologin.c " _sdir="$srcdir"/$pkgname-$pkgver _staticdir="$srcdir"/build-static _dyndir="$srcdir"/build-dynamic _config="$srcdir"/busyboxconfig prepare() { mkdir -p "$_staticdir" "$_dyndir" #patches cd "$_sdir" for i in $source; do local p=${i##*/} case $i in *.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;; esac done cp "$srcdir"/nologin.c loginutils/ } build() { # build bbsuid msg "Building bbsuid" ${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \ ${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid || return 1 # 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 "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 # 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 "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 mv busybox busybox.static } 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 \ || return 1 install -Dm644 "$srcdir"/acpid.logrotate \ "$pkgdir/etc/logrotate.d/acpid" || return 1 mkdir -p "$pkgdir"/var/lib/udhcpd || return 1 install -Dm644 "$_sdir"/examples/udhcp/udhcpd.conf \ "$pkgdir"/etc/udhcpd.conf || return 1 cat >"$pkgdir"/etc/securetty <