summaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: 02303ea96ffe52ef16f4aacebb0f4d8a92b98eeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.24.2
pkgrel=2
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
license="GPL2"
makedepends="linux-headers"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-static $pkgname-suid"
options="suid"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
	bbsuid.c

	nologin.c
	$pkgname-1.11.1-bb.patch
	bb-app-location.patch
	loginutils-sha512.patch
	udhcpc-discover-retries.patch
	0001-ping-make-ping-work-without-root-privileges.patch

	busybox-1.24.2-CVE-2016-2147.patch
	busybox-1.24.2-CVE-2016-2148.patch

	0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
	0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch

	0001-diff-add-support-for-no-dereference.patch

	1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch
	1001-fbsplash-support-console-switching.patch
	1002-fbsplash-support-image-and-bar-alignment-and-positio.patch

	2001-modutils-merge-module_entry-and-module_info-to-commo.patch
	2002-depmod-support-generating-kmod-binary-index-files.patch
	2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch

	3001-login-move-check_securetty-to-libbb.patch
	3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
	3003-su-FEATURE_SU_NULLOK_SECURE.patch

	0001-ash-backport-fix-for-here-document-issues.patch
	0001-ash-fix-error-during-recursive-processing-of-here-do.patch

	acpid.logrotate
	busyboxconfig
	glibc.patch"

_sdir="$srcdir"/$pkgname-$pkgver
_staticdir="$srcdir"/build-static
_dyndir="$srcdir"/build-dynamic
_config="$srcdir"/busyboxconfig

prepare() {
	mkdir -p "$_staticdir" "$_dyndir"
	#patches
	cd "$_sdir"
	for i in $source; do
		local p=${i##*/}
		case $i in
		*.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;;
		esac
	done

	cp "$srcdir"/nologin.c loginutils/
}

build() {
	# build bbsuid
	msg "Building bbsuid"
	${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \
		${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid || return 1

	# build dynamic
	cd "$_dyndir"
	msg "Building dynamic busybox"
	cp "$_config" .config
	[ "$CLIBC" = musl ] && sed -i \
		-e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
		.config
	make -C "$_sdir" O="$PWD" silentoldconfig || return 1
	make || return 1

	# build static
	cd "$_staticdir"
	msg "Building static busybox"
	sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \
		-e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \
		"$_config" > .config
	# musl does not support GNU regex
	[ "$CLIBC" = musl ] && sed -i \
		-e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
		.config
	make -C "$_sdir" O="$PWD" silentoldconfig || return 1
	make || return 1
	mv busybox busybox.static
}

package() {
	cd "$_dyndir"
	mkdir -p "$pkgdir"/usr/sbin "$pkgdir"/usr/bin "$pkgdir"/tmp \
		"$pkgdir"/var/cache/misc "$pkgdir"/bin "$pkgdir"/sbin
	chmod 1777 "$pkgdir"/tmp
	install -m755 busybox "$pkgdir"/bin/busybox || return 1
	# we need /bin/sh to be able to execute post-install
	ln -s /bin/busybox "$pkgdir"/bin/sh

	#ifupdown needs those dirs to be present
	mkdir -p \
		"$pkgdir"/etc/network/if-down.d \
		"$pkgdir"/etc/network/if-post-down.d \
		"$pkgdir"/etc/network/if-post-up.d \
		"$pkgdir"/etc/network/if-pre-down.d \
		"$pkgdir"/etc/network/if-pre-up.d \
		"$pkgdir"/etc/network/if-up.d \
		|| return 1

	install -Dm644 "$srcdir"/acpid.logrotate \
		"$pkgdir/etc/logrotate.d/acpid" || return 1

	mkdir -p "$pkgdir"/var/lib/udhcpd || return 1
	install -Dm644 "$_sdir"/examples/udhcp/udhcpd.conf \
		"$pkgdir"/etc/udhcpd.conf || return 1
	cat >"$pkgdir"/etc/securetty <<EOF
console
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
EOF
}

suid() {
	pkgdesc="suid binaries of Busybox"
	depends="${pkgname}"

	cd "$_dyndir"
	mkdir -p "$subpkgdir"/bin
	install -m4111 bbsuid "$subpkgdir"/bin/bbsuid || return 1
}

static() {
	pkgdesc="Statically linked Busybox"
	mkdir -p "$subpkgdir"/bin
	install -m755 "$_staticdir"/busybox.static \
		"$subpkgdir"/bin/busybox.static
}

md5sums="2eaae519cac1143bcf583636a745381f  busybox-1.24.2.tar.bz2
378058009a1d6b1e321617b32b933e28  bbsuid.c
d64b58a30892c558bdbab7f0d0997577  nologin.c
4c0f3b486eaa0674961b7ddcd0c60a9b  busybox-1.11.1-bb.patch
c5a8dbc8696db6da9c4624b0e11d8fba  bb-app-location.patch
8c42c9ef0f0419c314c86bcaf7796106  loginutils-sha512.patch
91a7584a562a72ba886936558e576bbd  udhcpc-discover-retries.patch
2b01339da696625108037303aec419d5  0001-ping-make-ping-work-without-root-privileges.patch
c45a85f5ced712743efbb683900f8c1d  busybox-1.24.2-CVE-2016-2147.patch
850a57ca2871e370b4916161a0320a3f  busybox-1.24.2-CVE-2016-2148.patch
d6f0ecf89f7633753d8998abe7e06e7e  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
e1c183cbe1ca18a0fa0d9597314076c9  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
69fa40bee9abec058427bf67fde1b61e  0001-diff-add-support-for-no-dereference.patch
699ce5aa1095ba4419cd595cec8a8f75  1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch
b56d306ccba574da78dff060b7330806  1001-fbsplash-support-console-switching.patch
4fe5f9e973674c7db3d07f295c363a7c  1002-fbsplash-support-image-and-bar-alignment-and-positio.patch
ad908fc45563148d9f22b50c6e78e0d4  2001-modutils-merge-module_entry-and-module_info-to-commo.patch
313fa7175333161c549af097d9f62a79  2002-depmod-support-generating-kmod-binary-index-files.patch
47987a0add3da5f2b1bac13c62120423  2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch
94ab8b7b930df2f8f04da0e69da258da  3001-login-move-check_securetty-to-libbb.patch
f7c45568bdb0d2295c43108691e78a40  3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
f82d49c891c02516462db3cda29ccca7  3003-su-FEATURE_SU_NULLOK_SECURE.patch
5f03ee6f3e93bbc6aedff0777b227810  0001-ash-backport-fix-for-here-document-issues.patch
a4d1cf64fd1835a284ccc6dbc78e3ce0  0001-ash-fix-error-during-recursive-processing-of-here-do.patch
4046b78ee6a25259954797d73b94f4bd  acpid.logrotate
78724c22bb072eedf42fd17452bfe4d3  busyboxconfig
befaac2c59c380e36a452b3f1c1d4a3a  glibc.patch"
sha256sums="e71ef53ec656f31c42633918d301405d40dea1d97eca12f272217ae4a971c855  busybox-1.24.2.tar.bz2
52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39  bbsuid.c
9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d  nologin.c
327bb8049e2726351a5c8b6b2cef864f6ce58725d4453983f97092ea73656ccc  busybox-1.11.1-bb.patch
576366b4d50f1078da6c0364ef70415de92d97c93c64f4d790b11d7a34cdccd2  bb-app-location.patch
57674b20158c0b266ed028b0c65299f9cbcad7d33d19c9fcc403d3967daba493  loginutils-sha512.patch
90825a443339f1c8c249d05f7b025ce53e374d305f8e113d98d45146b105494d  udhcpc-discover-retries.patch
cbc27953386429b0fa19856b881c6a1e88824ad6a77c21ecd409391d9857d319  0001-ping-make-ping-work-without-root-privileges.patch
7cedbcfe2744a7efc1d811372932bc8ef610b8bbdfe34d28ba5a0b5d582b885d  busybox-1.24.2-CVE-2016-2147.patch
0d42e12334ff14616ce9dc22f02f15c8f3df3ef3334c9ef81abd29d21b5ac687  busybox-1.24.2-CVE-2016-2148.patch
666d0e9c5a4b37aca84d88138736012527d97de578f81b719bf913f558823e18  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
53563c6dc4db13004d0b37f7bf1748e861b5a5c4244c1d34f102c23b689420c5  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
70180473e3939402e460b25de8273a5ce7f62b130a9efe31f33d847b2406ac92  0001-diff-add-support-for-no-dereference.patch
043963183cad556bdae5d5608180f0cb76cf7eede175cd97aa002a787780500f  1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch
b8b0b16ed67b0159256193b1d2108b8ef9aa8a334ab81e463bb970c71257da9a  1001-fbsplash-support-console-switching.patch
e1f3fad8e21dfd72cfcae7ab3ba31d7938e964e0f9ec08b2da0b14d462435424  1002-fbsplash-support-image-and-bar-alignment-and-positio.patch
16ee3a66e5854adbcb7ea6b1ea5846bac49dcf6d874e167f57e88f2fbd5cd0a5  2001-modutils-merge-module_entry-and-module_info-to-commo.patch
dbddad67d6b6054b8ffe7159f7fd3189bf3b433ba8f179fb6915caeea20d1b4e  2002-depmod-support-generating-kmod-binary-index-files.patch
ea589dcd25037e3fefd2f3d6ac801a2a4a61a5cfd2d765785ea5558ed3937776  2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch
34c694cc2ac69ee2d6bbfe45a20c68036b6299ad7e4a1a8df9bf1ce0a4637bd7  3001-login-move-check_securetty-to-libbb.patch
ce24e38be870c90bdcb90e7b0445067adf7be0fac6b1154d2364a4db9ee3a9d8  3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
d7b18672334ddeee7fbd6c0e92f26c5d2ef49ddefebf0b7f6eff8dc1ad8d3f7e  3003-su-FEATURE_SU_NULLOK_SECURE.patch
f712ce190ce86084d56977e125d1561615394f3d9b840e926537868260e19d79  0001-ash-backport-fix-for-here-document-issues.patch
1d3f8f7b6d0972f8e56437fce8efbafe70e2d869fbe82f06eba11e0103fce224  0001-ash-fix-error-during-recursive-processing-of-here-do.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48  acpid.logrotate
529499778b833285d1cf821ef45dc1ef74f536fea010a43688e0bbab48c4c3a7  busyboxconfig
c604ef791c31d35a8c5ee4558d21428a46f37a6d762c4a7e29864f4037fc44a0  glibc.patch"
sha512sums="4d20fb68ee440be2855231c7fd5f3cb9dd9bfcc1a688f0b59cd3f7a55c8819e9cc44bd15f91500713571f2a84e5e44adc0fa8ae0ae3ebf63961dfc9e1c9ef8e0  busybox-1.24.2.tar.bz2
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f  bbsuid.c
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2  nologin.c
eb7cce973bfd53ce3350713437b9e2751becfb8dfb10b14f27c4f812297c403b90f80dc2906179d499e8dffbe6df8aa37ae27625c552162923d59fe35b55b32b  busybox-1.11.1-bb.patch
5c42b05be69c834c9fd5372c6b0d55a6399c74146a94ea09eae7285dd4fa75d1bde38bf7ab73e98638f65eb72db02115453cbdfe85a0085d742940366f617c7d  bb-app-location.patch
69af4800fcf765b4ae029daced7ff171b6b04d810c94a987c7ba848e275a27b77b18b38df1b85f4a12c4a47ed42f62e0768260eb1198e2aff1c3cea898b85c61  loginutils-sha512.patch
34415fe69f6b8d42756046aa8e6d9e4f64a3b0ceb9f57c4c988e35870fe975f05d0ac76f1f9a712196e9c59e67aa2a54abf398242009134fb3aca342c25a3646  udhcpc-discover-retries.patch
046576b60650a455a6f37272a9edb57d3878eae02d18d01a144286be632faae9ec9ee88f1fd4dfb2a8018c2f8b630bac06eefd2e75f16d22c4b807aa2b256366  0001-ping-make-ping-work-without-root-privileges.patch
1268f11089ab5bc4d296995ff8216a8f2f6fbb644d20f04502f92fcadd1cafade43eb6e613fe4b9ab7e475e2bcc3b85ae8196d78c4d56a62db2ce0f3564ba644  busybox-1.24.2-CVE-2016-2147.patch
0ffdfa24d5943a15d924fdd42b5d410c0a215d0cad1753caf6c6aba7d0e5be7a883b561a683a4ac8b906e96b1839f4e6f235501c1467afe50508284f51e42c0c  busybox-1.24.2-CVE-2016-2148.patch
9c836f85d5bc3b33d459394679a93635658c59fb744e266109f84531d391880926d62d671f8ccef56d3b744f0bcc54a8ad2789931e50dcbc40d5d94158bcc503  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
b1a1cc2ada657a3d3364c8c96853575d73784e769cd8768c170c27a3e59abd2beace75dff6d5047c4391725e961d93149f9c3f45ed75fb1c582bf18b818282c9  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
a35b66cd28b79ccc14b47315ac94677fdf8c14d8a6e8956707e71fb50d453dfc5b4b822832cd1faecfe9bf79e687f9b25a1357e0a88db530044c5f8514701c98  0001-diff-add-support-for-no-dereference.patch
2a8e9360e1cedd26bdb70d8cc036ef0abc7588bf2eee147c1c7436d7a40763f8e31d346b980145a36649130a2f811d299e4f46f7e1b60a8165a60ae9e79727d5  1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch
a181dd54e8e11cf1199edb1b1fcd4b7402bbf142593b6014f32c6815bb7093b56899ad0fcc9f73c382f56203ac5274fb3d51fa070feb541436f23c31680f1a69  1001-fbsplash-support-console-switching.patch
c33073416f7da2805a20f3f456f869217171c8fbfdef85f4ae481307aeb1e1b5717084bbbc619010fa5500c3f3f49b6468d5c122024fcc49d637c82427a3f553  1002-fbsplash-support-image-and-bar-alignment-and-positio.patch
d94d17806f08ad54366ca623fbe8663b6397b28d68860239edc9305e6006f01d4ea1c1fd2033b30d302fd095145b018aa6a1707b07b7b4dfcaa8e0388b6737d0  2001-modutils-merge-module_entry-and-module_info-to-commo.patch
daadb1b255a8d30f2a13b84c2120427998d8173cf10754b9117e19a6fea8926d1820005f4d99a4a6999a559e731b5339c12ead22b3efbe1f0e752671363129a5  2002-depmod-support-generating-kmod-binary-index-files.patch
80589e03021fd0cb7bf29c3747e5396bf53dc99ecfecf78de86759e5c3939652d7f022f4534de0a35228bd782c1a44c4762f027d198790ec2c1bb76d6f7f102d  2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch
1832d2a09625cb60998c54330a751f13dec97da2c4133db29c10f77fa3314fd2ef2002a45eab7215ed1a0dd8b84a8a4c7d4c1d225b5ee012fe357a8777707a17  3001-login-move-check_securetty-to-libbb.patch
ed8d060b85d4da1681eb35ba64c5b249391e6a7edbeb55b8952897f08fe9bafac33593992772d80a6df42dd3af0e175ce9575ee51c49fbc875008ad0ac2f6f06  3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
c6579970450e7c711461ab1953f534ae855c4a355b4a452b3fc52a286355c87e41f8951b1b5217d0f659e3173ace8718d42dad3dcc878899cf9decdf4d3fe238  3003-su-FEATURE_SU_NULLOK_SECURE.patch
d55cab6ed08434e2a278edf1be6171b921bcaee47598988e4de6b390a01569e10394c54d5d4a27e6eba251ce68df5cc1ece358be32a9c31bdf1f7e9147cf5180  0001-ash-backport-fix-for-here-document-issues.patch
c14a632f9477c13ea99b24a73c81c9c44ead8b536970acd758e739b43a6260860039674341192ce7bb20a9204ee7d93dcd9541e526f2437d4d2d88637b400867  0001-ash-fix-error-during-recursive-processing-of-here-do.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b  acpid.logrotate
ac26e4bf4ecbd3ba93db7e4665d6a58955596c87525ad0741f8e841bd803e67bd833407a037be44eca38eb7c2ec07250afe5beb58db8deef7aa838d81f8331d3  busyboxconfig
1d2739379dab1deb3eae7cffd4845300eb7d30f7343b4a1209b21a5680860d55080ad45fdefe098b249ce3040c01951fa7f0a79cd447b2d7b260eb000099d9dc  glibc.patch"