summaryrefslogtreecommitdiff
path: root/sys-apps/busybox
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-apps/busybox
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-apps/busybox')
-rw-r--r--sys-apps/busybox/Manifest27
-rw-r--r--sys-apps/busybox/busybox-1.25.1.ebuild302
-rw-r--r--sys-apps/busybox/busybox-1.26.2-r1.ebuild310
-rw-r--r--sys-apps/busybox/busybox-1.27.2.ebuild310
-rw-r--r--sys-apps/busybox/busybox-9999.ebuild308
-rw-r--r--sys-apps/busybox/files/busybox-1.19.0-bb.patch22
-rw-r--r--sys-apps/busybox/files/busybox-1.25.1-setfiles.patch34
-rw-r--r--sys-apps/busybox/files/busybox-1.26.2-bb.patch55
-rw-r--r--sys-apps/busybox/files/ginit.c124
-rw-r--r--sys-apps/busybox/files/klogd.confd9
-rw-r--r--sys-apps/busybox/files/klogd.initd11
-rw-r--r--sys-apps/busybox/files/mdev.initd52
-rw-r--r--sys-apps/busybox/files/mdev/dvbdev18
-rw-r--r--sys-apps/busybox/files/mdev/ide_links23
-rw-r--r--sys-apps/busybox/files/mdev/usbdev62
-rw-r--r--sys-apps/busybox/files/mdev/usbdisk_link34
-rw-r--r--sys-apps/busybox/files/ntpd.confd6
-rw-r--r--sys-apps/busybox/files/ntpd.initd12
-rw-r--r--sys-apps/busybox/files/syslogd.confd9
-rw-r--r--sys-apps/busybox/files/syslogd.initd12
-rw-r--r--sys-apps/busybox/files/watchdog.confd9
-rw-r--r--sys-apps/busybox/files/watchdog.initd7
-rw-r--r--sys-apps/busybox/metadata.xml19
23 files changed, 1775 insertions, 0 deletions
diff --git a/sys-apps/busybox/Manifest b/sys-apps/busybox/Manifest
new file mode 100644
index 000000000000..9b4ea245c562
--- /dev/null
+++ b/sys-apps/busybox/Manifest
@@ -0,0 +1,27 @@
+AUX busybox-1.19.0-bb.patch 908 SHA256 98f92c2edbcf61d1bacef783ea8b08cce07051b0a4489ed3f4579296846f89f1 SHA512 d4024e531ce7113cf554646608b1ef356e51691e3e21d165621b3690c82b56a319867b90d9daba548b635d9dbd41be5efea63181b7123d4505e529d863a8214c WHIRLPOOL b0d6d9b08ad0930e5243c7addc8a6db61505e95ed8e72c64fbfd734cb6ff9e303b3eb8ea6ec4790b2be567783664230cf278eb3e673fa0844c3881cf993f7cb8
+AUX busybox-1.25.1-setfiles.patch 1153 SHA256 bd0f75f3d3eeab0d140cd7497617875330b5f70de14c04b78047e76aa1c08611 SHA512 2b3b4aba3be49437b1875ce00887e385abae275cc269ca0e80af797a6a6acfa2f20ea4bcf195e67490d8fe691c1ca7493adbf7e097bd4f6f0e1d7e07e493dca4 WHIRLPOOL 9442abafe26be8a1b2e60b81df2446957e6d135f2d7038ea71eba55f10e1ed3677743d93b2ffd7a1977d214d7ec3916ca4ec40c9cd46d16f5ba47ea3198357ec
+AUX busybox-1.26.2-bb.patch 2416 SHA256 260bc0e35c808fc71d73982adb29161c2649b76ed0afa23b66f148c6ebf09d95 SHA512 cb767a613ede504a7b1a87da3270992ffa44d3b6f76eebefceffc8a5a49119a99333c482420efab9d1e5a92a26280376c7e9ec62fcb2193d9172f4e7bc19f50e WHIRLPOOL 31a9278cad767fcf455b45ccf756f5e69e79f0d4ccafb4d8d42317e1226b638ce4df8df19d0497925e54bf8a145f1ac562f5650678bd715018d99407f1a36042
+AUX ginit.c 3097 SHA256 fd6a4715d3dd10f6db479020433da3997d397658301335c847fb779129238b8c SHA512 8bf70f13db0fbeecedf9a9f862c5391c0d8b7aa3ddd2ec85cda9b360c3117a01e32b01017b8c30197f587e521ba360ff70d1caf8d0f69d5c3a27f37ecc252e7c WHIRLPOOL a1ec3ccc296033d88a9504b693c7d249d0bd11b1d75e3f59a62137c5e4b4c914fe2b8971c86dbca2cc8ccc0d86f3f8c2c45bb44cec85a3628c44f091476baa92
+AUX klogd.confd 218 SHA256 737b78745964e110da2fd3357c6d5fb80ccacf979039b8d40c03cf1cb969e5f3 SHA512 3348d5376b368b28d1431692a93868cd4550be12ad729340c5f78da35a5bd295e7613d70ce8ccde5029ad6d87a41c2f24155180f3570de8a9174dd63dece143f WHIRLPOOL ea28c1d926e36fba0ab69de8ddfd2503889b7cfa3a4ada347a9d22d9894fe30be068c0ed55f899b952e62b8de3cb69e1a4209f7864787988ded28ede10c7445a
+AUX klogd.initd 245 SHA256 c8d6f43e5b658eeb54892fea21c0afaa15447e903c55c3bd3d011773f20bb773 SHA512 6c28b5f2db40eeeae14f859f56a5e4f96a034b69639f38da3a437eabd1f74f61240b87eac2f7e5ca9a3377ceb9a37e939ab69b7db6a70c962062e5ae29f7e835 WHIRLPOOL 949802460f708c3db1633fa4e070aa01c243912b437c3999e9c22887d8111195efc1b9f29cfcaeaa6ee5e5ccdd7fb37f89c5ebb3f035388a6ea0d8b5e5f611e2
+AUX mdev.initd 869 SHA256 1ad1fb4d9d92e804a4042ec27534970351516ac5d4367e759a77de8b9f6208f6 SHA512 d7c7074384e8fcc6c8e7e55f94103bc575b101426ed8012a352546e8c741e90dd224869a9308a29e21491021d4372a4fab73c0f0d4453c6a53ea8ae537ca8e7a WHIRLPOOL a401aee17e7359582261ddca204336bbd0d1b5d5b217c3a587e20298af05c094e967f234eee5964a0402c3d4f0a2fdfef228f2a4328d5e6b05f14e10933876b5
+AUX mdev/dvbdev 356 SHA256 ef091bb4c8943a99b9a97b556cdc15ddd20275f5afa8287e201419b08c4e71de SHA512 ebd82f935da2ca89097234dd8a8f47e179a423652c151123a1f3343f3e1e7bfaba2b8800380e988d4e8f4294545d3a9ab6708ae2e77c5b108b5f091bbce8f94a WHIRLPOOL ec24a4afe8333e2d4d856fe3853b844d113057daf3fe536a4c8ef481a5ec925254c7daeb09df378922fabb96400440f4bde40979417b7c35467934d7e2235739
+AUX mdev/ide_links 440 SHA256 3fccc9ee437e3dcc8ac73bfe3713334a7156a112fe442e052fff4f26ff0f6a88 SHA512 0142234d0bda86ad1e5f88f1da34669e5fda46a0fd52ce507bd49ce74d2b7c12c323e8db863bccb924e6d632b568db8b243361b217c5b2e1d92a25feb6e62dec WHIRLPOOL ce02358a65ad2beeab12485379e322736c7b6b58ff44a20b880d9bab8806e04890a385b94228f2db685150dfe0a3c716f842ce5c1c7f579c8208ab4e9a6ae852
+AUX mdev/usbdev 1624 SHA256 113ecaa722fa1f4e1c76489e2a7b24099778615a5bccd443aa9cbab28c6d05d0 SHA512 f2d98050eeeb2fbb299298e221f47182a74ed901d2c8c848aa297ebd461c62c30d2fb968bb3eb723a6d9c268fac4a3c40a18aa59ed934043d42c38a1f6b9f5a2 WHIRLPOOL 9b773cb41827bf5777061ec7ed432315bc5bf070768a44ceec7c893af2266d8c06ea4c061711b2696a8228d72c7222fbf52d26fb92b4112158716727b3bc1e38
+AUX mdev/usbdisk_link 984 SHA256 c72cdf4bfde9a8f8334a9d6bfce2a468c926a5530532b8a16a13a63d798abeb3 SHA512 05bc589f067cf988f97f10def3c05e139ac4f4ebe045bdb4c2f5453f5e672bf61d3dc1636974c5680c8c9cf22498bee9cfa28a8f4a264d9f5b10a72a9da0ca16 WHIRLPOOL 03f71c6ce87ea19d9b78615e06adbb5ad73e05b2e3dd69d28092df5e961aea2d06db6c97389d000d20b42b0df241a5e8a7f23056d0f40c5cde0557ce7fdf1fcc
+AUX ntpd.confd 186 SHA256 4bff7f5c66f4eece52e4381fd2706e591f10eb50f3c3a4132344d34150dc54de SHA512 b0ef111ea7dd6a096acf711d2d84a7c3d38e7e8c181f734053d38c565ab44ecf843ef32c0de0c4e7ecec990e97468a2545f83821beedb125cd6723ed74c67ad8 WHIRLPOOL a1b228ae22c61de6ecc7fa58edcd4c3941b3762a45fcc38d05bd1c9428bc553b1a158c101d65a99ba63d4bc19b269e834b3f0eba40a5a1c81e0ae876a2ecb42c
+AUX ntpd.initd 259 SHA256 50ebc260adc5fafa283039ed44ccab7d81762470b33c3876e1b4f66e3883c6b6 SHA512 bdae71e811af7165f014bd9a918824ee1b0c68df78f3457296d6be36e85c5e6d813610979f6d6b9af3c9e2fd4c95a451a63900461a948cbe88d7b6e3201cf03a WHIRLPOOL d0caae91e26f55afbdcff890cce38d2d2b5be45efbc7a4fe958a31741aba68b35f6b698c50c8f71f6a45315e0dff5e3f2a792d51d3d41ba59e4e1eb4e801a385
+AUX syslogd.confd 234 SHA256 65166088cb173582200b8c0d3bc6ea339b5929dbafa816780bfaf50e3514bc25 SHA512 01a2ecf89c49e3e06dd1b6f6673fca16d0f2dd01ff27c0d609c803bc2c81b5ced8245b6388e48ffa2f05ff4e8c1824af73df6364bbebebc722166447bd412f52 WHIRLPOOL b0a9e82225968d44446025242ac6c9429dc2e01a3720d94349756f71ec3a11c3ff2217bce7c4f1a1ea8a2a8baecd3265c3cce01675138674c05a9f2a96ade2ae
+AUX syslogd.initd 267 SHA256 e8dff11a6756650efccd7071331462026d3b1f3008a0f2d08c82654a70052eb7 SHA512 856dd97ed46b08fdd13e497737f1eb192594e33bfc5d395d7ca6eed2e6bc212cf0cf33518b36a6f9a18d6962d462430c7b50c07e9dc08e85606ef68b240b1211 WHIRLPOOL 5d91dab5443c3555a34b27d1a9f921fdf957d3ce97c7c85e9ceeab503f281b5edd6fb465a94c8979d796db3822ce965f4fa75f49ed513f1f2878301f6e2e2a7b
+AUX watchdog.confd 232 SHA256 786d9497ad55c29d6fff231709e71ecad94f2ee1de3b45b461deb29c3eba1c63 SHA512 8fd7121075535195f3e5d43ec773713c883fb7865cd5e5927b3b20c2605c50acb81d50461bd1a246c1282006ce74b11932ac1cec67ddc2be15da2f9aa8674232 WHIRLPOOL 8ea0f6b759198c978f10bf0b2b00cc73343e72401a05edf257b9c5e1032e8a619328aaa02936b5b5a717a021baa84b5653b8c9826e14e5c07c7b7af98f878767
+AUX watchdog.initd 219 SHA256 68831d9e8c460a605f20c2e476ff6f80dcf977412e509f4fcb5ee1f4f3b5d813 SHA512 d329fb72ce078a95a1fb77b72321dee56d19c76b45cb78a7a57a46d9fa385b982a114be49dd8696c2d4fc2b2dd90a17ee728ef2938172cc2f8b12b5a9ebd62f5 WHIRLPOOL 69de35443fb58b3188b026787ded43997ca9fb6cafe6d971e72546d9fed4b17eef635fc400d2b3ee1a918eadb8e1dedc051e616f8d418687a8a933dd67865f4b
+DIST busybox-1.25.1.tar.bz2 2103070 SHA256 27667e0f2328fdbd79cfd622e4453e5c57e58f781c5da97c9be337d93aa2a02e SHA512 9648877ed11e5a55213cd14fd64f6fc64dbd17013fbfaa4e67f4fd433f59e9231ed78a88e6e8100a4794d833f1d9863bb86f75faae093418866770804bf873cb WHIRLPOOL 4b7bc6d3a88559812797feb4574975b9fdeb6eac6ac7a0fe51e4750a3b05a614ecb8bd9d58547047cdf1e0b66d9bcd189c8a4193fc2f3b491a6268bc06761ad1
+DIST busybox-1.26.2.tar.bz2 2120931 SHA256 da3e44913fc1a9c9b7c5337ea5292da518683cbff32be630777f565d6036af16 SHA512 9926d211d0b4f34b513d934d7b111ebbf933c2dc31206bdd80426a62d47d5b1475b70bec5aaa14a26b94a202ab1465d994062a002750a312dcb8167096eb3719 WHIRLPOOL 64fdbd3ede8e382d0237b1576000555f563c4ca93d58cfbb72f71374b662e3201863110a069f0e4a27dab7c0a6102d98ccfd4d57f1dfe44c9b12a17c6a30128a
+DIST busybox-1.27.2.tar.bz2 2216527 SHA256 9d4be516b61e6480f156b11eb42577a13529f75d3383850bb75c50c285de63df SHA512 d99e86b652562ebe1a5d50e1ba3877a1d1612997c17cb8d8e4212da181211a9b741a881cb051f14cb3ee8aea40226cf2cde80a076baed265d3bc0a4e96a5031c WHIRLPOOL 56002a144710aa00ee17c46e3ac471537f58bee6b9d4da6cefc0afb4f75cf13dcaaadf1e6610d0e10c7b808b0c33c24743e21c683c478582eb0eb149a869f9a7
+EBUILD busybox-1.25.1.ebuild 8597 SHA256 0fef93c8aa0e1113692b573e57fc4628a159ee6fb7ef8e5e48b13a99a7163ee7 SHA512 40c4af782f391f44a05bdde056c1c3d8935369dbfdad7b464f6883c4a4f82a4dc821427f7109da73a703891c0cb5ed65723c0b2c373fdf54155e7fafcb58553f WHIRLPOOL 3f8d150c427e33e7cddefae359f68d4c50ea90e956149caa77d920a9ed98253c91fce44a227f2f882e26114d3d55b357ec83a80783cb32486d5c7c12193bceb3
+EBUILD busybox-1.26.2-r1.ebuild 8934 SHA256 72fce1366ca66f62e303fe553bf7c1c2c27be5d610f824f6e7daeac85c14c4d5 SHA512 d5320f05e15b3b62e720d0fab274575a4ce4c18eca66b811e271c3dd7bafe2bcf9160fcb32d14a36849904f79623b9c1f4817029e813c51f2ef1aecb04375737 WHIRLPOOL c012e41cede84bbd8545c16d4002f94dfb7b7eda0ff4dd166fdb2cd4e05a226c2e92b028be2fd2c51d8fee736d9e20e0300527939faa66d6223d4f041ee900e6
+EBUILD busybox-1.27.2.ebuild 8934 SHA256 fea7b4aa2f0d1e0bd33640f1062a0fba7c86966c403ef010c84d9a6425648483 SHA512 28543dc9a553778bdcf7dbae63cd4a726a326bd679658f634927a12a8008d2fb2f421acbb734fb780163773d55ba7f5afe4d6d63abcd9124d273c0bd2a3bb534 WHIRLPOOL 8e13c61f69e6ff94a5141a5853c9eda3de4adc018f0fecc9370bc6009d9038dc5ead47a89f7d15bd5ef25f7e7dad9a5d8afafbfb9c00ef6605940bdccd94ae51
+EBUILD busybox-9999.ebuild 8865 SHA256 5891e846d5b0e5617029492e9d45d13ac684e21b37c4f2175a02081a26b3566c SHA512 e7d943086a26ec8ad53f37b08fb71a50106fa35fdcd7e45770f47ad8c0d05ff9a66e9b3aa4bfeb3008c2dd91c30a7bcab7f6f3c9f33608d2fb67e2b79451e13c WHIRLPOOL 949c8527b5b87b087228475f33a1c997a40b7a964f3bff178292b252621c728719d00cd702b10ac3ec742b69fc3213b6eac7ce606598737fd5ed1dd54f0a1fef
+MISC ChangeLog 11845 SHA256 bf23cb00b0102d42a4a4d190c674ca006b3912811913c93f53f1be519c4245a2 SHA512 c05fe5d0c3950c0f5ff6a280c35e512656d5215dbd52e13c10c64092f58a8cc89e36f13a24ec1c3c2daaef340b1ae7861893a749d859681934fd34d16be5c2fd WHIRLPOOL 0cf472cde38d4a7ed817ce5e9217ef4391a314fbdf3f1c7746edb9ad89547c9db43f5ff78d426e790cf08aa054066d3d8108786d5c61f3f5de3382fef9955e23
+MISC ChangeLog-2015 60228 SHA256 f2b582e8a11ce92972cd2a2d6ff2a70bd5d853f722532c40e645e376d48df9d9 SHA512 57ca645c150c17f0d952c36dfe6cfc5c69d1432a986702e335fdbd5ada4e536798b34e4d8cbd457d4ea0064b105cba325c1c9e01be04883001ae9201008ff0b9 WHIRLPOOL 47a4f86ad298c4e8e593a7965b7c5ceecdaa0f02bef45a9d6bc9ace96ae3e5ff3e186fe5652f44a89e282cd2de455e5643c7cbd3130ef9bddb059635b7120eb8
+MISC metadata.xml 872 SHA256 1cf483a8d55e8cbe20edb30261276d71e0ba0a1b06d73621f849496d1f6c4a17 SHA512 c0b3f8b9348553d8a4db25c1c51ef5a82bcd14a09251568c0709b392e2dea9bc35dced96377d11a32ad53ba09052603781caebf754428debf7acb0aaedafbf07 WHIRLPOOL 91b126a39ecd6937e6058814b88043e9fbbf7b434854e25a4e4a7ad8e666de37978b8bac0c8dca0255096a42af9afed412bb5bbccdffaf03ba75c2fd2e4b3428
diff --git a/sys-apps/busybox/busybox-1.25.1.ebuild b/sys-apps/busybox/busybox-1.25.1.ebuild
new file mode 100644
index 000000000000..373d932ae1a4
--- /dev/null
+++ b/sys-apps/busybox/busybox-1.25.1.ebuild
@@ -0,0 +1,302 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
+
+EAPI="5"
+inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+HOMEPAGE="https://www.busybox.net/"
+if [[ ${PV} == "9999" ]] ; then
+ MY_P=${PN}
+ EGIT_REPO_URI="git://busybox.net/busybox.git"
+ inherit git-2
+else
+ MY_P=${PN}-${PV/_/-}
+ SRC_URI="https://www.busybox.net/downloads/${MY_P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+LICENSE="GPL-2" # GPL-2 only
+SLOT="0"
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd"
+REQUIRED_USE="pam? ( !static )"
+RESTRICT="test"
+
+COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
+ pam? ( sys-libs/pam )"
+DEPEND="${COMMON_DEPEND}
+ static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
+ >=sys-kernel/linux-headers-2.6.39"
+RDEPEND="${COMMON_DEPEND}
+ mdev? ( !<sys-apps/openrc-0.13 )"
+
+S=${WORKDIR}/${MY_P}
+
+busybox_config_option() {
+ local flag=$1 ; shift
+ if [[ ${flag} != [yn] ]] ; then
+ busybox_config_option $(usex ${flag} y n) "$@"
+ return
+ fi
+ while [[ $# -gt 0 ]] ; do
+ if [[ ${flag} == "y" ]] ; then
+ sed -i -e "s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" .config
+ else
+ sed -i -e "s:CONFIG_$1=y:# CONFIG_$1 is not set:g" .config
+ fi
+ einfo $(grep "CONFIG_$1[= ]" .config || echo Could not find CONFIG_$1 ...)
+ shift
+ done
+}
+
+busybox_config_enabled() {
+ local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
+ case ${val} in
+ "") return 1 ;;
+ y) return 0 ;;
+ *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
+ esac
+}
+
+src_prepare() {
+ unset KBUILD_OUTPUT #88088
+ append-flags -fno-strict-aliasing #310413
+ use ppc64 && append-flags -mminimal-toc #130943
+
+ # patches go here!
+ epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
+ epatch "${FILESDIR}"/${P}-*.patch
+ cp "${FILESDIR}"/ginit.c init/ || die
+
+ # flag cleanup
+ sed -i -r \
+ -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
+ Makefile.flags || die
+ #sed -i '/bbsh/s:^//::' include/applets.h
+ sed -i '/^#error Aborting compilation./d' applets/applets.c || die
+ use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
+ sed -i \
+ -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
+ -e "/^AR\>/s:=.*:= $(tc-getAR):" \
+ -e "/^CC\>/s:=.*:= $(tc-getCC):" \
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+ -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
+ Makefile || die
+ sed -i \
+ -e 's:-static-libgcc::' \
+ Makefile.flags || die
+}
+
+src_configure() {
+ # check for a busybox config before making one of our own.
+ # if one exist lets return and use it.
+
+ restore_config .config
+ if [ -f .config ]; then
+ yes "" | emake -j1 -s oldconfig >/dev/null
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ # setup the config file
+ emake -j1 -s allyesconfig >/dev/null
+ # nommu forces a bunch of things off which we want on #387555
+ busybox_config_option n NOMMU
+ sed -i '/^#/d' .config
+ yes "" | emake -j1 -s oldconfig >/dev/null
+
+ # now turn off stuff we really don't want
+ busybox_config_option n DMALLOC
+ busybox_config_option n FEATURE_SUID_CONFIG
+ busybox_config_option n BUILD_AT_ONCE
+ busybox_config_option n BUILD_LIBBUSYBOX
+ busybox_config_option n FEATURE_CLEAN_UP
+ busybox_config_option n MONOTONIC_SYSCALL
+ busybox_config_option n USE_PORTABLE_CODE
+ busybox_config_option n WERROR
+ # triming the BSS size may be dangerous
+ busybox_config_option n FEATURE_USE_BSS_TAIL
+
+ # If these are not set and we are using a uclibc/busybox setup
+ # all calls to system() will fail.
+ busybox_config_option y ASH
+ busybox_config_option n HUSH
+
+ # disable ipv6 applets
+ if ! use ipv6; then
+ busybox_config_option n FEATURE_IPV6
+ busybox_config_option n TRACEROUTE6
+ busybox_config_option n PING6
+ busybox_config_option n UDHCPC6
+ fi
+
+ busybox_config_option pam PAM
+ busybox_config_option static STATIC
+ busybox_config_option syslog {K,SYS}LOGD LOGGER
+ busybox_config_option systemd FEATURE_SYSTEMD
+ busybox_config_option math FEATURE_AWK_LIBM
+
+ # all the debug options are compiler related, so punt them
+ busybox_config_option n DEBUG_SANITIZE
+ busybox_config_option n DEBUG
+ busybox_config_option y NO_DEBUG_LIB
+ busybox_config_option n DMALLOC
+ busybox_config_option n EFENCE
+ busybox_config_option $(usex debug y n) TFTP_DEBUG
+
+ busybox_config_option selinux SELINUX
+
+ # this opt only controls mounting with <linux-2.6.23
+ busybox_config_option n FEATURE_MOUNT_NFS
+
+ # default a bunch of uncommon options to off
+ local opt
+ for opt in \
+ ADD_SHELL \
+ BEEP BOOTCHARTD \
+ CRONTAB \
+ DC DEVFSD DNSD DPKG{,_DEB} \
+ FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
+ FEATURE_DEVFS \
+ HOSTID HUSH \
+ INETD INOTIFYD IPCALC \
+ LOCALE_SUPPORT LOGNAME LPD \
+ MAKEMIME MKFS_MINIX MSH \
+ OD \
+ RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
+ SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
+ TASKSET TCPSVD \
+ RPM RPM2CPIO \
+ UDPSVD UUDECODE UUENCODE
+ do
+ busybox_config_option n ${opt}
+ done
+
+ emake -j1 oldconfig > /dev/null
+}
+
+src_compile() {
+ unset KBUILD_OUTPUT #88088
+ export SKIP_STRIP=y
+
+ emake V=1 busybox
+}
+
+src_install() {
+ unset KBUILD_OUTPUT #88088
+ save_config .config
+
+ into /
+ dodir /bin
+ if use sep-usr ; then
+ # install /ginit to take care of mounting stuff
+ exeinto /
+ newexe busybox_unstripped ginit
+ dosym /ginit /bin/bb
+ dosym bb /bin/busybox
+ else
+ newbin busybox_unstripped busybox
+ dosym busybox /bin/bb
+ fi
+ if use mdev ; then
+ dodir /$(get_libdir)/mdev/
+ use make-symlinks || dosym /bin/bb /sbin/mdev
+ cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
+
+ exeinto /$(get_libdir)/mdev/
+ doexe "${FILESDIR}"/mdev/*
+
+ newinitd "${FILESDIR}"/mdev.initd mdev
+ fi
+ if use livecd ; then
+ dosym busybox /bin/vi
+ fi
+
+ # add busybox daemon's, bug #444718
+ if busybox_config_enabled FEATURE_NTPD_SERVER; then
+ newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
+ newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
+ fi
+ if busybox_config_enabled SYSLOGD; then
+ newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
+ newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
+ fi
+ if busybox_config_enabled KLOGD; then
+ newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
+ newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
+ fi
+ if busybox_config_enabled WATCHDOG; then
+ newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
+ newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
+ fi
+ if busybox_config_enabled UDHCPC; then
+ local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
+ exeinto "${path%/*}"
+ newexe examples/udhcp/simple.script "${path##*/}"
+ fi
+ if busybox_config_enabled UDHCPD; then
+ insinto /etc
+ doins examples/udhcp/udhcpd.conf
+ fi
+
+ # bundle up the symlink files for use later
+ emake DESTDIR="${ED}" install
+ rm _install/bin/busybox
+ # for compatibility, provide /usr/bin/env
+ mkdir -p _install/usr/bin
+ ln -s /bin/env _install/usr/bin/env
+ tar cf busybox-links.tar -C _install . || : #;die
+ insinto /usr/share/${PN}
+ use make-symlinks && doins busybox-links.tar
+
+ dodoc AUTHORS README TODO
+
+ cd docs
+ docinto txt
+ dodoc *.txt
+ docinto pod
+ dodoc *.pod
+ dohtml *.html
+
+ cd ../examples
+ docinto examples
+ dodoc inittab depmod.pl *.conf *.script undeb unrpm
+}
+
+pkg_preinst() {
+ if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
+ ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
+ ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
+ ewarn "If you are creating a binary only and not merging this is probably ok."
+ ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
+ die "silly options will destroy your system"
+ fi
+
+ if use make-symlinks ; then
+ mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
+ fi
+}
+
+pkg_postinst() {
+ savedconfig_pkg_postinst
+
+ if use make-symlinks ; then
+ cd "${T}" || die
+ mkdir _install
+ tar xf busybox-links.tar -C _install || die
+ cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
+ fi
+
+ if use sep-usr ; then
+ elog "In order to use the sep-usr support, you have to update your"
+ elog "kernel command line. Add the option:"
+ elog " init=/ginit"
+ elog "To launch a different init than /sbin/init, use:"
+ elog " init=/ginit /sbin/yourinit"
+ elog "To get a rescue shell, you may boot with:"
+ elog " init=/ginit bb"
+ fi
+}
diff --git a/sys-apps/busybox/busybox-1.26.2-r1.ebuild b/sys-apps/busybox/busybox-1.26.2-r1.ebuild
new file mode 100644
index 000000000000..19d62510f287
--- /dev/null
+++ b/sys-apps/busybox/busybox-1.26.2-r1.ebuild
@@ -0,0 +1,310 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
+
+EAPI="5"
+inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+HOMEPAGE="https://www.busybox.net/"
+if [[ ${PV} == "9999" ]] ; then
+ MY_P=${PN}
+ EGIT_REPO_URI="git://busybox.net/busybox.git"
+ inherit git-2
+else
+ MY_P=${PN}-${PV/_/-}
+ SRC_URI="https://www.busybox.net/downloads/${MY_P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+LICENSE="GPL-2" # GPL-2 only
+SLOT="0"
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd"
+REQUIRED_USE="pam? ( !static )"
+RESTRICT="test"
+
+COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
+ pam? ( sys-libs/pam )"
+DEPEND="${COMMON_DEPEND}
+ static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
+ >=sys-kernel/linux-headers-2.6.39"
+RDEPEND="${COMMON_DEPEND}
+ mdev? ( !<sys-apps/openrc-0.13 )"
+
+S=${WORKDIR}/${MY_P}
+
+busybox_config_option() {
+ local flag=$1 ; shift
+ if [[ ${flag} != [yn] && ${flag} != \"* ]] ; then
+ busybox_config_option $(usex ${flag} y n) "$@"
+ return
+ fi
+ local expr
+ while [[ $# -gt 0 ]] ; do
+ case ${flag} in
+ y) expr="s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" ;;
+ n) expr="s:CONFIG_$1=y:# CONFIG_$1 is not set:g" ;;
+ *) expr="s:.*\<CONFIG_$1\>.*:CONFIG_$1=${flag}:g" ;;
+ esac
+ sed -i -e "${expr}" .config || die
+ einfo "$(grep "CONFIG_$1[= ]" .config || echo "Could not find CONFIG_$1 ...")"
+ shift
+ done
+}
+
+busybox_config_enabled() {
+ local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
+ case ${val} in
+ "") return 1 ;;
+ y) return 0 ;;
+ *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
+ esac
+}
+
+src_prepare() {
+ unset KBUILD_OUTPUT #88088
+ append-flags -fno-strict-aliasing #310413
+ use ppc64 && append-flags -mminimal-toc #130943
+
+ # patches go here!
+ epatch "${FILESDIR}"/${PN}-1.26.2-bb.patch
+# epatch "${FILESDIR}"/${P}-*.patch
+ cp "${FILESDIR}"/ginit.c init/ || die
+
+ # flag cleanup
+ sed -i -r \
+ -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
+ Makefile.flags || die
+ #sed -i '/bbsh/s:^//::' include/applets.h
+ sed -i '/^#error Aborting compilation./d' applets/applets.c || die
+ use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
+ sed -i \
+ -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
+ -e "/^AR\>/s:=.*:= $(tc-getAR):" \
+ -e "/^CC\>/s:=.*:= $(tc-getCC):" \
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+ -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
+ Makefile || die
+ sed -i \
+ -e 's:-static-libgcc::' \
+ Makefile.flags || die
+}
+
+src_configure() {
+ # check for a busybox config before making one of our own.
+ # if one exist lets return and use it.
+
+ restore_config .config
+ if [ -f .config ]; then
+ yes "" | emake -j1 -s oldconfig >/dev/null
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ # setup the config file
+ emake -j1 -s allyesconfig >/dev/null
+ # nommu forces a bunch of things off which we want on #387555
+ busybox_config_option n NOMMU
+ sed -i '/^#/d' .config
+ yes "" | emake -j1 -s oldconfig >/dev/null
+
+ # now turn off stuff we really don't want
+ busybox_config_option n DMALLOC
+ busybox_config_option n FEATURE_2_4_MODULES #607548
+ busybox_config_option n FEATURE_SUID_CONFIG
+ busybox_config_option n BUILD_AT_ONCE
+ busybox_config_option n BUILD_LIBBUSYBOX
+ busybox_config_option n FEATURE_CLEAN_UP
+ busybox_config_option n MONOTONIC_SYSCALL
+ busybox_config_option n USE_PORTABLE_CODE
+ busybox_config_option n WERROR
+ # triming the BSS size may be dangerous
+ busybox_config_option n FEATURE_USE_BSS_TAIL
+
+ # If these are not set and we are using a uclibc/busybox setup
+ # all calls to system() will fail.
+ busybox_config_option y ASH
+ busybox_config_option y SH_IS_ASH
+ busybox_config_option n HUSH
+ busybox_config_option n SH_IS_HUSH
+
+ busybox_config_option '"/run"' PID_FILE_PATH
+ busybox_config_option '"/run/ifstate"' IFUPDOWN_IFSTATE_PATH
+
+ # disable ipv6 applets
+ if ! use ipv6; then
+ busybox_config_option n FEATURE_IPV6
+ busybox_config_option n TRACEROUTE6
+ busybox_config_option n PING6
+ busybox_config_option n UDHCPC6
+ fi
+
+ busybox_config_option pam PAM
+ busybox_config_option static STATIC
+ busybox_config_option syslog {K,SYS}LOGD LOGGER
+ busybox_config_option systemd FEATURE_SYSTEMD
+ busybox_config_option math FEATURE_AWK_LIBM
+
+ # all the debug options are compiler related, so punt them
+ busybox_config_option n DEBUG_SANITIZE
+ busybox_config_option n DEBUG
+ busybox_config_option y NO_DEBUG_LIB
+ busybox_config_option n DMALLOC
+ busybox_config_option n EFENCE
+ busybox_config_option $(usex debug y n) TFTP_DEBUG
+
+ busybox_config_option selinux SELINUX
+
+ # this opt only controls mounting with <linux-2.6.23
+ busybox_config_option n FEATURE_MOUNT_NFS
+
+ # default a bunch of uncommon options to off
+ local opt
+ for opt in \
+ ADD_SHELL \
+ BEEP BOOTCHARTD \
+ CRONTAB \
+ DC DEVFSD DNSD DPKG{,_DEB} \
+ FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
+ FEATURE_DEVFS \
+ HOSTID HUSH \
+ INETD INOTIFYD IPCALC \
+ LOCALE_SUPPORT LOGNAME LPD \
+ MAKEMIME MKFS_MINIX MSH \
+ OD \
+ RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
+ SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
+ TASKSET TCPSVD \
+ RPM RPM2CPIO \
+ UDPSVD UUDECODE UUENCODE
+ do
+ busybox_config_option n ${opt}
+ done
+
+ emake -j1 oldconfig > /dev/null
+}
+
+src_compile() {
+ unset KBUILD_OUTPUT #88088
+ export SKIP_STRIP=y
+
+ emake V=1 busybox
+}
+
+src_install() {
+ unset KBUILD_OUTPUT #88088
+ save_config .config
+
+ into /
+ dodir /bin
+ if use sep-usr ; then
+ # install /ginit to take care of mounting stuff
+ exeinto /
+ newexe busybox_unstripped ginit
+ dosym /ginit /bin/bb
+ dosym bb /bin/busybox
+ else
+ newbin busybox_unstripped busybox
+ dosym busybox /bin/bb
+ fi
+ if use mdev ; then
+ dodir /$(get_libdir)/mdev/
+ use make-symlinks || dosym /bin/bb /sbin/mdev
+ cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
+
+ exeinto /$(get_libdir)/mdev/
+ doexe "${FILESDIR}"/mdev/*
+
+ newinitd "${FILESDIR}"/mdev.initd mdev
+ fi
+ if use livecd ; then
+ dosym busybox /bin/vi
+ fi
+
+ # add busybox daemon's, bug #444718
+ if busybox_config_enabled FEATURE_NTPD_SERVER; then
+ newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
+ newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
+ fi
+ if busybox_config_enabled SYSLOGD; then
+ newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
+ newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
+ fi
+ if busybox_config_enabled KLOGD; then
+ newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
+ newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
+ fi
+ if busybox_config_enabled WATCHDOG; then
+ newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
+ newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
+ fi
+ if busybox_config_enabled UDHCPC; then
+ local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
+ exeinto "${path%/*}"
+ newexe examples/udhcp/simple.script "${path##*/}"
+ fi
+ if busybox_config_enabled UDHCPD; then
+ insinto /etc
+ doins examples/udhcp/udhcpd.conf
+ fi
+
+ # bundle up the symlink files for use later
+ emake DESTDIR="${ED}" install
+ rm _install/bin/busybox
+ # for compatibility, provide /usr/bin/env
+ mkdir -p _install/usr/bin
+ ln -s /bin/env _install/usr/bin/env
+ tar cf busybox-links.tar -C _install . || : #;die
+ insinto /usr/share/${PN}
+ use make-symlinks && doins busybox-links.tar
+
+ dodoc AUTHORS README TODO
+
+ cd docs
+ docinto txt
+ dodoc *.txt
+ docinto pod
+ dodoc *.pod
+ dohtml *.html
+
+ cd ../examples
+ docinto examples
+ dodoc inittab depmod.pl *.conf *.script undeb unrpm
+}
+
+pkg_preinst() {
+ if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
+ ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
+ ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
+ ewarn "If you are creating a binary only and not merging this is probably ok."
+ ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
+ die "silly options will destroy your system"
+ fi
+
+ if use make-symlinks ; then
+ mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
+ fi
+}
+
+pkg_postinst() {
+ savedconfig_pkg_postinst
+
+ if use make-symlinks ; then
+ cd "${T}" || die
+ mkdir _install
+ tar xf busybox-links.tar -C _install || die
+ cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
+ fi
+
+ if use sep-usr ; then
+ elog "In order to use the sep-usr support, you have to update your"
+ elog "kernel command line. Add the option:"
+ elog " init=/ginit"
+ elog "To launch a different init than /sbin/init, use:"
+ elog " init=/ginit /sbin/yourinit"
+ elog "To get a rescue shell, you may boot with:"
+ elog " init=/ginit bb"
+ fi
+}
diff --git a/sys-apps/busybox/busybox-1.27.2.ebuild b/sys-apps/busybox/busybox-1.27.2.ebuild
new file mode 100644
index 000000000000..80b530dc184a
--- /dev/null
+++ b/sys-apps/busybox/busybox-1.27.2.ebuild
@@ -0,0 +1,310 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
+
+EAPI="5"
+inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+HOMEPAGE="https://www.busybox.net/"
+if [[ ${PV} == "9999" ]] ; then
+ MY_P=${P}
+ EGIT_REPO_URI="git://busybox.net/busybox.git"
+ inherit git-r3
+else
+ MY_P=${PN}-${PV/_/-}
+ SRC_URI="https://www.busybox.net/downloads/${MY_P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+LICENSE="GPL-2" # GPL-2 only
+SLOT="0"
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd"
+REQUIRED_USE="pam? ( !static )"
+RESTRICT="test"
+
+COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
+ pam? ( sys-libs/pam )"
+DEPEND="${COMMON_DEPEND}
+ static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
+ >=sys-kernel/linux-headers-2.6.39"
+RDEPEND="${COMMON_DEPEND}
+ mdev? ( !<sys-apps/openrc-0.13 )"
+
+S=${WORKDIR}/${MY_P}
+
+busybox_config_option() {
+ local flag=$1 ; shift
+ if [[ ${flag} != [yn] && ${flag} != \"* ]] ; then
+ busybox_config_option $(usex ${flag} y n) "$@"
+ return
+ fi
+ local expr
+ while [[ $# -gt 0 ]] ; do
+ case ${flag} in
+ y) expr="s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" ;;
+ n) expr="s:CONFIG_$1=y:# CONFIG_$1 is not set:g" ;;
+ *) expr="s:.*\<CONFIG_$1\>.*:CONFIG_$1=${flag}:g" ;;
+ esac
+ sed -i -e "${expr}" .config || die
+ einfo "$(grep "CONFIG_$1[= ]" .config || echo "Could not find CONFIG_$1 ...")"
+ shift
+ done
+}
+
+busybox_config_enabled() {
+ local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
+ case ${val} in
+ "") return 1 ;;
+ y) return 0 ;;
+ *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
+ esac
+}
+
+src_prepare() {
+ unset KBUILD_OUTPUT #88088
+ append-flags -fno-strict-aliasing #310413
+ use ppc64 && append-flags -mminimal-toc #130943
+
+ # patches go here!
+ epatch "${FILESDIR}"/${PN}-1.26.2-bb.patch
+# epatch "${FILESDIR}"/${P}-*.patch
+ cp "${FILESDIR}"/ginit.c init/ || die
+
+ # flag cleanup
+ sed -i -r \
+ -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
+ Makefile.flags || die
+ #sed -i '/bbsh/s:^//::' include/applets.h
+ sed -i '/^#error Aborting compilation./d' applets/applets.c || die
+ use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
+ sed -i \
+ -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
+ -e "/^AR\>/s:=.*:= $(tc-getAR):" \
+ -e "/^CC\>/s:=.*:= $(tc-getCC):" \
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+ -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
+ Makefile || die
+ sed -i \
+ -e 's:-static-libgcc::' \
+ Makefile.flags || die
+}
+
+src_configure() {
+ # check for a busybox config before making one of our own.
+ # if one exist lets return and use it.
+
+ restore_config .config
+ if [ -f .config ]; then
+ yes "" | emake -j1 -s oldconfig >/dev/null
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ # setup the config file
+ emake -j1 -s allyesconfig >/dev/null
+ # nommu forces a bunch of things off which we want on #387555
+ busybox_config_option n NOMMU
+ sed -i '/^#/d' .config
+ yes "" | emake -j1 -s oldconfig >/dev/null
+
+ # now turn off stuff we really don't want
+ busybox_config_option n DMALLOC
+ busybox_config_option n FEATURE_2_4_MODULES #607548
+ busybox_config_option n FEATURE_SUID_CONFIG
+ busybox_config_option n BUILD_AT_ONCE
+ busybox_config_option n BUILD_LIBBUSYBOX
+ busybox_config_option n FEATURE_CLEAN_UP
+ busybox_config_option n MONOTONIC_SYSCALL
+ busybox_config_option n USE_PORTABLE_CODE
+ busybox_config_option n WERROR
+ # triming the BSS size may be dangerous
+ busybox_config_option n FEATURE_USE_BSS_TAIL
+
+ # If these are not set and we are using a uclibc/busybox setup
+ # all calls to system() will fail.
+ busybox_config_option y ASH
+ busybox_config_option y SH_IS_ASH
+ busybox_config_option n HUSH
+ busybox_config_option n SH_IS_HUSH
+
+ busybox_config_option '"/run"' PID_FILE_PATH
+ busybox_config_option '"/run/ifstate"' IFUPDOWN_IFSTATE_PATH
+
+ # disable ipv6 applets
+ if ! use ipv6; then
+ busybox_config_option n FEATURE_IPV6
+ busybox_config_option n TRACEROUTE6
+ busybox_config_option n PING6
+ busybox_config_option n UDHCPC6
+ fi
+
+ busybox_config_option pam PAM
+ busybox_config_option static STATIC
+ busybox_config_option syslog {K,SYS}LOGD LOGGER
+ busybox_config_option systemd FEATURE_SYSTEMD
+ busybox_config_option math FEATURE_AWK_LIBM
+
+ # all the debug options are compiler related, so punt them
+ busybox_config_option n DEBUG_SANITIZE
+ busybox_config_option n DEBUG
+ busybox_config_option y NO_DEBUG_LIB
+ busybox_config_option n DMALLOC
+ busybox_config_option n EFENCE
+ busybox_config_option $(usex debug y n) TFTP_DEBUG
+
+ busybox_config_option selinux SELINUX
+
+ # this opt only controls mounting with <linux-2.6.23
+ busybox_config_option n FEATURE_MOUNT_NFS
+
+ # default a bunch of uncommon options to off
+ local opt
+ for opt in \
+ ADD_SHELL \
+ BEEP BOOTCHARTD \
+ CRONTAB \
+ DC DEVFSD DNSD DPKG{,_DEB} \
+ FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
+ FEATURE_DEVFS \
+ HOSTID HUSH \
+ INETD INOTIFYD IPCALC \
+ LOCALE_SUPPORT LOGNAME LPD \
+ MAKEMIME MKFS_MINIX MSH \
+ OD \
+ RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
+ SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
+ TASKSET TCPSVD \
+ RPM RPM2CPIO \
+ UDPSVD UUDECODE UUENCODE
+ do
+ busybox_config_option n ${opt}
+ done
+
+ emake -j1 oldconfig > /dev/null
+}
+
+src_compile() {
+ unset KBUILD_OUTPUT #88088
+ export SKIP_STRIP=y
+
+ emake V=1 busybox
+}
+
+src_install() {
+ unset KBUILD_OUTPUT #88088
+ save_config .config
+
+ into /
+ dodir /bin
+ if use sep-usr ; then
+ # install /ginit to take care of mounting stuff
+ exeinto /
+ newexe busybox_unstripped ginit
+ dosym /ginit /bin/bb
+ dosym bb /bin/busybox
+ else
+ newbin busybox_unstripped busybox
+ dosym busybox /bin/bb
+ fi
+ if use mdev ; then
+ dodir /$(get_libdir)/mdev/
+ use make-symlinks || dosym /bin/bb /sbin/mdev
+ cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
+
+ exeinto /$(get_libdir)/mdev/
+ doexe "${FILESDIR}"/mdev/*
+
+ newinitd "${FILESDIR}"/mdev.initd mdev
+ fi
+ if use livecd ; then
+ dosym busybox /bin/vi
+ fi
+
+ # add busybox daemon's, bug #444718
+ if busybox_config_enabled FEATURE_NTPD_SERVER; then
+ newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
+ newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
+ fi
+ if busybox_config_enabled SYSLOGD; then
+ newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
+ newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
+ fi
+ if busybox_config_enabled KLOGD; then
+ newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
+ newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
+ fi
+ if busybox_config_enabled WATCHDOG; then
+ newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
+ newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
+ fi
+ if busybox_config_enabled UDHCPC; then
+ local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
+ exeinto "${path%/*}"
+ newexe examples/udhcp/simple.script "${path##*/}"
+ fi
+ if busybox_config_enabled UDHCPD; then
+ insinto /etc
+ doins examples/udhcp/udhcpd.conf
+ fi
+
+ # bundle up the symlink files for use later
+ emake DESTDIR="${ED}" install
+ rm _install/bin/busybox
+ # for compatibility, provide /usr/bin/env
+ mkdir -p _install/usr/bin
+ ln -s /bin/env _install/usr/bin/env
+ tar cf busybox-links.tar -C _install . || : #;die
+ insinto /usr/share/${PN}
+ use make-symlinks && doins busybox-links.tar
+
+ dodoc AUTHORS README TODO
+
+ cd docs
+ docinto txt
+ dodoc *.txt
+ docinto pod
+ dodoc *.pod
+ dohtml *.html
+
+ cd ../examples
+ docinto examples
+ dodoc inittab depmod.pl *.conf *.script undeb unrpm
+}
+
+pkg_preinst() {
+ if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
+ ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
+ ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
+ ewarn "If you are creating a binary only and not merging this is probably ok."
+ ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
+ die "silly options will destroy your system"
+ fi
+
+ if use make-symlinks ; then
+ mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
+ fi
+}
+
+pkg_postinst() {
+ savedconfig_pkg_postinst
+
+ if use make-symlinks ; then
+ cd "${T}" || die
+ mkdir _install
+ tar xf busybox-links.tar -C _install || die
+ cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
+ fi
+
+ if use sep-usr ; then
+ elog "In order to use the sep-usr support, you have to update your"
+ elog "kernel command line. Add the option:"
+ elog " init=/ginit"
+ elog "To launch a different init than /sbin/init, use:"
+ elog " init=/ginit /sbin/yourinit"
+ elog "To get a rescue shell, you may boot with:"
+ elog " init=/ginit bb"
+ fi
+}
diff --git a/sys-apps/busybox/busybox-9999.ebuild b/sys-apps/busybox/busybox-9999.ebuild
new file mode 100644
index 000000000000..3abfee0f8026
--- /dev/null
+++ b/sys-apps/busybox/busybox-9999.ebuild
@@ -0,0 +1,308 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# See `man savedconfig.eclass` for info on how to use USE=savedconfig.
+
+EAPI="5"
+inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
+
+DESCRIPTION="Utilities for rescue and embedded systems"
+HOMEPAGE="https://www.busybox.net/"
+if [[ ${PV} == "9999" ]] ; then
+ MY_P=${P}
+ EGIT_REPO_URI="https://git.busybox.net/busybox"
+ inherit git-r3
+else
+ MY_P=${PN}-${PV/_/-}
+ SRC_URI="https://www.busybox.net/downloads/${MY_P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
+fi
+
+LICENSE="GPL-2" # GPL-2 only
+SLOT="0"
+IUSE="debug ipv6 livecd make-symlinks math mdev pam selinux sep-usr static syslog systemd"
+REQUIRED_USE="pam? ( !static )"
+RESTRICT="test"
+
+COMMON_DEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
+ pam? ( sys-libs/pam )"
+DEPEND="${COMMON_DEPEND}
+ static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
+ >=sys-kernel/linux-headers-2.6.39"
+RDEPEND="${COMMON_DEPEND}
+ mdev? ( !<sys-apps/openrc-0.13 )"
+
+S=${WORKDIR}/${MY_P}
+
+busybox_config_option() {
+ local flag=$1 ; shift
+ if [[ ${flag} != [yn] && ${flag} != \"* ]] ; then
+ busybox_config_option $(usex ${flag} y n) "$@"
+ return
+ fi
+ local expr
+ while [[ $# -gt 0 ]] ; do
+ case ${flag} in
+ y) expr="s:.*\<CONFIG_$1\>.*set:CONFIG_$1=y:g" ;;
+ n) expr="s:CONFIG_$1=y:# CONFIG_$1 is not set:g" ;;
+ *) expr="s:.*\<CONFIG_$1\>.*:CONFIG_$1=${flag}:g" ;;
+ esac
+ sed -i -e "${expr}" .config || die
+ einfo "$(grep "CONFIG_$1[= ]" .config || echo "Could not find CONFIG_$1 ...")"
+ shift
+ done
+}
+
+busybox_config_enabled() {
+ local val=$(sed -n "/^CONFIG_$1=/s:^[^=]*=::p" .config)
+ case ${val} in
+ "") return 1 ;;
+ y) return 0 ;;
+ *) echo "${val}" | sed -r 's:^"(.*)"$:\1:' ;;
+ esac
+}
+
+src_prepare() {
+ unset KBUILD_OUTPUT #88088
+ append-flags -fno-strict-aliasing #310413
+ use ppc64 && append-flags -mminimal-toc #130943
+
+ # patches go here!
+ epatch "${FILESDIR}"/${PN}-1.26.2-bb.patch
+# epatch "${FILESDIR}"/${P}-*.patch
+ cp "${FILESDIR}"/ginit.c init/ || die
+
+ # flag cleanup
+ sed -i -r \
+ -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
+ Makefile.flags || die
+ #sed -i '/bbsh/s:^//::' include/applets.h
+ sed -i '/^#error Aborting compilation./d' applets/applets.c || die
+ use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
+ sed -i \
+ -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
+ -e "/^AR\>/s:=.*:= $(tc-getAR):" \
+ -e "/^CC\>/s:=.*:= $(tc-getCC):" \
+ -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
+ -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
+ Makefile || die
+ sed -i \
+ -e 's:-static-libgcc::' \
+ Makefile.flags || die
+}
+
+src_configure() {
+ # check for a busybox config before making one of our own.
+ # if one exist lets return and use it.
+
+ restore_config .config
+ if [ -f .config ]; then
+ yes "" | emake -j1 -s oldconfig >/dev/null
+ return 0
+ else
+ ewarn "Could not locate user configfile, so we will save a default one"
+ fi
+
+ # setup the config file
+ emake -j1 -s allyesconfig >/dev/null
+ # nommu forces a bunch of things off which we want on #387555
+ busybox_config_option n NOMMU
+ sed -i '/^#/d' .config
+ yes "" | emake -j1 -s oldconfig >/dev/null
+
+ # now turn off stuff we really don't want
+ busybox_config_option n DMALLOC
+ busybox_config_option n FEATURE_2_4_MODULES #607548
+ busybox_config_option n FEATURE_SUID_CONFIG
+ busybox_config_option n BUILD_AT_ONCE
+ busybox_config_option n BUILD_LIBBUSYBOX
+ busybox_config_option n FEATURE_CLEAN_UP
+ busybox_config_option n MONOTONIC_SYSCALL
+ busybox_config_option n USE_PORTABLE_CODE
+ busybox_config_option n WERROR
+ # triming the BSS size may be dangerous
+ busybox_config_option n FEATURE_USE_BSS_TAIL
+
+ # If these are not set and we are using a uclibc/busybox setup
+ # all calls to system() will fail.
+ busybox_config_option y ASH
+ busybox_config_option n HUSH
+
+ busybox_config_option '"/run"' PID_FILE_PATH
+ busybox_config_option '"/run/ifstate"' IFUPDOWN_IFSTATE_PATH
+
+ # disable ipv6 applets
+ if ! use ipv6; then
+ busybox_config_option n FEATURE_IPV6
+ busybox_config_option n TRACEROUTE6
+ busybox_config_option n PING6
+ busybox_config_option n UDHCPC6
+ fi
+
+ busybox_config_option pam PAM
+ busybox_config_option static STATIC
+ busybox_config_option syslog {K,SYS}LOGD LOGGER
+ busybox_config_option systemd FEATURE_SYSTEMD
+ busybox_config_option math FEATURE_AWK_LIBM
+
+ # all the debug options are compiler related, so punt them
+ busybox_config_option n DEBUG_SANITIZE
+ busybox_config_option n DEBUG
+ busybox_config_option y NO_DEBUG_LIB
+ busybox_config_option n DMALLOC
+ busybox_config_option n EFENCE
+ busybox_config_option $(usex debug y n) TFTP_DEBUG
+
+ busybox_config_option selinux SELINUX
+
+ # this opt only controls mounting with <linux-2.6.23
+ busybox_config_option n FEATURE_MOUNT_NFS
+
+ # default a bunch of uncommon options to off
+ local opt
+ for opt in \
+ ADD_SHELL \
+ BEEP BOOTCHARTD \
+ CRONTAB \
+ DC DEVFSD DNSD DPKG{,_DEB} \
+ FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
+ FEATURE_DEVFS \
+ HOSTID HUSH \
+ INETD INOTIFYD IPCALC \
+ LOCALE_SUPPORT LOGNAME LPD \
+ MAKEMIME MKFS_MINIX MSH \
+ OD \
+ RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
+ SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
+ TASKSET TCPSVD \
+ RPM RPM2CPIO \
+ UDPSVD UUDECODE UUENCODE
+ do
+ busybox_config_option n ${opt}
+ done
+
+ emake -j1 oldconfig > /dev/null
+}
+
+src_compile() {
+ unset KBUILD_OUTPUT #88088
+ export SKIP_STRIP=y
+
+ emake V=1 busybox
+}
+
+src_install() {
+ unset KBUILD_OUTPUT #88088
+ save_config .config
+
+ into /
+ dodir /bin
+ if use sep-usr ; then
+ # install /ginit to take care of mounting stuff
+ exeinto /
+ newexe busybox_unstripped ginit
+ dosym /ginit /bin/bb
+ dosym bb /bin/busybox
+ else
+ newbin busybox_unstripped busybox
+ dosym busybox /bin/bb
+ fi
+ if use mdev ; then
+ dodir /$(get_libdir)/mdev/
+ use make-symlinks || dosym /bin/bb /sbin/mdev
+ cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
+
+ exeinto /$(get_libdir)/mdev/
+ doexe "${FILESDIR}"/mdev/*
+
+ newinitd "${FILESDIR}"/mdev.initd mdev
+ fi
+ if use livecd ; then
+ dosym busybox /bin/vi
+ fi
+
+ # add busybox daemon's, bug #444718
+ if busybox_config_enabled FEATURE_NTPD_SERVER; then
+ newconfd "${FILESDIR}/ntpd.confd" "busybox-ntpd"
+ newinitd "${FILESDIR}/ntpd.initd" "busybox-ntpd"
+ fi
+ if busybox_config_enabled SYSLOGD; then
+ newconfd "${FILESDIR}/syslogd.confd" "busybox-syslogd"
+ newinitd "${FILESDIR}/syslogd.initd" "busybox-syslogd"
+ fi
+ if busybox_config_enabled KLOGD; then
+ newconfd "${FILESDIR}/klogd.confd" "busybox-klogd"
+ newinitd "${FILESDIR}/klogd.initd" "busybox-klogd"
+ fi
+ if busybox_config_enabled WATCHDOG; then
+ newconfd "${FILESDIR}/watchdog.confd" "busybox-watchdog"
+ newinitd "${FILESDIR}/watchdog.initd" "busybox-watchdog"
+ fi
+ if busybox_config_enabled UDHCPC; then
+ local path=$(busybox_config_enabled UDHCPC_DEFAULT_SCRIPT)
+ exeinto "${path%/*}"
+ newexe examples/udhcp/simple.script "${path##*/}"
+ fi
+ if busybox_config_enabled UDHCPD; then
+ insinto /etc
+ doins examples/udhcp/udhcpd.conf
+ fi
+
+ # bundle up the symlink files for use later
+ emake DESTDIR="${ED}" install
+ rm _install/bin/busybox
+ # for compatibility, provide /usr/bin/env
+ mkdir -p _install/usr/bin
+ ln -s /bin/env _install/usr/bin/env
+ tar cf busybox-links.tar -C _install . || : #;die
+ insinto /usr/share/${PN}
+ use make-symlinks && doins busybox-links.tar
+
+ dodoc AUTHORS README TODO
+
+ cd docs
+ docinto txt
+ dodoc *.txt
+ docinto pod
+ dodoc *.pod
+ dohtml *.html
+
+ cd ../examples
+ docinto examples
+ dodoc inittab depmod.pl *.conf *.script undeb unrpm
+}
+
+pkg_preinst() {
+ if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
+ ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
+ ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
+ ewarn "If you are creating a binary only and not merging this is probably ok."
+ ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
+ die "silly options will destroy your system"
+ fi
+
+ if use make-symlinks ; then
+ mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
+ fi
+}
+
+pkg_postinst() {
+ savedconfig_pkg_postinst
+
+ if use make-symlinks ; then
+ cd "${T}" || die
+ mkdir _install
+ tar xf busybox-links.tar -C _install || die
+ cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
+ fi
+
+ if use sep-usr ; then
+ elog "In order to use the sep-usr support, you have to update your"
+ elog "kernel command line. Add the option:"
+ elog " init=/ginit"
+ elog "To launch a different init than /sbin/init, use:"
+ elog " init=/ginit /sbin/yourinit"
+ elog "To get a rescue shell, you may boot with:"
+ elog " init=/ginit bb"
+ fi
+}
diff --git a/sys-apps/busybox/files/busybox-1.19.0-bb.patch b/sys-apps/busybox/files/busybox-1.19.0-bb.patch
new file mode 100644
index 000000000000..a66b45a5e21d
--- /dev/null
+++ b/sys-apps/busybox/files/busybox-1.19.0-bb.patch
@@ -0,0 +1,22 @@
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -75,6 +75,8 @@
+ //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
+ //applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
+ //applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash))
++//applet:IF_ASH(APPLET_ODDNAME(bb, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
++//applet:IF_ASH(APPLET_ODDNAME(bbsh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
+
+ //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
+ //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -7255,6 +7255,8 @@
+ }
+ /* re-exec ourselves with the new arguments */
+ execve(bb_busybox_exec_path, argv, envp);
++ execve("/bin/busybox.static", argv, envp);
++ execve("/bin/busybox", argv, envp);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
+ }
diff --git a/sys-apps/busybox/files/busybox-1.25.1-setfiles.patch b/sys-apps/busybox/files/busybox-1.25.1-setfiles.patch
new file mode 100644
index 000000000000..3a5f5ed9d3a6
--- /dev/null
+++ b/sys-apps/busybox/files/busybox-1.25.1-setfiles.patch
@@ -0,0 +1,34 @@
+From c1704a34745f8e49373eb2cbe1c83199ab2d0091 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Fri, 9 Dec 2016 18:14:12 -0500
+Subject: [PATCH] setfiles: fix build failure after common_bufsiz change
+
+Commit 47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 ("*: add most of the
+required setup_common_bufsiz() calls") switched this tool over to use
+the common_bufsiz logic but missed including the header leading to a
+build failure when enabled:
+selinux/setfiles.c:80:30: error: 'bb_common_bufsiz1' undeclared (first use in this function)
+
+URL: https://bugs.gentoo.org/600106
+Reported-by: Jonas Jelten <jj@stusta.net>
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+(cherry picked from commit 1cda8790803a6fb072375c8fa53273333d2d4607)
+---
+ selinux/setfiles.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/selinux/setfiles.c b/selinux/setfiles.c
+index 51a7e63bd741..d8083d4fd580 100644
+--- a/selinux/setfiles.c
++++ b/selinux/setfiles.c
+@@ -46,6 +46,7 @@
+ //usage: "\n if it has changed"
+
+ #include "libbb.h"
++#include "common_bufsiz.h"
+ #if ENABLE_FEATURE_SETFILES_CHECK_OPTION
+ #include <sepol/sepol.h>
+ #endif
+--
+2.11.0.rc2
+
diff --git a/sys-apps/busybox/files/busybox-1.26.2-bb.patch b/sys-apps/busybox/files/busybox-1.26.2-bb.patch
new file mode 100644
index 000000000000..5e2405c3a670
--- /dev/null
+++ b/sys-apps/busybox/files/busybox-1.26.2-bb.patch
@@ -0,0 +1,55 @@
+add `bb` and `bbsh` shortcuts as aliases to the main shell so we can install
+symlinks in Gentoo at /bin/bb as our recovery shell.
+
+we also add fallbacks to /bin/busybox and /bin/busybox.static in case /proc
+is not yet mounted during early boot.
+
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -144,6 +144,8 @@
+ //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
+ //applet:IF_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
+ //applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
++//applet:IF_ASH(APPLET_ODDNAME(bb, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
++//applet:IF_ASH(APPLET_ODDNAME(bbsh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
+
+ //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
+ //kbuild:lib-$(CONFIG_SH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o
+@@ -7572,6 +7574,8 @@
+ }
+ /* re-exec ourselves with the new arguments */
+ execve(bb_busybox_exec_path, argv, envp);
++ execve("/bin/busybox.static", argv, envp);
++ execve("/bin/busybox", argv, envp);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
+ }
+--- a/shell/hush.c
++++ b/shell/hush.c
+@@ -221,6 +221,8 @@
+ //applet:IF_MSH(APPLET_ODDNAME(msh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
+ //applet:IF_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
+ //applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
++//applet:IF_HUSH(APPLET_ODDNAME(bb, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
++//applet:IF_HUSH(APPLET_ODDNAME(bbsh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
+
+ //kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o
+ //kbuild:lib-$(CONFIG_SH_IS_HUSH) += hush.o match.o shell_common.o
+@@ -6073,6 +6075,8 @@
+ if (SPECIAL_JOBSTOP_SIGS != 0)
+ switch_off_special_sigs(G.special_sig_mask & SPECIAL_JOBSTOP_SIGS);
+ execve(bb_busybox_exec_path, argv, pp);
++ execve("/bin/busybox.static", argv, pp);
++ execve("/bin/busybox", argv, pp);
+ /* Fallback. Useful for init=/bin/hush usage etc */
+ if (argv[0][0] == '/')
+ execve(argv[0], argv, pp);
+@@ -6931,6 +6931,8 @@
+ if (SPECIAL_JOBSTOP_SIGS != 0)
+ switch_off_special_sigs(G.special_sig_mask & SPECIAL_JOBSTOP_SIGS);
+ execv(bb_busybox_exec_path, argv);
++ execv("/bin/busybox.static", argv);
++ execv("/bin/busybox", argv);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
+ }
diff --git a/sys-apps/busybox/files/ginit.c b/sys-apps/busybox/files/ginit.c
new file mode 100644
index 000000000000..de98e4ac4110
--- /dev/null
+++ b/sys-apps/busybox/files/ginit.c
@@ -0,0 +1,124 @@
+/*
+ * simple init to bootstrap sep-/usr
+ *
+ * Copyright (C) 2012-2013 Mike Frysinger <vapier@gentoo.org>
+ *
+ * Licensed under GPLv2 or later
+ */
+
+//applet:IF_GINIT(APPLET(ginit, BB_DIR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_GINIT) += ginit.o
+
+//config:config GINIT
+//config: bool "ginit"
+//config: default y
+//config: select MKDIR
+//config: select MDEV
+//config: select MOUNT
+//config: select MOUNTPOINT
+//config: help
+//config: sep-/usr bootstrapper
+
+//usage:#define ginit_trivial_usage NOUSAGE_STR
+//usage:#define ginit_full_usage ""
+
+#include "libbb.h"
+
+#define eprintf(fmt, args...) printf("%s" fmt, "sep-usr init: ", ## args)
+
+static void process_args(char **args)
+{
+ size_t i;
+
+ eprintf("running: ");
+ for (i = 0; args[i]; ++i) {
+ /* String needs to be writable, so dupe it */
+ args[i] = xstrdup(args[i]);
+ printf("'%s' ", args[i]);
+ }
+ printf("\n");
+}
+
+int ginit_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int ginit_main(int argc UNUSED_PARAM, char **argv)
+{
+ FILE *mntlist;
+ bool ismnted_dev, ismnted_sys, ismnted_usr;
+ struct mntent *mntent;
+
+ /*
+ int fd = open("/dev/console", O_RDWR);
+ if (fd >= 0) {
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ }
+ */
+
+ /* If given an argv[] with an applet name, run it instead.
+ * Makes recovering simple by doing: init=/ginit bb
+ */
+ if (argv[1] && argv[1][0] != '/') {
+ eprintf("running user requested applet %s\n", argv[1]);
+ return spawn_and_wait(argv+1);
+ }
+
+#define saw(argv...) \
+ ({ \
+ static const char *args[] = { argv, NULL }; \
+ /* These casts are fine -- see process_args for mem setup */ \
+ process_args((void *)args); \
+ spawn_and_wait((void *)args); \
+ })
+
+ /* First setup basic /dev */
+ if (saw("mountpoint", "-q", "/dev") != 0) {
+ /* Try /etc/fstab */
+ if (saw("mount", "-n", "/dev"))
+ /* Then devtmpfs */
+ if (saw("mount", "-n", "-t", "devtmpfs", "devtmpfs", "/dev"))
+ /* Finally normal tmpfs */
+ saw("mount", "-n", "-t", "tmpfs", "dev", "/dev");
+ } else {
+ eprintf("%s appears to be mounted; skipping its setup\n", "/dev");
+ }
+
+ /* If /dev is empty (e.g. tmpfs), run mdev to seed things */
+ if (access("/dev/console", F_OK) != 0) {
+ if (saw("mountpoint", "-q", "/sys") != 0) {
+ if (saw("mount", "-n", "/sys"))
+ saw("mount", "-n", "-t", "sysfs", "sysfs", "/sys");
+ } else {
+ eprintf("%s appears to be mounted; skipping its setup\n", "/sys");
+ }
+
+ /* Mount /proc as mdev will fork+exec /proc/self/exe */
+ if (saw("mountpoint", "-q", "/proc") != 0) {
+ /* Try /etc/fstab */
+ if (saw("mount", "-n", "/proc"))
+ saw("mount", "-n", "-t", "proc", "proc", "/proc");
+ }
+
+ saw("mdev", "-s");
+ }
+
+ /* Then seed the stuff we care about */
+ saw("mkdir", "-p", "/dev/pts", "/dev/shm");
+
+ /* Then mount /usr */
+ if (saw("mountpoint", "-q", "/usr") != 0) {
+ saw("mount", "-n", "/usr", "-o", "ro");
+ } else {
+ eprintf("%s appears to be mounted; skipping its setup\n", "/usr");
+ }
+
+ /* Now that we're all done, exec the real init */
+ if (!argv[1]) {
+ argv[0] = (void *)"/sbin/init";
+ argv[1] = NULL;
+ } else
+ ++argv;
+ process_args(argv);
+ return execv(argv[0], argv);
+}
diff --git a/sys-apps/busybox/files/klogd.confd b/sys-apps/busybox/files/klogd.confd
new file mode 100644
index 000000000000..4c16096a4e15
--- /dev/null
+++ b/sys-apps/busybox/files/klogd.confd
@@ -0,0 +1,9 @@
+# Config file for /etc/init.d/busybox-sysklogd
+
+# run "/sbin/klogd --help" to see all possible options.
+
+# activate if you need remote logging
+#rc_need="net"
+
+# send warnings and above to the console
+KLOGD_OPTS="-c 3"
diff --git a/sys-apps/busybox/files/klogd.initd b/sys-apps/busybox/files/klogd.initd
new file mode 100644
index 000000000000..95d5eb030d51
--- /dev/null
+++ b/sys-apps/busybox/files/klogd.initd
@@ -0,0 +1,11 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/bin/busybox klogd"
+command_args="${KLOGD_OPTS}"
+pidfile="/run/klogd.pid"
+
+depend() {
+ need clock hostname
+}
diff --git a/sys-apps/busybox/files/mdev.initd b/sys-apps/busybox/files/mdev.initd
new file mode 100644
index 000000000000..114570743900
--- /dev/null
+++ b/sys-apps/busybox/files/mdev.initd
@@ -0,0 +1,52 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend()
+{
+ provide dev
+ need dev-mount sysfs
+}
+
+find_mdev()
+{
+ if [ -x /sbin/mdev ] ; then
+ echo "/sbin/mdev"
+ else
+ echo "/bin/busybox mdev"
+ fi
+}
+
+populate_mdev()
+{
+ ebegin "Populating /dev with existing devices with mdev -s"
+ $(find_mdev) -s
+ eend $?
+ return 0
+}
+
+seed_dev()
+{
+ # copy over any persistent things
+ if [ -d /lib/mdev/devices ] ; then
+ cp -RPp /lib/mdev/devices/* /dev 2>/dev/null
+ fi
+}
+
+start()
+{
+ seed_dev
+
+ # Setup hotplugging (if possible)
+ if [ -e /proc/sys/kernel/hotplug ] ; then
+ ebegin "Setting up mdev as hotplug agent"
+ echo $(find_mdev) > /proc/sys/kernel/hotplug
+ eend 0
+ fi
+
+ if get_bootparam "nocoldplug" ; then
+ ewarn "Skipping mdev coldplug as requested in kernel cmdline"
+ else
+ populate_mdev
+ fi
+}
diff --git a/sys-apps/busybox/files/mdev/dvbdev b/sys-apps/busybox/files/mdev/dvbdev
new file mode 100644
index 000000000000..f0186c176cd8
--- /dev/null
+++ b/sys-apps/busybox/files/mdev/dvbdev
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# MDEV=dvb0.demux1 -> ADAPTER=dvb0 -> N=0
+ADAPTER=${MDEV%.*}
+N=${ADAPTER#dvb}
+# MDEV=dvb0.demux1 -> DEVB_DEV=demux1
+DVB_DEV=${MDEV#*.}
+
+case "$ACTION" in
+ add|"")
+ mkdir -p dvb/adapter${N}
+ mv ${MDEV} dvb/adapter${N}/${DVB_DEV}
+ ;;
+ remove)
+ rm -f dvb/adapter${N}/${DVB_DEV}
+ rmdir dvb/adapter${N} 2>/dev/null
+ rmdir dvb/ 2>/dev/null
+esac
diff --git a/sys-apps/busybox/files/mdev/ide_links b/sys-apps/busybox/files/mdev/ide_links
new file mode 100644
index 000000000000..be0c95aa9c0e
--- /dev/null
+++ b/sys-apps/busybox/files/mdev/ide_links
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+[ -f /proc/ide/$MDEV/media ] || exit
+
+media=`cat /proc/ide/$MDEV/media`
+for i in $media $media[0-9]* ; do
+ if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
+ LINK=$i
+ break
+ fi
+done
+
+# link exist, remove if necessary and exit
+if [ "$LINK" ] ; then
+ [ "$ACTION" = remove ] && rm $LINK
+ exit
+fi
+
+# create a link
+num=`ls $media[0-9]* 2>/dev/null | wc -l`
+ln -sf $MDEV "$media`echo $num`"
+[ -e "$media" ] || ln -sf $MDEV "$media"
+
diff --git a/sys-apps/busybox/files/mdev/usbdev b/sys-apps/busybox/files/mdev/usbdev
new file mode 100644
index 000000000000..ea5b9155736c
--- /dev/null
+++ b/sys-apps/busybox/files/mdev/usbdev
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# script is buggy; until patched just do exit 0
+#exit 0
+
+# add zeros to device or bus
+add_zeros () {
+ case "$(echo $1 | wc -L)" in
+ 1) echo "00$1" ;;
+ 2) echo "0$1" ;;
+ *) echo "$1"
+ esac
+ exit 0
+}
+
+
+# bus and device dirs in /sys
+USB_PATH=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).[0-9]/usb\1/')
+USB_PATH=$(find /sys/devices -type d -name "$USB_PATH")
+USB_DEV_DIR=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).\([0-9]\)/\1-\2/')
+
+# dir names in /dev
+BUS=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev\([0-9]\).[0-9]/\1/'))
+USB_DEV=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev[0-9].\([0-9]\)/\1/'))
+
+
+# try to load the proper driver for usb devices
+case "$ACTION" in
+ add|"")
+ # load usb bus driver
+ for i in $USB_PATH/*/modalias ; do
+ modprobe `cat $i` 2>/dev/null
+ done
+ # load usb device driver if existent
+ if [ -d $USB_PATH/$USB_DEV_DIR ]; then
+ for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
+ modprobe `cat $i` 2>/dev/null
+ done
+ fi
+ # move usb device file
+ mkdir -p bus/usb/$BUS
+ mv $MDEV bus/usb/$BUS/$USB_DEV
+ ;;
+ remove)
+ # unload device driver, if device dir is existent
+ if [ -d $USB_PATH/$USB_DEV_DIR ]; then
+ for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
+ modprobe -r `cat $i` 2>/dev/null
+ done
+ fi
+ # unload usb bus driver. Does this make sense?
+ # what happens, if two usb devices are plugged in
+ # and one is removed?
+ for i in $USB_PATH/*/modalias ; do
+ modprobe -r `cat $i` 2>/dev/null
+ done
+ # remove device file and possible empty dirs
+ rm -f bus/usb/$BUS/$USB_DEV
+ rmdir bus/usb/$BUS/ 2>/dev/null
+ rmdir bus/usb/ 2>/dev/null
+ rmdir bus/ 2>/dev/null
+esac
diff --git a/sys-apps/busybox/files/mdev/usbdisk_link b/sys-apps/busybox/files/mdev/usbdisk_link
new file mode 100644
index 000000000000..6bb069243f4c
--- /dev/null
+++ b/sys-apps/busybox/files/mdev/usbdisk_link
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars.
+
+current=$(readlink usbdisk)
+
+if [ "$current" = "$MDEV" ] && [ "$ACTION" = "remove" ]; then
+ rm -f usbdisk usba1
+fi
+[ -n "$current" ] && exit
+
+if [ -e /sys/block/$MDEV ]; then
+ SYSDEV=$(readlink -f /sys/block/$MDEV/device)
+ # if /sys device path contains '/usb[0-9]' then we assume its usb
+ # also, if it's a usb without partitions we require FAT
+ if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
+ # do not create link if there is not FAT
+ dd if=/dev/$MDEV bs=512 count=1 2>/dev/null | strings | grep FAT >/dev/null || exit 0
+
+ ln -sf $MDEV usbdisk
+ # keep this for compat. people have it in fstab
+ ln -sf $MDEV usba1
+ fi
+
+elif [ -e /sys/block/*/$MDEV ] ; then
+ PARENT=$(dirname /sys/block/*/$MDEV)
+ SYSDEV=$(readlink -f $PARENT/device)
+ if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
+ ln -sf $MDEV usbdisk
+ # keep this for compat. people have it in fstab
+ ln -sf $MDEV usba1
+ fi
+fi
+
diff --git a/sys-apps/busybox/files/ntpd.confd b/sys-apps/busybox/files/ntpd.confd
new file mode 100644
index 000000000000..f50d4c2e9179
--- /dev/null
+++ b/sys-apps/busybox/files/ntpd.confd
@@ -0,0 +1,6 @@
+# Config file for /etc/init.d/busybox-ntpd
+
+# run "/sbin/ntpd --help" to see all possible options.
+
+# Get time from specified server and run in background
+NTPD_OPTS="-N -p pool.ntp.org"
diff --git a/sys-apps/busybox/files/ntpd.initd b/sys-apps/busybox/files/ntpd.initd
new file mode 100644
index 000000000000..dffea3bcde39
--- /dev/null
+++ b/sys-apps/busybox/files/ntpd.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/bin/busybox ntpd"
+command_args="${NTPD_OPTS}"
+pidfile="/run/ntpd.pid"
+
+depend() {
+ use net dns logger
+ after ntp-client
+}
diff --git a/sys-apps/busybox/files/syslogd.confd b/sys-apps/busybox/files/syslogd.confd
new file mode 100644
index 000000000000..7df6885cedbb
--- /dev/null
+++ b/sys-apps/busybox/files/syslogd.confd
@@ -0,0 +1,9 @@
+# Config file for /etc/init.d/busybox-sysklogd
+
+# run "/sbin/syslogd --help" to see all possible options.
+
+# activate if you need remote logging
+#rc_need="net"
+
+# Log to shared mem buffer (use logread to read it)
+SYSLOGD_OPTS="-C128"
diff --git a/sys-apps/busybox/files/syslogd.initd b/sys-apps/busybox/files/syslogd.initd
new file mode 100644
index 000000000000..b2ac5ac17221
--- /dev/null
+++ b/sys-apps/busybox/files/syslogd.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/bin/busybox syslogd"
+command_args="${SYSLOGD_OPTS}"
+pidfile="/run/syslogd.pid"
+
+depend() {
+ need clock hostname
+ provide logger
+}
diff --git a/sys-apps/busybox/files/watchdog.confd b/sys-apps/busybox/files/watchdog.confd
new file mode 100644
index 000000000000..bd6aec0a7068
--- /dev/null
+++ b/sys-apps/busybox/files/watchdog.confd
@@ -0,0 +1,9 @@
+# Config file for /etc/init.d/busybox-watchdog
+
+# run "/sbin/watchdog --help" to see all possible options.
+
+# Periodically write to watchdog device
+WATCHDOG_OPTS="/dev/watchdog"
+
+# optionally set the nice-level
+#SSD_NICELEVEL="-20"
diff --git a/sys-apps/busybox/files/watchdog.initd b/sys-apps/busybox/files/watchdog.initd
new file mode 100644
index 000000000000..89043738a7e2
--- /dev/null
+++ b/sys-apps/busybox/files/watchdog.initd
@@ -0,0 +1,7 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/bin/busybox watchdog"
+command_args="${WATCHDOG_OPTS}"
+pidfile="/run/watchdog.pid"
diff --git a/sys-apps/busybox/metadata.xml b/sys-apps/busybox/metadata.xml
new file mode 100644
index 000000000000..66da6627b150
--- /dev/null
+++ b/sys-apps/busybox/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+<email>embedded@gentoo.org</email>
+<name>Embedded Gentoo</name>
+</maintainer>
+<use>
+<flag name="make-symlinks">Create all the appropriate symlinks in /bin and /sbin.</flag>
+<flag name="math">Enable math support in gawk (requires libm)</flag>
+<flag name="mdev">Create the appropriate symlink in /sbin and install mdev.conf and support files</flag>
+<flag name="sep-usr">Support a separate /usr without needing an initramfs by booting with init=/ginit</flag>
+<flag name="static">Make the system rescue shell (/bin/bb) static so you can recover even when glibc is broken</flag>
+<flag name="systemd">Support systemd</flag>
+</use>
+<upstream>
+<remote-id type="cpe">cpe:/a:busybox:busybox</remote-id>
+</upstream>
+</pkgmetadata>