Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/blueness:master commit in: sys-apps/busybox/, sys-apps/busybox/files/, sys-apps/busybox/files/mdev/
Date: Sat, 01 Dec 2012 02:32:39
Message-Id: 1354329114.a5f1cc25d0a7ff42c9e5e6d197bec99fa691a806.blueness@gentoo
1 commit: a5f1cc25d0a7ff42c9e5e6d197bec99fa691a806
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 1 02:31:54 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 1 02:31:54 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=commit;h=a5f1cc25
7
8 sys-apps/busybox: merge busybox-{sysklogd,ntpd,watchdog}, bug #444718
9
10 Package-Manager: portage-2.1.11.31
11 Manifest-Sign-Key: 0xF52D4BBA
12
13 ---
14 sys-apps/busybox/Manifest | 39 +++
15 sys-apps/busybox/busybox-9999.ebuild | 315 ++++++++++++++++++++
16 sys-apps/busybox/files/busybox-1.19.0-bb.patch | 22 ++
17 .../files/busybox-1.20.2-glibc-sys-resource.patch | 109 +++++++
18 .../files/busybox-1.20.2-selinux-pkg-config.patch | 67 ++++
19 sys-apps/busybox/files/busybox-ntpd.confd | 6 +
20 sys-apps/busybox/files/busybox-ntpd.initd | 21 ++
21 sys-apps/busybox/files/busybox-sysklogd.confd | 12 +
22 sys-apps/busybox/files/busybox-sysklogd.initd | 38 +++
23 sys-apps/busybox/files/busybox-watchdog.confd | 9 +
24 sys-apps/busybox/files/busybox-watchdog.initd | 21 ++
25 sys-apps/busybox/files/ginit.c | 124 ++++++++
26 sys-apps/busybox/files/mdev-start.sh | 125 ++++++++
27 sys-apps/busybox/files/mdev.rc | 9 +
28 sys-apps/busybox/files/mdev.rc.1 | 98 ++++++
29 sys-apps/busybox/files/mdev/dvbdev | 18 ++
30 sys-apps/busybox/files/mdev/ide_links | 23 ++
31 sys-apps/busybox/files/mdev/usbdev | 62 ++++
32 sys-apps/busybox/files/mdev/usbdisk_link | 34 ++
33 sys-apps/busybox/metadata.xml | 16 +
34 20 files changed, 1168 insertions(+), 0 deletions(-)
35
36 diff --git a/sys-apps/busybox/Manifest b/sys-apps/busybox/Manifest
37 new file mode 100644
38 index 0000000..a3b867b
39 --- /dev/null
40 +++ b/sys-apps/busybox/Manifest
41 @@ -0,0 +1,39 @@
42 +-----BEGIN PGP SIGNED MESSAGE-----
43 +Hash: SHA256
44 +
45 +AUX busybox-1.19.0-bb.patch 908 SHA256 98f92c2edbcf61d1bacef783ea8b08cce07051b0a4489ed3f4579296846f89f1 SHA512 d4024e531ce7113cf554646608b1ef356e51691e3e21d165621b3690c82b56a319867b90d9daba548b635d9dbd41be5efea63181b7123d4505e529d863a8214c WHIRLPOOL b0d6d9b08ad0930e5243c7addc8a6db61505e95ed8e72c64fbfd734cb6ff9e303b3eb8ea6ec4790b2be567783664230cf278eb3e673fa0844c3881cf993f7cb8
46 +AUX busybox-1.20.2-glibc-sys-resource.patch 3054 SHA256 03d64c3b864fc5caa9ec56e3d2bf3bcd43801ee82e27332dbfe412138c9502d7 SHA512 c895d7ad0bf379b3ff1c4114af7f8fe0d53b1e60371ac1faaaf3434c293e125be4d79a6ee17d1aa2a923629b09416b833dd3408b9b4dabf56dd74d630c24e9ff WHIRLPOOL ff3e347035a4eb500762d59e35ff8cd2a91130de1c73b0666331f62fc19c586646fd713814e6712d53449d484fc2479ec0e5c29dfe3a19feb2163350a9171fac
47 +AUX busybox-1.20.2-selinux-pkg-config.patch 2009 SHA256 09d34cafa860cfabfb6911b087fa5887dd7f8b0026955654904fdb79d5281e76 SHA512 7b9b5cfc890d6c751727c6873df66ada967973786a2056a33e76663358aefe2d5828b366f6ce85b573bc01737426a1019dd2f0177caceef9dfac32904ee01d84 WHIRLPOOL fef2b477065ed309298788e35b82fd77d3297eb52eb59f065ebb9c631ec4a3f849ef99a014bdf682469ee1e8683debc312993faf1ad094e2f9afd8ce99c955aa
48 +AUX busybox-ntpd.confd 186 SHA256 4bff7f5c66f4eece52e4381fd2706e591f10eb50f3c3a4132344d34150dc54de SHA512 b0ef111ea7dd6a096acf711d2d84a7c3d38e7e8c181f734053d38c565ab44ecf843ef32c0de0c4e7ecec990e97468a2545f83821beedb125cd6723ed74c67ad8 WHIRLPOOL a1b228ae22c61de6ecc7fa58edcd4c3941b3762a45fcc38d05bd1c9428bc553b1a158c101d65a99ba63d4bc19b269e834b3f0eba40a5a1c81e0ae876a2ecb42c
49 +AUX busybox-ntpd.initd 602 SHA256 95383156f6f417719bd4d5655e9291e2e7a3e9fa815329eb60c2b911e79f859b SHA512 6aff8dc4e7740f58f1d43aafd1aca22fecb9f138ec155e4a1bae43a214007e06d92bc648bf965f08fc151b00cc97c32f24bf0691847a79e684f3972ee7356d82 WHIRLPOOL 0b09ae03d45d9af92bda0f0f716c3c112c1be353e229fbe8d84614d87b844bc130d5d5cdb819d496382d943e584cca347465cc4139a9ed2d57212de85805d0bc
50 +AUX busybox-sysklogd.confd 319 SHA256 41a7dcb89156a80387a56579757e3a9f0f87ae4e0e955997e31092ab015a3152 SHA512 c9ddc5bec07c76b1ac4b3ceeb9dcdbaa96ef0791bc3a699b7cf1645d2765d74f5bb105e4d7912d67d8af0bf02e8447b6771edd789a05c7e4d9afeaf3a45896d2 WHIRLPOOL 6f2b18cea47118bfae04ecf932e62464a8574db1a2f45c5d4cb6d7a2352a117865bfffff9e367b51701c15103ef5a68f4b27a83b1e179ddfecb8529f68eb4038
51 +AUX busybox-sysklogd.initd 1256 SHA256 9302f0b7b4ee35c25195dc8c57bd3c2c55d85b3661aef7e551e39b3a5e26d604 SHA512 cdf95d8e39331f8887fc8955352587b39026f7aee00371499fca8e110f36f793ff58809de300da38b8fe58fbc0c953fbad70277eb13289087170fe93de86e4b5 WHIRLPOOL 05c5c4a9cf5e0524def3ef0210af9f39d669459c792f5fced46c92bec82337e621958d060ac86d3eb3d435a429401bcbd7310bd3e04e5bb0e431ff9f4cb46e8d
52 +AUX busybox-watchdog.confd 232 SHA256 786d9497ad55c29d6fff231709e71ecad94f2ee1de3b45b461deb29c3eba1c63 SHA512 8fd7121075535195f3e5d43ec773713c883fb7865cd5e5927b3b20c2605c50acb81d50461bd1a246c1282006ce74b11932ac1cec67ddc2be15da2f9aa8674232 WHIRLPOOL 8ea0f6b759198c978f10bf0b2b00cc73343e72401a05edf257b9c5e1032e8a619328aaa02936b5b5a717a021baa84b5653b8c9826e14e5c07c7b7af98f878767
53 +AUX busybox-watchdog.initd 640 SHA256 0cbfbf8fb77e678e609fc7bf7dc62700d3cf44acf40f3c53e2e522bc91de5c99 SHA512 85f9a13bedc6e55c7082c391c26dd85af9ca986810c0773adcb477b2c15240a1b1abf834fad8782d1595f651002d749ce80a139b00e524b75dcbcd209ed7df0e WHIRLPOOL ad085b343a299004e0f69b8c45e0003e5090b93d256ea16f74dbb39ef20cc71846ff61609455c2d638f7921419f68e8236ceb98f856149208d07ece2e1553ac0
54 +AUX ginit.c 3091 SHA256 c5a4d5dedf402742611fea7607f0d870a918da06ed5ee98796371e158956ca80 SHA512 70afaa9e7eea9f72b30ad43cbb5e70c2105c735eca888836791c2f289274fcec16545134aca4d7ab3d750bdefe445d0586fc115a6060b509a2e77ed8d37f0f3f WHIRLPOOL 43e925d52d2f05b474834288f82777c481d84fe8904e0390e2f3298cbea55f671706fa79dbc7b570c6d700f53b23667dcec058e397a06b1b1979e350c19b3e9b
55 +AUX mdev-start.sh 2758 SHA256 9904263c8dfe2b8c3e968a9b4245fa0c162a2413110c037cdd797ac3773587d7 SHA512 532ececdf40769e8059172b95f600c92ddda9490dcf04dc76b11cd669b2b35740aeb02ef7c152a42c13d5adfefb391de01239ebbb4efd06faadc0d096fcde6f5 WHIRLPOOL aace77a07eedfea3ffab029ce25334ff58f512bf5c67512c1f4a40fd51278c2b8b764e55dbf975f74bb4423cfc3f35482a5d3ee8397032fcbf22ad1f91c7c4ea
56 +AUX mdev.rc 282 SHA256 e52abbc3399fc85ce1f097e8f12b25a5ca7fe2e3d648bee60c061b547ba39dc5 SHA512 b3e5f0810a5e33047ea73c6a4d846087100fb8c566cfa001e07fc0c1448d2024913ac06355122076ec6c79146867af77a02bbc6509b009afa97b5207588da1b9 WHIRLPOOL 2bd20507d115c82076653c6c78899751f8e3b8cde14c81c8f10ef7747ccba867360b463c90b9b3053cd6cb8599f297362153ebbff0dfad90c2fac8f445668320
57 +AUX mdev.rc.1 2202 SHA256 5235a2cd5e4ce92032a5e3e314c6e2980d98df8a6a387d2cf3e0d30d29f62cd5 SHA512 27435ac949ee351aa957f23a31b08f8689f284449928fba495f9432c893e30cd8ab8f883ee131626310f09e9edc615908484c7402009df3cba3a6eaf137f8afc WHIRLPOOL 54c23164ed320efe654d36656bd4be2be383199c003a57806a850692b38556d4f961b9608c1561f16fa108bac64643ab2270a8a1a5edf8e5d1e24a967f549b76
58 +AUX mdev/dvbdev 356 SHA256 ef091bb4c8943a99b9a97b556cdc15ddd20275f5afa8287e201419b08c4e71de SHA512 ebd82f935da2ca89097234dd8a8f47e179a423652c151123a1f3343f3e1e7bfaba2b8800380e988d4e8f4294545d3a9ab6708ae2e77c5b108b5f091bbce8f94a WHIRLPOOL ec24a4afe8333e2d4d856fe3853b844d113057daf3fe536a4c8ef481a5ec925254c7daeb09df378922fabb96400440f4bde40979417b7c35467934d7e2235739
59 +AUX mdev/ide_links 440 SHA256 3fccc9ee437e3dcc8ac73bfe3713334a7156a112fe442e052fff4f26ff0f6a88 SHA512 0142234d0bda86ad1e5f88f1da34669e5fda46a0fd52ce507bd49ce74d2b7c12c323e8db863bccb924e6d632b568db8b243361b217c5b2e1d92a25feb6e62dec WHIRLPOOL ce02358a65ad2beeab12485379e322736c7b6b58ff44a20b880d9bab8806e04890a385b94228f2db685150dfe0a3c716f842ce5c1c7f579c8208ab4e9a6ae852
60 +AUX mdev/usbdev 1624 SHA256 113ecaa722fa1f4e1c76489e2a7b24099778615a5bccd443aa9cbab28c6d05d0 SHA512 f2d98050eeeb2fbb299298e221f47182a74ed901d2c8c848aa297ebd461c62c30d2fb968bb3eb723a6d9c268fac4a3c40a18aa59ed934043d42c38a1f6b9f5a2 WHIRLPOOL 9b773cb41827bf5777061ec7ed432315bc5bf070768a44ceec7c893af2266d8c06ea4c061711b2696a8228d72c7222fbf52d26fb92b4112158716727b3bc1e38
61 +AUX mdev/usbdisk_link 984 SHA256 4957f6991e0cb988b263b5276b582f1757deecad19cddebe3c615b381df9f858 SHA512 392c40d223bdff59a624bd67907c06cff9c1b5468c25c19e10dbc3cef3208275d93966e760f140d71a86cb36ec796ea08dbaa767b40c12e9326c3c72964b28a8 WHIRLPOOL 439e0c86e312e685bce1f7a4a67f709c4556de69b40112d97d6a376bc7da9d73e794663d06097f721173d97bf4f671ddbb4d0c4838db604e7cd13d2c531ede19
62 +EBUILD busybox-9999.ebuild 9415 SHA256 57b91eeb0b135ce4f2e518e1beb5fbd1939e2b9240937efef86154da5b472612 SHA512 0335dee69882fb84a779aca4f32fe3d9d2511490b7ad35e245c7d7460ad68af67b6638dddc747e46ba30b3287d346a634a46ae827459ddd3c7a2b2e41492f49e WHIRLPOOL 29116f0016ec7c2e1244d6c655337cced07fd4b909afdedd911afd73d8cb7fc92e6e4873d30a78f5080e7cf1b7409d5d2b00567bc52f017935e33c2d0dd141e2
63 +MISC metadata.xml 856 SHA256 96bd35614f2246ff9fbbcc5a3e78f524160279cb92c073b7bac2d9802e42de1a SHA512 974fa556e606efc3bd65d1486eefb2eefdef001fc882ba2ab436468313d948fe3d0a2701bd302f5107401604f6cdf4bf78f66f9b8f0ddf4be81e55c3958fffc2 WHIRLPOOL 5ccbbb9c8ee41a97074155eec2f602fc126597bf2030f9ae1c5ad8289e6765586ac83e6e1b58e9e411b20debb3fda959f58da8141948d60b5438a47ff24dcc06
64 +-----BEGIN PGP SIGNATURE-----
65 +Version: GnuPG v2.0.19 (GNU/Linux)
66 +
67 +iQIcBAEBCAAGBQJQuWwaAAoJEJOE+m71LUu6RXEP/2exxbdryvRbkhdUZfm9+Ea0
68 +vtOeuh0e6rJxv+i1ng9hxy0s7DRVrBRMRS8Vby3pnOGOQ/Fl3jWP88U5ptT8P2lv
69 +azPF77DpYf83bcRh/oI5YnW50aXyMVh21ro5jAMfCoto8Cdp0WLPKW0B3r8bQNQ6
70 +/DCMrdmiriI614PgkflErrEC6JqehyqSP9zvH8ZagMIpp8ZWhBLCriskJMJTFK73
71 +wtqZRhvYiHZL2QzaIMxsJh9ZOv3yfOmK+ogFeO5ZOppNN7ITzj3/U15i68w81aND
72 +6ANEdJH4Opi6viC7GsFtsKPxvCYzRQbh9KGr+Blsgs2zu/b/XUHWhSlpzFCMVQm8
73 +caaWZq3mEdoXHA9aQXREMi5OcxF+vszcphnMnVNSUrzYjnUtOR5RZJLtGba3V5SK
74 +8h9IkP5ZkuTJH4zJ3tEhU8i2T+vblhpaj+9JkHcMLjF9rmM57eESSRzniMOs1mG7
75 +A2QfrpK+G7oKuIVp7o5/NfRH4DUHUr3HUn1G0gElZ9X4RXhcf5JHZ7whBDS3+twi
76 +XKnBqyXmYf6EXFUjlADD6nb3W8t12msngl0IAXC8jscfyeFgKKogqAYGsQUy3HE9
77 +gzOG12DgIV2u4sID4pshmYDkUUq/OQp2F5m1sM/u74H+nGxNGtYfQ5WKkO3m1s5v
78 +V+SSF+KJnr2Ab74xLhK4
79 +=iqxt
80 +-----END PGP SIGNATURE-----
81
82 diff --git a/sys-apps/busybox/busybox-9999.ebuild b/sys-apps/busybox/busybox-9999.ebuild
83 new file mode 100644
84 index 0000000..d19d5cf
85 --- /dev/null
86 +++ b/sys-apps/busybox/busybox-9999.ebuild
87 @@ -0,0 +1,315 @@
88 +# Copyright 1999-2012 Gentoo Foundation
89 +# Distributed under the terms of the GNU General Public License v2
90 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/busybox-9999.ebuild,v 1.7 2012/11/02 18:59:14 vapier Exp $
91 +
92 +EAPI="4"
93 +inherit eutils flag-o-matic savedconfig toolchain-funcs multilib
94 +
95 +################################################################################
96 +# BUSYBOX ALTERNATE CONFIG MINI-HOWTO
97 +#
98 +# Busybox can be modified in many different ways. Here's a few ways to do it:
99 +#
100 +# (1) Emerge busybox with FEATURES=keepwork so the work directory won't
101 +# get erased afterwards. Add a definition like ROOT=/my/root/path to the
102 +# start of the line if you're installing to somewhere else than the root
103 +# directory. This command will save the default configuration to
104 +# ${PORTAGE_CONFIGROOT} (or ${ROOT} if ${PORTAGE_CONFIGROOT} is not
105 +# defined), and it will tell you that it has done this. Note the location
106 +# where the config file was saved.
107 +#
108 +# FEATURES=keepwork USE=savedconfig emerge busybox
109 +#
110 +# (2) Go to the work directory and change the configuration of busybox using its
111 +# menuconfig feature.
112 +#
113 +# cd /var/tmp/portage/busybox*/work/busybox-*
114 +# make menuconfig
115 +#
116 +# (3) Save your configuration to the default location and copy it to the
117 +# one of the locations listed in /usr/portage/eclass/savedconfig.eclass
118 +#
119 +# (4) Emerge busybox with USE=savedconfig to use the configuration file you
120 +# just generated.
121 +#
122 +################################################################################
123 +#
124 +# (1) Alternatively skip the above steps and simply emerge busybox without
125 +# USE=savedconfig.
126 +#
127 +# (2) Edit the file it saves by hand. ${ROOT}"/etc/portage/savedconfig/${CATEGORY}/${PF}
128 +#
129 +# (3) Remerge busybox as using USE=savedconfig.
130 +#
131 +################################################################################
132 +
133 +DESCRIPTION="Utilities for rescue and embedded systems"
134 +HOMEPAGE="http://www.busybox.net/"
135 +if [[ ${PV} == "9999" ]] ; then
136 + MY_P=${PN}
137 + EGIT_REPO_URI="git://busybox.net/busybox.git"
138 + inherit git-2
139 +else
140 + MY_P=${PN}-${PV/_/-}
141 + SRC_URI="http://www.busybox.net/downloads/${MY_P}.tar.bz2"
142 + KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
143 +fi
144 +
145 +LICENSE="GPL-2"
146 +SLOT="0"
147 +IUSE="ipv6 livecd make-symlinks math mdev ntpd -pam selinux sep-usr +static sysklogd systemd watchdog"
148 +RESTRICT="test"
149 +
150 +RDEPEND="!static? ( selinux? ( sys-libs/libselinux ) )
151 + pam? ( sys-libs/pam )"
152 +DEPEND="${RDEPEND}
153 + static? ( selinux? ( sys-libs/libselinux[static-libs(+)] ) )
154 + >=sys-kernel/linux-headers-2.6.39"
155 +
156 +S=${WORKDIR}/${MY_P}
157 +
158 +busybox_config_option() {
159 + case $1 in
160 + y) sed -i -e "s:.*\<CONFIG_$2\>.*set:CONFIG_$2=y:g" .config;;
161 + n) sed -i -e "s:CONFIG_$2=y:# CONFIG_$2 is not set:g" .config;;
162 + *) use $1 \
163 + && busybox_config_option y $2 \
164 + || busybox_config_option n $2
165 + return 0
166 + ;;
167 + esac
168 + einfo $(grep "CONFIG_$2[= ]" .config || echo Could not find CONFIG_$2 ...)
169 +}
170 +
171 +src_prepare() {
172 + unset KBUILD_OUTPUT #88088
173 + append-flags -fno-strict-aliasing #310413
174 + use ppc64 && append-flags -mminimal-toc #130943
175 +
176 + # patches go here!
177 + epatch "${FILESDIR}"/${PN}-1.19.0-bb.patch
178 + epatch "${FILESDIR}"/${P}-*.patch
179 + cp "${FILESDIR}"/ginit.c init/ || die
180 +
181 + # flag cleanup
182 + sed -i -r \
183 + -e 's:[[:space:]]?-(Werror|Os|falign-(functions|jumps|loops|labels)=1|fomit-frame-pointer)\>::g' \
184 + Makefile.flags || die
185 + #sed -i '/bbsh/s:^//::' include/applets.h
186 + sed -i '/^#error Aborting compilation./d' applets/applets.c || die
187 + use elibc_glibc && sed -i 's:-Wl,--gc-sections::' Makefile
188 + sed -i \
189 + -e "/^CROSS_COMPILE/s:=.*:= ${CHOST}-:" \
190 + -e "/^AR\>/s:=.*:= $(tc-getAR):" \
191 + -e "/^CC\>/s:=.*:= $(tc-getCC):" \
192 + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
193 + -e "/^PKG_CONFIG\>/s:=.*:= $(tc-getPKG_CONFIG):" \
194 + Makefile || die
195 + sed -i \
196 + -e 's:-static-libgcc::' \
197 + Makefile.flags || die
198 +}
199 +
200 +src_configure() {
201 + # check for a busybox config before making one of our own.
202 + # if one exist lets return and use it.
203 +
204 + restore_config .config
205 + if [ -f .config ]; then
206 + yes "" | emake -j1 oldconfig > /dev/null
207 + return 0
208 + else
209 + ewarn "Could not locate user configfile, so we will save a default one"
210 + fi
211 +
212 + # setup the config file
213 + emake -j1 allyesconfig > /dev/null
214 + # nommu forces a bunch of things off which we want on #387555
215 + busybox_config_option n NOMMU
216 + sed -i '/^#/d' .config
217 + yes "" | emake -j1 oldconfig >/dev/null
218 +
219 + # now turn off stuff we really don't want
220 + busybox_config_option n DMALLOC
221 + busybox_config_option n FEATURE_SUID_CONFIG
222 + busybox_config_option n BUILD_AT_ONCE
223 + busybox_config_option n BUILD_LIBBUSYBOX
224 + busybox_config_option n FEATURE_CLEAN_UP
225 + busybox_config_option n MONOTONIC_SYSCALL
226 + busybox_config_option n USE_PORTABLE_CODE
227 + busybox_config_option n WERROR
228 +
229 + # If these are not set and we are using a uclibc/busybox setup
230 + # all calls to system() will fail.
231 + busybox_config_option y ASH
232 + busybox_config_option n HUSH
233 +
234 + # disable ipv6 applets
235 + if ! use ipv6; then
236 + busybox_config_option n FEATURE_IPV6
237 + busybox_config_option n TRACEROUTE6
238 + busybox_config_option n PING6
239 + fi
240 +
241 + if use static && use pam ; then
242 + ewarn "You cannot have USE='static pam'. Assuming static is more important."
243 + fi
244 + busybox_config_option $(usex static n pam) PAM
245 + busybox_config_option static STATIC
246 + busybox_config_option systemd FEATURE_SYSTEMD
247 + busybox_config_option math FEATURE_AWK_LIBM
248 +
249 + # all the debug options are compiler related, so punt them
250 + busybox_config_option n DEBUG
251 + busybox_config_option y NO_DEBUG_LIB
252 + busybox_config_option n DMALLOC
253 + busybox_config_option n EFENCE
254 +
255 + busybox_config_option selinux SELINUX
256 +
257 + # this opt only controls mounting with <linux-2.6.23
258 + busybox_config_option n FEATURE_MOUNT_NFS
259 +
260 + # add busybox daemon's, bug #444718
261 + if use ntpd; then
262 + busybox_config_option y NTPD
263 + busybox_config_option y FEATURE_NTPD_SERVER
264 + fi
265 + if use sysklogd; then
266 + busybox_config_option y KLOGD
267 + busybox_config_option y FEATURE_KLOGD_KLOGCTL
268 + fi
269 + use watchdog && busybox_config_option y WATCHDOG
270 +
271 + # default a bunch of uncommon options to off
272 + local opt
273 + for opt in \
274 + ADD_SHELL \
275 + BEEP BOOTCHARTD \
276 + CRONTAB \
277 + DC DEVFSD DNSD DPKG{,_DEB} \
278 + FAKEIDENTD FBSPLASH FOLD FSCK_MINIX FTP{GET,PUT} \
279 + FEATURE_DEVFS \
280 + HOSTID HUSH \
281 + INETD INOTIFYD IPCALC \
282 + LOCALE_SUPPORT LOGNAME LPD \
283 + MAKEMIME MKFS_MINIX MSH \
284 + OD \
285 + RDEV READPROFILE REFORMIME REMOVE_SHELL RFKILL RUN_PARTS RUNSV{,DIR} \
286 + SLATTACH SMEMCAP SULOGIN SV{,LOGD} \
287 + TASKSET TCPSVD \
288 + RPM RPM2CPIO \
289 + UDPSVD UUDECODE UUENCODE
290 + do
291 + busybox_config_option n ${opt}
292 + done
293 +
294 + emake -j1 oldconfig > /dev/null
295 +}
296 +
297 +src_compile() {
298 + unset KBUILD_OUTPUT #88088
299 + export SKIP_STRIP=y
300 +
301 + emake V=1 busybox
302 +}
303 +
304 +src_install() {
305 + unset KBUILD_OUTPUT #88088
306 + save_config .config
307 +
308 + into /
309 + dodir /bin
310 + if use sep-usr ; then
311 + # install /ginit to take care of mounting stuff
312 + exeinto /
313 + newexe busybox_unstripped ginit
314 + dosym /ginit /bin/bb
315 + dosym bb /bin/busybox
316 + else
317 + newbin busybox_unstripped busybox
318 + dosym busybox /bin/bb
319 + fi
320 + if use mdev ; then
321 + dodir /$(get_libdir)/mdev/
322 + use make-symlinks || dosym /bin/bb /sbin/mdev
323 + cp "${S}"/examples/mdev_fat.conf "${ED}"/etc/mdev.conf
324 +
325 + exeinto /$(get_libdir)/mdev/
326 + doexe "${FILESDIR}"/mdev/*
327 +
328 + newinitd "${FILESDIR}"/mdev.rc.1 mdev
329 + fi
330 + if use livecd ; then
331 + dosym busybox /bin/vi
332 + fi
333 +
334 + # add busybox daemon's, bug #444718
335 + if use ntpd; then
336 + newconfd "${FILESDIR}/ntpd.confd" "ntpd-busybox"
337 + newinitd "${FILESDIR}/ntpd.initd" "ntpd-busybox"
338 + fi
339 + if use sysklogd; then
340 + newconfd "${FILESDIR}/sysklogd.confd" "sysklogd-busybox"
341 + newinitd "${FILESDIR}/sysklogd.initd" "sysklogd-busybox"
342 + fi
343 + if use watchdog; then
344 + newconfd "${FILESDIR}/watchdog.confd" "watchdog-busybox"
345 + newinitd "${FILESDIR}/watchdog.initd" "watchdog-busybox"
346 + fi
347 +
348 + # bundle up the symlink files for use later
349 + emake DESTDIR="${ED}" install
350 + rm _install/bin/busybox
351 + tar cf busybox-links.tar -C _install . || : #;die
352 + insinto /usr/share/${PN}
353 + use make-symlinks && doins busybox-links.tar
354 +
355 + dodoc AUTHORS README TODO
356 +
357 + cd docs
358 + docinto txt
359 + dodoc *.txt
360 + docinto pod
361 + dodoc *.pod
362 + dohtml *.html
363 +
364 + cd ../examples
365 + docinto examples
366 + dodoc inittab depmod.pl *.conf *.script undeb unrpm
367 +}
368 +
369 +pkg_preinst() {
370 + if use make-symlinks && [[ ! ${VERY_BRAVE_OR_VERY_DUMB} == "yes" ]] && [[ ${ROOT} == "/" ]] ; then
371 + ewarn "setting USE=make-symlinks and emerging to / is very dangerous."
372 + ewarn "it WILL overwrite lots of system programs like: ls bash awk grep (bug 60805 for full list)."
373 + ewarn "If you are creating a binary only and not merging this is probably ok."
374 + ewarn "set env VERY_BRAVE_OR_VERY_DUMB=yes if this is really what you want."
375 + die "silly options will destroy your system"
376 + fi
377 +
378 + if use make-symlinks ; then
379 + mv "${ED}"/usr/share/${PN}/busybox-links.tar "${T}"/ || die
380 + fi
381 +}
382 +
383 +pkg_postinst() {
384 + savedconfig_pkg_postinst
385 +
386 + if use make-symlinks ; then
387 + cd "${T}" || die
388 + mkdir _install
389 + tar xf busybox-links.tar -C _install || die
390 + cp -vpPR _install/* "${ROOT}"/ || die "copying links for ${x} failed"
391 + fi
392 +
393 + if use sep-usr ; then
394 + elog "In order to use the sep-usr support, you have to update your"
395 + elog "kernel command line. Add the option:"
396 + elog " init=/ginit"
397 + elog "To launch a different init than /sbin/init, use:"
398 + elog " init=/ginit /sbin/yourinit"
399 + elog "To get a rescue shell, you may boot with:"
400 + elog " init=/ginit bb"
401 + fi
402 +}
403
404 diff --git a/sys-apps/busybox/files/busybox-1.19.0-bb.patch b/sys-apps/busybox/files/busybox-1.19.0-bb.patch
405 new file mode 100644
406 index 0000000..a66b45a
407 --- /dev/null
408 +++ b/sys-apps/busybox/files/busybox-1.19.0-bb.patch
409 @@ -0,0 +1,22 @@
410 +--- a/shell/ash.c
411 ++++ b/shell/ash.c
412 +@@ -75,6 +75,8 @@
413 + //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
414 + //applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
415 + //applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash))
416 ++//applet:IF_ASH(APPLET_ODDNAME(bb, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
417 ++//applet:IF_ASH(APPLET_ODDNAME(bbsh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
418 +
419 + //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
420 + //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
421 +--- a/shell/ash.c
422 ++++ b/shell/ash.c
423 +@@ -7255,6 +7255,8 @@
424 + }
425 + /* re-exec ourselves with the new arguments */
426 + execve(bb_busybox_exec_path, argv, envp);
427 ++ execve("/bin/busybox.static", argv, envp);
428 ++ execve("/bin/busybox", argv, envp);
429 + /* If they called chroot or otherwise made the binary no longer
430 + * executable, fall through */
431 + }
432
433 diff --git a/sys-apps/busybox/files/busybox-1.20.2-glibc-sys-resource.patch b/sys-apps/busybox/files/busybox-1.20.2-glibc-sys-resource.patch
434 new file mode 100644
435 index 0000000..f682d00
436 --- /dev/null
437 +++ b/sys-apps/busybox/files/busybox-1.20.2-glibc-sys-resource.patch
438 @@ -0,0 +1,109 @@
439 +https://bugs.gentoo.org/424954
440 +
441 +From c5fe9f7b723f949457263ef8e22ab807d5b549ce Mon Sep 17 00:00:00 2001
442 +From: Mike Frysinger <vapier@g.o>
443 +Date: Thu, 5 Jul 2012 23:19:09 -0400
444 +Subject: [PATCH] include sys/resource.h where needed
445 +
446 +We use functions from sys/resource.h in misc applets, but don't include
447 +the header. This breaks building with newer glibc versions, so add the
448 +include where needed.
449 +
450 +Signed-off-by: Mike Frysinger <vapier@g.o>
451 +---
452 + loginutils/passwd.c | 1 +
453 + miscutils/time.c | 1 +
454 + networking/inetd.c | 1 +
455 + networking/ntpd.c | 1 +
456 + networking/ntpd_simple.c | 1 +
457 + runit/chpst.c | 1 +
458 + shell/shell_common.c | 1 +
459 + 7 files changed, 7 insertions(+)
460 +
461 +diff --git a/loginutils/passwd.c b/loginutils/passwd.c
462 +index b83db00..a7006f0 100644
463 +--- a/loginutils/passwd.c
464 ++++ b/loginutils/passwd.c
465 +@@ -15,6 +15,7 @@
466 +
467 + #include "libbb.h"
468 + #include <syslog.h>
469 ++#include <sys/resource.h> /* setrlimit */
470 +
471 + static void nuke_str(char *str)
472 + {
473 +diff --git a/miscutils/time.c b/miscutils/time.c
474 +index 945f15f..ffed386 100644
475 +--- a/miscutils/time.c
476 ++++ b/miscutils/time.c
477 +@@ -16,6 +16,7 @@
478 + //usage: "\n -v Verbose"
479 +
480 + #include "libbb.h"
481 ++#include <sys/resource.h> /* getrusage */
482 +
483 + /* Information on the resources used by a child process. */
484 + typedef struct {
485 +diff --git a/networking/inetd.c b/networking/inetd.c
486 +index 1308d74..00baf69 100644
487 +--- a/networking/inetd.c
488 ++++ b/networking/inetd.c
489 +@@ -165,6 +165,7 @@
490 + //usage: "\n (default: 0 - disabled)"
491 +
492 + #include <syslog.h>
493 ++#include <sys/resource.h> /* setrlimit */
494 + #include <sys/un.h>
495 +
496 + #include "libbb.h"
497 +diff --git a/networking/ntpd.c b/networking/ntpd.c
498 +index 72e9d0b..5b92db6 100644
499 +--- a/networking/ntpd.c
500 ++++ b/networking/ntpd.c
501 +@@ -46,6 +46,7 @@
502 + #include "libbb.h"
503 + #include <math.h>
504 + #include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
505 ++#include <sys/resource.h> /* setpriority */
506 + #include <sys/timex.h>
507 + #ifndef IPTOS_LOWDELAY
508 + # define IPTOS_LOWDELAY 0x10
509 +diff --git a/networking/ntpd_simple.c b/networking/ntpd_simple.c
510 +index 4ad44e4..1b7c66b 100644
511 +--- a/networking/ntpd_simple.c
512 ++++ b/networking/ntpd_simple.c
513 +@@ -7,6 +7,7 @@
514 + */
515 + #include "libbb.h"
516 + #include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
517 ++#include <sys/resource.h> /* setpriority */
518 + #ifndef IPTOS_LOWDELAY
519 + # define IPTOS_LOWDELAY 0x10
520 + #endif
521 +diff --git a/runit/chpst.c b/runit/chpst.c
522 +index ac296ba..ed72c8b 100644
523 +--- a/runit/chpst.c
524 ++++ b/runit/chpst.c
525 +@@ -91,6 +91,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
526 + //usage: "\n a SIGXCPU after N seconds"
527 +
528 + #include "libbb.h"
529 ++#include <sys/resource.h> /* getrlimit */
530 +
531 + /*
532 + Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit.
533 +diff --git a/shell/shell_common.c b/shell/shell_common.c
534 +index 51c92d6..780e27e 100644
535 +--- a/shell/shell_common.c
536 ++++ b/shell/shell_common.c
537 +@@ -18,6 +18,7 @@
538 + */
539 + #include "libbb.h"
540 + #include "shell_common.h"
541 ++#include <sys/resource.h> /* getrlimit */
542 +
543 + const char defifsvar[] ALIGN1 = "IFS= \t\n";
544 +
545 +--
546 +1.7.9.7
547 +
548
549 diff --git a/sys-apps/busybox/files/busybox-1.20.2-selinux-pkg-config.patch b/sys-apps/busybox/files/busybox-1.20.2-selinux-pkg-config.patch
550 new file mode 100644
551 index 0000000..5e9ef26
552 --- /dev/null
553 +++ b/sys-apps/busybox/files/busybox-1.20.2-selinux-pkg-config.patch
554 @@ -0,0 +1,67 @@
555 +From 5694afd72a0a424fcdd2ac85838229a1a86b7e84 Mon Sep 17 00:00:00 2001
556 +From: Mike Frysinger <vapier@g.o>
557 +Date: Sat, 20 Oct 2012 15:01:26 -0400
558 +Subject: [PATCH] build system: use pkg-config to look up selinux libs
559 +
560 +Newer versions of libselinux has started linking against more libs.
561 +Rather than continuing hardcoding things, switch to using pkg-config
562 +to query for its dependencies.
563 +
564 +Signed-off-by: Mike Frysinger <vapier@g.o>
565 +---
566 + Makefile | 1 +
567 + Makefile.flags | 12 +++++++++++-
568 + 2 files changed, 12 insertions(+), 1 deletion(-)
569 +
570 +diff --git a/Makefile b/Makefile
571 +index b2e9477..8995ff5 100644
572 +--- a/Makefile
573 ++++ b/Makefile
574 +@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm
575 + STRIP = $(CROSS_COMPILE)strip
576 + OBJCOPY = $(CROSS_COMPILE)objcopy
577 + OBJDUMP = $(CROSS_COMPILE)objdump
578 ++PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
579 + AWK = awk
580 + GENKSYMS = scripts/genksyms/genksyms
581 + DEPMOD = /sbin/depmod
582 +diff --git a/Makefile.flags b/Makefile.flags
583 +index e77c0e5..307afa7 100644
584 +--- a/Makefile.flags
585 ++++ b/Makefile.flags
586 +@@ -78,6 +78,12 @@ ARCH_FPIC ?= -fpic
587 + ARCH_FPIE ?= -fpie
588 + ARCH_PIE ?= -pie
589 +
590 ++# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES))
591 ++define pkg_check_modules
592 ++$(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2))
593 ++$(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2))
594 ++endef
595 ++
596 + ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
597 + # on i386: 14% smaller libbusybox.so
598 + # (code itself is 9% bigger, we save on relocs/PLT/GOT)
599 +@@ -89,6 +95,7 @@ endif
600 +
601 + ifeq ($(CONFIG_STATIC),y)
602 + CFLAGS_busybox += -static
603 ++PKG_CONFIG_FLAGS += --static
604 + endif
605 +
606 + ifeq ($(CONFIG_PIE),y)
607 +@@ -131,7 +138,10 @@ LDLIBS += pam pam_misc pthread
608 + endif
609 +
610 + ifeq ($(CONFIG_SELINUX),y)
611 +-LDLIBS += selinux sepol
612 ++SELINUX_PC_MODULES = libselinux libsepol
613 ++$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
614 ++CPPFLAGS += $(SELINUX_CFLAGS)
615 ++LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
616 + endif
617 +
618 + ifeq ($(CONFIG_EFENCE),y)
619 +--
620 +1.7.12
621 +
622
623 diff --git a/sys-apps/busybox/files/busybox-ntpd.confd b/sys-apps/busybox/files/busybox-ntpd.confd
624 new file mode 100644
625 index 0000000..f50d4c2
626 --- /dev/null
627 +++ b/sys-apps/busybox/files/busybox-ntpd.confd
628 @@ -0,0 +1,6 @@
629 +# Config file for /etc/init.d/busybox-ntpd
630 +
631 +# run "/sbin/ntpd --help" to see all possible options.
632 +
633 +# Get time from specified server and run in background
634 +NTPD_OPTS="-N -p pool.ntp.org"
635
636 diff --git a/sys-apps/busybox/files/busybox-ntpd.initd b/sys-apps/busybox/files/busybox-ntpd.initd
637 new file mode 100644
638 index 0000000..495bc53
639 --- /dev/null
640 +++ b/sys-apps/busybox/files/busybox-ntpd.initd
641 @@ -0,0 +1,21 @@
642 +#!/sbin/runscript
643 +# Copyright 1999-2012 Gentoo Foundation
644 +# Distributed under the terms of the GNU General Public License v2
645 +# $Header: /var/cvsroot/gentoo-x86/net-misc/busybox-ntpd/files/busybox-ntpd.initd,v 1.1 2012/08/21 12:39:10 sbriesen Exp $
646 +
647 +depend() {
648 + use net dns logger
649 + after ntp-client
650 +}
651 +
652 +start() {
653 + ebegin "Starting busybox-ntpd"
654 + start-stop-daemon --start --quiet --exec /bin/busybox ntpd -- ${NTPD_OPTS}
655 + eend ${?} "Failed to start ntpd"
656 +}
657 +
658 +stop() {
659 + ebegin "Stopping busybox-ntpd"
660 + start-stop-daemon --stop --retry 15 --quiet --exec /bin/busybox nptd
661 + eend ${?} "Failed to stop ntpd"
662 +}
663
664 diff --git a/sys-apps/busybox/files/busybox-sysklogd.confd b/sys-apps/busybox/files/busybox-sysklogd.confd
665 new file mode 100644
666 index 0000000..793f475
667 --- /dev/null
668 +++ b/sys-apps/busybox/files/busybox-sysklogd.confd
669 @@ -0,0 +1,12 @@
670 +# Config file for /etc/init.d/busybox-sysklogd
671 +
672 +# run "/sbin/syslogd --help" and "/sbin/klogd --help" to see all possible options.
673 +
674 +# activate if you need remote logging
675 +#rc_need="net"
676 +
677 +# Log to shared mem buffer (use logread to read it)
678 +SYSLOGD_OPTS="-C128"
679 +
680 +# send warnings and above to the console
681 +KLOGD_OPTS="-c 3"
682
683 diff --git a/sys-apps/busybox/files/busybox-sysklogd.initd b/sys-apps/busybox/files/busybox-sysklogd.initd
684 new file mode 100644
685 index 0000000..85e87d1
686 --- /dev/null
687 +++ b/sys-apps/busybox/files/busybox-sysklogd.initd
688 @@ -0,0 +1,38 @@
689 +#!/sbin/runscript
690 +# Copyright 1999-2012 Gentoo Foundation
691 +# Distributed under the terms of the GNU General Public License v2
692 +# $Header: /var/cvsroot/gentoo-x86/app-admin/busybox-sysklogd/files/busybox-sysklogd.initd,v 1.1 2012/08/21 12:44:33 sbriesen Exp $
693 +
694 +depend() {
695 + need clock hostname
696 + provide logger
697 +}
698 +
699 +start() {
700 + local retval=0 daemon="busybox syslogd"
701 + ebegin "Starting busybox-sysklogd"
702 + start-stop-daemon --start --quiet --exec /bin/busybox syslogd --pidfile /var/run/syslogd.pid -- ${SYSLOGD_OPTS}
703 + retval=${?}
704 + if [ ${retval} -eq 0 ]; then
705 + daemon="busybox klogd"
706 + start-stop-daemon --start --quiet --exec /bin/busybox klogd -- ${KLOGD_OPTS}
707 + retval=${?}
708 + if [ ${retval} -ne 0 ]; then
709 + start-stop-daemon --stop --retry 15 --quiet --exec /bin/busybox syslogd --pidfile /var/run/syslogd.pid
710 + fi
711 + fi
712 + eend ${retval} "Failed to start ${daemon}"
713 +}
714 +
715 +stop() {
716 + local retval=0 daemon="busybox klogd"
717 + ebegin "Stopping busybox-sysklogd"
718 + start-stop-daemon --stop --retry 15 --quiet --exec /bin/busybox klogd
719 + retval=${?}
720 + if [ ${retval} -eq 0 ]; then
721 + daemon="busybox syslogd"
722 + start-stop-daemon --stop --retry 15 --quiet --exec /bin/busybox syslogd --pidfile /var/run/syslogd.pid
723 + retval=${?}
724 + fi
725 + eend ${retval} "Failed to stop ${daemon}"
726 +}
727
728 diff --git a/sys-apps/busybox/files/busybox-watchdog.confd b/sys-apps/busybox/files/busybox-watchdog.confd
729 new file mode 100644
730 index 0000000..bd6aec0
731 --- /dev/null
732 +++ b/sys-apps/busybox/files/busybox-watchdog.confd
733 @@ -0,0 +1,9 @@
734 +# Config file for /etc/init.d/busybox-watchdog
735 +
736 +# run "/sbin/watchdog --help" to see all possible options.
737 +
738 +# Periodically write to watchdog device
739 +WATCHDOG_OPTS="/dev/watchdog"
740 +
741 +# optionally set the nice-level
742 +#SSD_NICELEVEL="-20"
743
744 diff --git a/sys-apps/busybox/files/busybox-watchdog.initd b/sys-apps/busybox/files/busybox-watchdog.initd
745 new file mode 100644
746 index 0000000..a9a681d
747 --- /dev/null
748 +++ b/sys-apps/busybox/files/busybox-watchdog.initd
749 @@ -0,0 +1,21 @@
750 +#!/sbin/runscript
751 +# Copyright 1999-2012 Gentoo Foundation
752 +# Distributed under the terms of the GNU General Public License v2
753 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox-watchdog/files/busybox-watchdog.initd,v 1.2 2012/08/29 13:27:03 sbriesen Exp $
754 +
755 +depend() {
756 + provide watchdog
757 +}
758 +
759 +start() {
760 + export SSD_NICELEVEL
761 + ebegin "Starting busybox-watchdog"
762 + start-stop-daemon --start --quiet --exec /bin/busybox watchdog -- ${WATCHDOG_OPTS}
763 + eend ${?} "Failed to start watchdog"
764 +}
765 +
766 +stop() {
767 + ebegin "Stopping busybox-watchdog"
768 + start-stop-daemon --stop --retry 15 --quiet --exec /bin/busybox watchdog
769 + eend ${?} "Failed to stop watchdog"
770 +}
771
772 diff --git a/sys-apps/busybox/files/ginit.c b/sys-apps/busybox/files/ginit.c
773 new file mode 100644
774 index 0000000..355ae48
775 --- /dev/null
776 +++ b/sys-apps/busybox/files/ginit.c
777 @@ -0,0 +1,124 @@
778 +/*
779 + * simple init to bootstrap sep-/usr
780 + *
781 + * Copyright (C) 2012 Mike Frysinger <vapier@g.o>
782 + *
783 + * Licensed under GPLv2 or later
784 + */
785 +
786 +//applet:IF_INIT(APPLET(ginit, BB_DIR_SBIN, BB_SUID_DROP))
787 +
788 +//kbuild:lib-$(CONFIG_GINIT) += ginit.o
789 +
790 +//config:config GINIT
791 +//config: bool "ginit"
792 +//config: default y
793 +//config: select MKDIR
794 +//config: select MDEV
795 +//config: select MOUNT
796 +//config: select MOUNTPOINT
797 +//config: help
798 +//config: sep-/usr bootstrapper
799 +
800 +//usage:#define ginit_trivial_usage NOUSAGE_STR
801 +//usage:#define ginit_full_usage ""
802 +
803 +#include "libbb.h"
804 +
805 +#define eprintf(fmt, args...) printf("%s" fmt, "sep-usr init: ", ## args)
806 +
807 +static void process_args(char **args)
808 +{
809 + size_t i;
810 +
811 + eprintf("running: ");
812 + for (i = 0; args[i]; ++i) {
813 + /* String needs to be writable, so dupe it */
814 + args[i] = xstrdup(args[i]);
815 + printf("'%s' ", args[i]);
816 + }
817 + printf("\n");
818 +}
819 +
820 +int ginit_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
821 +int ginit_main(int argc UNUSED_PARAM, char **argv)
822 +{
823 + FILE *mntlist;
824 + bool ismnted_dev, ismnted_sys, ismnted_usr;
825 + struct mntent *mntent;
826 +
827 + /*
828 + int fd = open("/dev/console", O_RDWR);
829 + if (fd >= 0) {
830 + dup2(fd, 0);
831 + dup2(fd, 1);
832 + dup2(fd, 2);
833 + }
834 + */
835 +
836 + /* If given an argv[] with an applet name, run it instead.
837 + * Makes recovering simple by doing: init=/ginit bb
838 + */
839 + if (argv[1] && argv[1][0] != '/') {
840 + eprintf("running user requested applet %s\n", argv[1]);
841 + return spawn_and_wait(argv+1);
842 + }
843 +
844 +#define saw(argv...) \
845 + ({ \
846 + static const char *args[] = { argv, NULL }; \
847 + /* These casts are fine -- see process_args for mem setup */ \
848 + process_args((void *)args); \
849 + spawn_and_wait((void *)args); \
850 + })
851 +
852 + /* First setup basic /dev */
853 + if (saw("mountpoint", "-q", "/dev") != 0) {
854 + /* Try /etc/fstab */
855 + if (saw("mount", "-n", "/dev"))
856 + /* Then devtmpfs */
857 + if (saw("mount", "-n", "-t", "devtmpfs", "devtmpfs", "/dev"))
858 + /* Finally normal tmpfs */
859 + saw("mount", "-n", "-t", "tmpfs", "dev", "/dev");
860 + } else {
861 + eprintf("%s appears to be mounted; skipping its setup\n", "/dev");
862 + }
863 +
864 + /* If /dev is empty (e.g. tmpfs), run mdev to seed things */
865 + if (access("/dev/console", F_OK) != 0) {
866 + if (saw("mountpoint", "-q", "/sys") != 0) {
867 + if (saw("mount", "-n", "/sys"))
868 + saw("mount", "-n", "-t", "sysfs", "sysfs", "/sys");
869 + } else {
870 + eprintf("%s appears to be mounted; skipping its setup\n", "/sys");
871 + }
872 +
873 + /* Mount /proc as mdev will fork+exec /proc/self/exe */
874 + if (saw("mountpoint", "-q", "/proc") != 0) {
875 + /* Try /etc/fstab */
876 + if (saw("mount", "-n", "/proc"))
877 + saw("mount", "-n", "-t", "proc", "proc", "/proc");
878 + }
879 +
880 + saw("mdev", "-s");
881 + }
882 +
883 + /* Then seed the stuff we care about */
884 + saw("mkdir", "-p", "/dev/pts", "/dev/shm");
885 +
886 + /* Then mount /usr */
887 + if (saw("mountpoint", "-q", "/usr") != 0) {
888 + saw("mount", "-n", "/usr", "-o", "ro");
889 + } else {
890 + eprintf("%s appears to be mounted; skipping its setup\n", "/usr");
891 + }
892 +
893 + /* Now that we're all done, exec the real init */
894 + if (!argv[1]) {
895 + argv[0] = (void *)"/sbin/init";
896 + argv[1] = NULL;
897 + } else
898 + ++argv;
899 + process_args(argv);
900 + return execv(argv[0], argv);
901 +}
902
903 diff --git a/sys-apps/busybox/files/mdev-start.sh b/sys-apps/busybox/files/mdev-start.sh
904 new file mode 100755
905 index 0000000..8784cd5
906 --- /dev/null
907 +++ b/sys-apps/busybox/files/mdev-start.sh
908 @@ -0,0 +1,125 @@
909 +# Copyright 1999-2008 Gentoo Foundation
910 +# Distributed under the terms of the GNU General Public License v2
911 +
912 +find_mdev()
913 +{
914 + if [ -x /sbin/mdev ] ; then
915 + echo "/sbin/mdev"
916 + else
917 + echo "/bin/busybox mdev"
918 + fi
919 +}
920 +
921 +populate_mdev()
922 +{
923 + # populate /dev with devices already found by the kernel
924 +
925 + if get_bootparam "nocoldplug" ; then
926 + RC_COLDPLUG="no"
927 + ewarn "Skipping mdev coldplug as requested in kernel cmdline"
928 + fi
929 +
930 + ebegin "Populating /dev with existing devices with mdev -s"
931 + $(find_mdev) -s
932 + eend $?
933 +
934 + return 0
935 +}
936 +
937 +seed_dev()
938 +{
939 + # Seed /dev with some things that we know we need
940 +
941 + # creating /dev/console and /dev/tty1 to be able to write
942 + # to $CONSOLE with/without bootsplash before mdev creates it
943 + [ -c /dev/console ] || mknod /dev/console c 5 1
944 + [ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1
945 +
946 + # udevd will dup its stdin/stdout/stderr to /dev/null
947 + # and we do not want a file which gets buffered in ram
948 + [ -c /dev/null ] || mknod /dev/null c 1 3
949 +
950 + # copy over any persistant things
951 + if [ -d /lib/mdev/devices ] ; then
952 + cp -RPp /lib/mdev/devices/* /dev 2>/dev/null
953 + fi
954 +
955 + # Not provided by sysfs but needed
956 + ln -snf /proc/self/fd /dev/fd
957 + ln -snf fd/0 /dev/stdin
958 + ln -snf fd/1 /dev/stdout
959 + ln -snf fd/2 /dev/stderr
960 + [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
961 +
962 + # Create problematic directories
963 + mkdir -p /dev/pts /dev/shm
964 +}
965 +
966 +mount_it_b1()
967 +{
968 + if [ "${RC_USE_FSTAB}" = "yes" ] ; then
969 + mntcmd=$(get_mount_fstab /dev)
970 + else
971 + unset mntcmd
972 + fi
973 + if [ -n "${mntcmd}" ] ; then
974 + try mount -n ${mntcmd}
975 + else
976 + if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems ; then
977 + mntcmd="tmpfs"
978 + else
979 + mntcmd="ramfs"
980 + fi
981 + # many video drivers require exec access in /dev #92921
982 + try mount -n -t "${mntcmd}" -o exec,nosuid,mode=0755 mdev /dev
983 + fi
984 +}
985 +mount_it_b2()
986 +{
987 + if fstabinfo --quiet /dev ; then
988 + mount -n /dev
989 + else
990 + # Some devices require exec, Bug #92921
991 + mount -n -t tmpfs -o "exec,nosuid,mode=0755,size=10M" mdev /dev
992 + fi
993 +}
994 +mount_it()
995 +{
996 + type fstabinfo && mount_it_b2 || mount_it_b1
997 +}
998 +
999 +main()
1000 +{
1001 + # Setup temporary storage for /dev
1002 + ebegin "Mounting /dev for mdev"
1003 + mount_it
1004 + eend $?
1005 +
1006 + # Create a file so that our rc system knows it's still in sysinit.
1007 + # Existance means init scripts will not directly run.
1008 + # rc will remove the file when done with sysinit.
1009 + touch /dev/.rcsysinit
1010 +
1011 + # Selinux lovin; /selinux should be mounted by selinux-patched init
1012 + if [ -x /sbin/restorecon ] && [ -c /selinux/null ] ; then
1013 + restorecon /dev > /selinux/null
1014 + fi
1015 +
1016 + seed_dev
1017 +
1018 + # Setup hotplugging (if possible)
1019 + if [ -e /proc/sys/kernel/hotplug ] ; then
1020 + ebegin "Setting up proper hotplug agent"
1021 + eindent
1022 + einfo "Setting /sbin/mdev as hotplug agent ..."
1023 + echo $(find_mdev) > /proc/sys/kernel/hotplug
1024 + eoutdent
1025 + eend 0
1026 + fi
1027 +
1028 + populate_mdev
1029 +}
1030 +
1031 +main
1032 +
1033 +# vim:ts=4
1034
1035 diff --git a/sys-apps/busybox/files/mdev.rc b/sys-apps/busybox/files/mdev.rc
1036 new file mode 100755
1037 index 0000000..5470404
1038 --- /dev/null
1039 +++ b/sys-apps/busybox/files/mdev.rc
1040 @@ -0,0 +1,9 @@
1041 +#!/sbin/runscript
1042 +# Copyright 1999-2010 Gentoo Foundation
1043 +# Distributed under the terms of the GNU General Public License v2
1044 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/files/mdev.rc,v 1.1 2010/08/15 03:55:29 vapier Exp $
1045 +
1046 +start()
1047 +{
1048 + . /lib/rcscripts/addons/mdev-start.sh
1049 +}
1050
1051 diff --git a/sys-apps/busybox/files/mdev.rc.1 b/sys-apps/busybox/files/mdev.rc.1
1052 new file mode 100755
1053 index 0000000..569d540
1054 --- /dev/null
1055 +++ b/sys-apps/busybox/files/mdev.rc.1
1056 @@ -0,0 +1,98 @@
1057 +#!/sbin/runscript
1058 +# Copyright 1999-2012 Gentoo Foundation
1059 +# Distributed under the terms of the GNU General Public License v2
1060 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/busybox/files/mdev.rc.1,v 1.2 2012/09/26 21:25:23 robbat2 Exp $
1061 +
1062 +depend()
1063 +{
1064 + provide dev dev-mount
1065 + need sysfs
1066 +}
1067 +
1068 +find_mdev()
1069 +{
1070 + if [ -x /sbin/mdev ] ; then
1071 + echo "/sbin/mdev"
1072 + else
1073 + echo "/bin/busybox mdev"
1074 + fi
1075 +}
1076 +
1077 +populate_mdev()
1078 +{
1079 + # populate /dev with devices already found by the kernel
1080 +
1081 + if get_bootparam "nocoldplug" ; then
1082 + RC_COLDPLUG="no"
1083 + ewarn "Skipping mdev coldplug as requested in kernel cmdline"
1084 + fi
1085 +
1086 + ebegin "Populating /dev with existing devices with mdev -s"
1087 + $(find_mdev) -s
1088 + eend $?
1089 +
1090 + return 0
1091 +}
1092 +
1093 +seed_dev()
1094 +{
1095 + # Seed /dev with some things that we know we need
1096 +
1097 + # creating /dev/console and /dev/tty1 to be able to write
1098 + # to $CONSOLE with/without bootsplash before mdev creates it
1099 + [ -c /dev/console ] || mknod /dev/console c 5 1
1100 + [ -c /dev/tty1 ] || mknod /dev/tty1 c 4 1
1101 +
1102 + # udevd will dup its stdin/stdout/stderr to /dev/null
1103 + # and we do not want a file which gets buffered in ram
1104 + [ -c /dev/null ] || mknod /dev/null c 1 3
1105 +
1106 + # copy over any persistant things
1107 + if [ -d /lib/mdev/devices ] ; then
1108 + cp -RPp /lib/mdev/devices/* /dev 2>/dev/null
1109 + fi
1110 +
1111 + # Not provided by sysfs but needed
1112 + ln -snf /proc/self/fd /dev/fd
1113 + ln -snf fd/0 /dev/stdin
1114 + ln -snf fd/1 /dev/stdout
1115 + ln -snf fd/2 /dev/stderr
1116 + [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
1117 +
1118 + # Create problematic directories
1119 + mkdir -p /dev/pts /dev/shm
1120 +}
1121 +
1122 +mount_it()
1123 +{
1124 + if fstabinfo --quiet /dev ; then
1125 + mount -n /dev
1126 + else
1127 + # Some devices require exec, Bug #92921
1128 + mount -n -t tmpfs -o "exec,nosuid,mode=0755,size=10M" mdev /dev
1129 + fi
1130 +}
1131 +
1132 +start()
1133 +{
1134 + # Setup temporary storage for /dev
1135 + ebegin "Mounting /dev for mdev"
1136 + mount_it
1137 + eend $?
1138 +
1139 + # Create a file so that our rc system knows it's still in sysinit.
1140 + # Existance means init scripts will not directly run.
1141 + # rc will remove the file when done with sysinit.
1142 + touch /dev/.rcsysinit
1143 +
1144 + seed_dev
1145 +
1146 + # Setup hotplugging (if possible)
1147 + if [ -e /proc/sys/kernel/hotplug ] ; then
1148 + ebegin "Setting up mdev as hotplug agent"
1149 + echo $(find_mdev) > /proc/sys/kernel/hotplug
1150 + eend 0
1151 + fi
1152 +
1153 + populate_mdev
1154 +}
1155
1156 diff --git a/sys-apps/busybox/files/mdev/dvbdev b/sys-apps/busybox/files/mdev/dvbdev
1157 new file mode 100644
1158 index 0000000..f0186c1
1159 --- /dev/null
1160 +++ b/sys-apps/busybox/files/mdev/dvbdev
1161 @@ -0,0 +1,18 @@
1162 +#!/bin/sh
1163 +
1164 +# MDEV=dvb0.demux1 -> ADAPTER=dvb0 -> N=0
1165 +ADAPTER=${MDEV%.*}
1166 +N=${ADAPTER#dvb}
1167 +# MDEV=dvb0.demux1 -> DEVB_DEV=demux1
1168 +DVB_DEV=${MDEV#*.}
1169 +
1170 +case "$ACTION" in
1171 + add|"")
1172 + mkdir -p dvb/adapter${N}
1173 + mv ${MDEV} dvb/adapter${N}/${DVB_DEV}
1174 + ;;
1175 + remove)
1176 + rm -f dvb/adapter${N}/${DVB_DEV}
1177 + rmdir dvb/adapter${N} 2>/dev/null
1178 + rmdir dvb/ 2>/dev/null
1179 +esac
1180
1181 diff --git a/sys-apps/busybox/files/mdev/ide_links b/sys-apps/busybox/files/mdev/ide_links
1182 new file mode 100644
1183 index 0000000..be0c95a
1184 --- /dev/null
1185 +++ b/sys-apps/busybox/files/mdev/ide_links
1186 @@ -0,0 +1,23 @@
1187 +#!/bin/sh
1188 +
1189 +[ -f /proc/ide/$MDEV/media ] || exit
1190 +
1191 +media=`cat /proc/ide/$MDEV/media`
1192 +for i in $media $media[0-9]* ; do
1193 + if [ "`readlink $i 2>/dev/null`" = $MDEV ] ; then
1194 + LINK=$i
1195 + break
1196 + fi
1197 +done
1198 +
1199 +# link exist, remove if necessary and exit
1200 +if [ "$LINK" ] ; then
1201 + [ "$ACTION" = remove ] && rm $LINK
1202 + exit
1203 +fi
1204 +
1205 +# create a link
1206 +num=`ls $media[0-9]* 2>/dev/null | wc -l`
1207 +ln -sf $MDEV "$media`echo $num`"
1208 +[ -e "$media" ] || ln -sf $MDEV "$media"
1209 +
1210
1211 diff --git a/sys-apps/busybox/files/mdev/usbdev b/sys-apps/busybox/files/mdev/usbdev
1212 new file mode 100644
1213 index 0000000..ea5b915
1214 --- /dev/null
1215 +++ b/sys-apps/busybox/files/mdev/usbdev
1216 @@ -0,0 +1,62 @@
1217 +#!/bin/sh
1218 +
1219 +# script is buggy; until patched just do exit 0
1220 +#exit 0
1221 +
1222 +# add zeros to device or bus
1223 +add_zeros () {
1224 + case "$(echo $1 | wc -L)" in
1225 + 1) echo "00$1" ;;
1226 + 2) echo "0$1" ;;
1227 + *) echo "$1"
1228 + esac
1229 + exit 0
1230 +}
1231 +
1232 +
1233 +# bus and device dirs in /sys
1234 +USB_PATH=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).[0-9]/usb\1/')
1235 +USB_PATH=$(find /sys/devices -type d -name "$USB_PATH")
1236 +USB_DEV_DIR=$(echo $MDEV | sed -e 's/usbdev\([0-9]\).\([0-9]\)/\1-\2/')
1237 +
1238 +# dir names in /dev
1239 +BUS=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev\([0-9]\).[0-9]/\1/'))
1240 +USB_DEV=$(add_zeros $(echo $MDEV | sed -e 's/^usbdev[0-9].\([0-9]\)/\1/'))
1241 +
1242 +
1243 +# try to load the proper driver for usb devices
1244 +case "$ACTION" in
1245 + add|"")
1246 + # load usb bus driver
1247 + for i in $USB_PATH/*/modalias ; do
1248 + modprobe `cat $i` 2>/dev/null
1249 + done
1250 + # load usb device driver if existent
1251 + if [ -d $USB_PATH/$USB_DEV_DIR ]; then
1252 + for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
1253 + modprobe `cat $i` 2>/dev/null
1254 + done
1255 + fi
1256 + # move usb device file
1257 + mkdir -p bus/usb/$BUS
1258 + mv $MDEV bus/usb/$BUS/$USB_DEV
1259 + ;;
1260 + remove)
1261 + # unload device driver, if device dir is existent
1262 + if [ -d $USB_PATH/$USB_DEV_DIR ]; then
1263 + for i in $USB_PATH/$USB_DEV_DIR/*/modalias ; do
1264 + modprobe -r `cat $i` 2>/dev/null
1265 + done
1266 + fi
1267 + # unload usb bus driver. Does this make sense?
1268 + # what happens, if two usb devices are plugged in
1269 + # and one is removed?
1270 + for i in $USB_PATH/*/modalias ; do
1271 + modprobe -r `cat $i` 2>/dev/null
1272 + done
1273 + # remove device file and possible empty dirs
1274 + rm -f bus/usb/$BUS/$USB_DEV
1275 + rmdir bus/usb/$BUS/ 2>/dev/null
1276 + rmdir bus/usb/ 2>/dev/null
1277 + rmdir bus/ 2>/dev/null
1278 +esac
1279
1280 diff --git a/sys-apps/busybox/files/mdev/usbdisk_link b/sys-apps/busybox/files/mdev/usbdisk_link
1281 new file mode 100644
1282 index 0000000..750242b
1283 --- /dev/null
1284 +++ b/sys-apps/busybox/files/mdev/usbdisk_link
1285 @@ -0,0 +1,34 @@
1286 +#!/bin/sh
1287 +
1288 +# NOTE: since mdev -s only provide $MDEV, don't depend on any hotplug vars.
1289 +
1290 +current=$(readlink usbdisk)
1291 +
1292 +if [ "$current" = "$MDEV" ] && [ "$ACTION" = "remove" ]; then
1293 + rm -f usbdisk usba1
1294 +fi
1295 +[ -n "$current" ] && exit
1296 +
1297 +if [ -e /sys/block/$MDEV ]; then
1298 + SYSDEV=$(readlink -f /sys/block/$MDEV/device)
1299 + # if /sys device path contains '/usb[0-9]' then we assume its usb
1300 + # also, if its an usb without partitions we require FAT
1301 + if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
1302 + # do not create link if there is not FAT
1303 + dd if=/dev/$MDEV bs=512 count=1 2>/dev/null | strings | grep FAT >/dev/null || exit 0
1304 +
1305 + ln -sf $MDEV usbdisk
1306 + # keep this for compat. people have it in fstab
1307 + ln -sf $MDEV usba1
1308 + fi
1309 +
1310 +elif [ -e /sys/block/*/$MDEV ] ; then
1311 + PARENT=$(dirname /sys/block/*/$MDEV)
1312 + SYSDEV=$(readlink -f $PARENT/device)
1313 + if [ "${SYSDEV##*/usb[0-9]}" != "$SYSDEV" ]; then
1314 + ln -sf $MDEV usbdisk
1315 + # keep this for compat. people have it in fstab
1316 + ln -sf $MDEV usba1
1317 + fi
1318 +fi
1319 +
1320
1321 diff --git a/sys-apps/busybox/metadata.xml b/sys-apps/busybox/metadata.xml
1322 new file mode 100644
1323 index 0000000..e053635
1324 --- /dev/null
1325 +++ b/sys-apps/busybox/metadata.xml
1326 @@ -0,0 +1,16 @@
1327 +<?xml version="1.0" encoding="UTF-8"?>
1328 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1329 +<pkgmetadata>
1330 +<herd>embedded</herd>
1331 +<use>
1332 +<flag name="make-symlinks">Create all the appropriate symlinks in /bin and /sbin.</flag>
1333 +<flag name="math">Enable math support in gawk (requires libm)</flag>
1334 +<flag name="mdev">Create the appropriate symlink in /sbin and install mdev.conf and support files</flag>
1335 +<flag name="sep-usr">Support a separate /usr without needing an initramfs by booting with init=/ginit</flag>
1336 +<flag name="static">Make the system rescue shell (/bin/bb) static so you can recover even when glibc is broken</flag>
1337 +<flag name="systemd">Support systemd</flag>
1338 +<flag name="ntpd">Enable ntpd daemon</flag>
1339 +<flag name="sysklogd">Enable sysklogd daemon</flag>
1340 +<flag name="watchdog">Enable watchdog daemon</flag>
1341 +</use>
1342 +</pkgmetadata>