# Contributor: Ɓukasz Jendrysik # Maintainer: Natanael Copa pkgname=busybox pkgver=1.24.1 pkgrel=8 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" license="GPL2" makedepends="linux-headers" 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 bbsuid.c nologin.c $pkgname-1.11.1-bb.patch bb-app-location.patch loginutils-sha512.patch udhcpc-discover-retries.patch busybox-1.24.1-unzip.patch busybox-1.24.1-unzip-regression.patch 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch 0001-diff-add-support-for-no-dereference.patch 1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch 1001-fbsplash-support-console-switching.patch 1002-fbsplash-support-image-and-bar-alignment-and-positio.patch 2001-modutils-merge-module_entry-and-module_info-to-commo.patch 2002-depmod-support-generating-kmod-binary-index-files.patch 2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch 3001-login-move-check_securetty-to-libbb.patch 3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch 3003-su-FEATURE_SU_NULLOK_SECURE.patch 0001-ash-backport-fix-for-here-document-issues.patch 0001-ash-fix-error-during-recursive-processing-of-here-do.patch acpid.logrotate busyboxconfig glibc.patch" _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 <