# Maintainer: Natanael Copa pkgname=busybox pkgver=1.18.3 pkgrel=3 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 $pkgname-1.11.1-bb.patch busybox-uname-is-not-gnu.patch busybox-1.18.3-wget.patch loginutils-sha512.patch busyboxconfig" _builddir="$srcdir"/$pkgname-$pkgver _config="$srcdir"/busyboxconfig prepare() { cd "$_builddir" #patches for i in ../*.patch; do msg "Applying $i" if ! patch -p1 -i $i; then error "$i failed" return 1 fi done sed -i -e 's/(ip, _BB_DIR_BIN/(ip, _BB_DIR_SBIN/' \ -e 's/(lspci, _BB_DIR_USR_BIN/(lspci, _BB_DIR_USR_SBIN/' \ -e 's/(vi, _BB_DIR_BIN/(vi, _BB_DIR_USR_BIN/' \ -e 's/(install, _BB_DIR_USR_BIN/(install, _BB_DIR_BIN/' \ include/applets.src.h || return 1 } build() { cd "$_builddir" msg "Building static busybox" sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \ -e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \ "$_config" > .config make silentoldconfig || return 1 make || return 1 mv busybox busybox.static # build dynamic msg "Building dynamic busybox" cp "$_config" .config make silentoldconfig || return 1 make || return 1 } package() { cd "$_builddir" 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 # we need /bin/sh to be able to execute post-install ln -s /bin/busybox "$pkgdir"/bin/sh } static() { triggers= mkdir -p "$subpkgdir"/bin install -m755 "$_builddir"/busybox.static \ "$subpkgdir"/bin/busybox.static } md5sums="660af4d44661d32b22025a66f4f78df2 busybox-1.18.3.tar.bz2 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch b5375210f13fd6e1ca61a565e8fabd35 busybox-uname-is-not-gnu.patch abe065069fed8458eedbdad48c115e1f busybox-1.18.3-wget.patch d21d70d590e9e04bfc65ecb23b9d1617 loginutils-sha512.patch 181310149cad8fce22aba96220cbbd38 busyboxconfig"