# Maintainer: Natanael Copa pkgname=busybox pkgver=1.19.4 pkgrel=4 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" license="GPL-2" depends= install="$pkgname.post-install $pkgname.post-upgrade" subpackages="$pkgname-static" 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 busybox-uname-is-not-gnu.patch bb-app-location.patch 0001-loginutils-use-sha512.patch acpid.patch busybox-mkdir-permissions-64bit.patch 0001-acpid-do-not-install-handlers-for-fatal-signals.patch 0001-grep-support-for-x-match-whole-line.patch 0001-tar-Implement-no-recursion.patch 0001-unzip-ignore-chmod-errors-so-unzipping-on-FAT-works.patch 0001-ifupdown-support-metric-for-static-default-gw.patch busyboxconfig" _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:-gcc} $CFLAGS "$srcdir"/bbsuid.c $LDFLAGS -o "$_dyndir"/bbsuid || return 1 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 make -C "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 mv busybox busybox.static # build dynamic cd "$_dyndir" msg "Building dynamic busybox" cp "$_config" .config make -C "$_sdir" O="$PWD" silentoldconfig || return 1 make || return 1 } 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 install -m4111 bbsuid "$pkgdir"/bin/bbsuid || return 1 # we need /bin/sh to be able to execute post-install ln -s /bin/busybox "$pkgdir"/bin/sh } static() { pkgdesc="Statically linked Busybox" mkdir -p "$subpkgdir"/bin install -m755 "$_staticdir"/busybox.static \ "$subpkgdir"/bin/busybox.static } md5sums="9c0cae5a0379228e7b55e5b29528df8e busybox-1.19.4.tar.bz2 b7b06c7d5cff6935e4ff68a245cc64b5 bbsuid.c d64b58a30892c558bdbab7f0d0997577 nologin.c 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch 754916e52fa11d3fe7c29c93248b6707 bb-app-location.patch 784383013b8f015fb0d214618c46b4b8 0001-loginutils-use-sha512.patch 361a26d690e6f1585c6710b3afeb10a6 acpid.patch 78bb1e70897124a0e09d50c425210e83 busybox-mkdir-permissions-64bit.patch cfafb917f777437f428ea97da0a63915 0001-acpid-do-not-install-handlers-for-fatal-signals.patch 699701047d05468a13e5c37b5ebc3824 0001-grep-support-for-x-match-whole-line.patch b0977368029587bab23067f0267ae309 0001-tar-Implement-no-recursion.patch d13491d62d8987f79c385f6fdd94836a 0001-unzip-ignore-chmod-errors-so-unzipping-on-FAT-works.patch ce7fcd5eee5b0e9bf67108b241c09ea2 0001-ifupdown-support-metric-for-static-default-gw.patch 42e2f49483e650193c0e142ade7de142 busyboxconfig"