# Maintainer: Natanael Copa pkgname=busybox pkgver=1.16.2 pkgrel=2 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net 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 diff.patch flock-bb.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/(vi, _BB_DIR_BIN/(vi, _BB_DIR_USR_BIN/' \ include/applets.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="2ba980f720a5bdce4ec05423519acc35 busybox-1.16.2.tar.bz2 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch 5ce533f9727761c31de5b5f9df568f2f diff.patch 20d9beea7d0c0aaca14553a8f98fee12 flock-bb.patch 4bc85af9dd659cbb83c9a819b3481a47 busyboxconfig"