aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: b648478ffac3b2423932eaf17be3776e03546161 (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.26.1
pkgrel=2
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
license="GPL2"
makedepends_build=""
makedepends_host="linux-headers"
makedepends="$makedepends_build $makedepends_host"
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
	0001-ash-exec-busybox.static.patch
	0002-app-location-for-vi-and-lspci.patch
	0003-udhcpc-set-default-discover-retries-to-5.patch
	0004-ping-make-ping-work-without-root-privileges.patch
	0005-fbsplash-support-console-switching.patch
	0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
	0007-depmod-support-generating-kmod-binary-index-files.patch
	0008-login-move-check_securetty-to-libbb.patch
	0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
	0010-su-FEATURE_SU_NULLOK_SECURE.patch
	0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
	0012-diff-add-support-for-no-dereference.patch

	0001-ash-fix-error-code-regression.patch

	acpid.logrotate
	busyboxconfig
	bbsuid.c
	dad.if-up
	nologin.c
	"

_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 -m775 "$srcdir"/dad.if-up "$pkgdir"/etc/network/if-up.d/dad \
		|| 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="044684cb9e4e3253fc31c84f66a5bd9a  busybox-1.26.1.tar.bz2
5784516439ec6dc4e60612b094fc6fda  0001-ash-exec-busybox.static.patch
e35fc8b29faf1742c0f09f5c3b95db94  0002-app-location-for-vi-and-lspci.patch
5c356ff8346936d1f545750456edb1b2  0003-udhcpc-set-default-discover-retries-to-5.patch
04daa6589029bea08381153997cb9b4f  0004-ping-make-ping-work-without-root-privileges.patch
41d1f17aae5fb141d47fca05e2a128d6  0005-fbsplash-support-console-switching.patch
5d2501b4ef3cff23fa1c45e7bdc3d166  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
2e30ea0f9597ae181907b83f74c171f2  0007-depmod-support-generating-kmod-binary-index-files.patch
2b6008e4b808822758d5a543c03aff66  0008-login-move-check_securetty-to-libbb.patch
3999f781c0647edf8bda494c6a2ad615  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
5f97342f411c5ad237a509066f757c1e  0010-su-FEATURE_SU_NULLOK_SECURE.patch
723a879123be8df4726455d857d910aa  0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
14746b0d10711cb4a824a166fc147706  0012-diff-add-support-for-no-dereference.patch
4570da064e03480aeb76447af1170992  0001-ash-fix-error-code-regression.patch
4046b78ee6a25259954797d73b94f4bd  acpid.logrotate
44e79c71ef60f20bf3ef45cfa2624d4e  busyboxconfig
378058009a1d6b1e321617b32b933e28  bbsuid.c
5c2d151c173f5618d404af4bb5a91769  dad.if-up
d64b58a30892c558bdbab7f0d0997577  nologin.c"
sha256sums="0fbbe487fa35cc3258749cf79c259578c1a221013cc4fb60d6a3542590f781f2  busybox-1.26.1.tar.bz2
985aeb3f592bfae16a0f24be4b6a39616401927ff1b4cf47e01f15d4559120d5  0001-ash-exec-busybox.static.patch
6a43bbc49ed29ed5c506e0010f9f23df4c9696299b569549aff242c1aceb450b  0002-app-location-for-vi-and-lspci.patch
e3f85c4679f0884303c5a8848f0ef6307e002e51cfd209caaf4f776b853dd055  0003-udhcpc-set-default-discover-retries-to-5.patch
234e5649d9219c4334553ee10d2c1717d363c6193b654f48f45cef9b3f4e5abd  0004-ping-make-ping-work-without-root-privileges.patch
c1f8356d3a2a1b40d42a9753130bf4af3a22ff940f7e0dafe45b4649280c6e7d  0005-fbsplash-support-console-switching.patch
bc6349a441fca2e81e80178078d8ebcbaef337a8a871a89c1d4683d23d1186b1  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
9a71642e381662dbf55c6f4b6ba09bf87f90e82980bea8d12aa25d412fc5af45  0007-depmod-support-generating-kmod-binary-index-files.patch
c158a8f317a327edb2f134178ffd7d1d3027a3644e925d93c031448cf35b4b2f  0008-login-move-check_securetty-to-libbb.patch
3b200f6df58de952b1bf81e338e279a73dbbc536b9a56759cdc5b74a41ddd141  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
343cb66bead0b2a0069263069642ce95f139772dfd4d44d8b81db6d0c142a54d  0010-su-FEATURE_SU_NULLOK_SECURE.patch
9bc67c6af540cbfdc05c020f517e5f0b8def2cb789f83891e6599ff310e999cb  0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
c77369008d38b2e4622bc61a2d546f0005bed5c8e5d6a59c0a24bbad7ad04ea2  0012-diff-add-support-for-no-dereference.patch
9deb0aaa2d03db0dd9aadc73b4c54557c33c2a380f710638e2dface0e50ca2bf  0001-ash-fix-error-code-regression.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48  acpid.logrotate
1ebe60a42345f70cb8c486935290ffb6f8622d0dbb2bb70059952f52004cc614  busyboxconfig
52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39  bbsuid.c
5a42f9dbe272b5ce792ebf0d67bb5808ede2e470b0fbfbc23192f17e0b7410ae  dad.if-up
9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d  nologin.c"
sha512sums="2b71563185e8d9601fe57c6975473336d5950c034ed62ca51b79cc32248612770724c2f8fd2028d15892d126829ef177223496688cd6816b6c7c0203772f9886  busybox-1.26.1.tar.bz2
ed16b7a38d99eb309ed03d3212ffd1c1993e292724665be2aaefcf645c9a37d1b0c5d24308dac7dbb093afde5b700961c55336d67be4f2bb788c85550e5f1de8  0001-ash-exec-busybox.static.patch
cd6b0b59ca8006bfc545ba521a92de81be320c0dd3ed0a41d6a60339b73f44c80f1ac36fb05d35a8555fd173167b792f73ae279115d23d59f8f623ae01aed7d1  0002-app-location-for-vi-and-lspci.patch
3fef7a3f47ca798859c5cf8d78bc36ed98c4b9f841a3593bca71b9242ca15719bbe9b683437f8ea61b9a5f6c31c9272b7f72dcb6ef6fc2a42fd3219e302113eb  0003-udhcpc-set-default-discover-retries-to-5.patch
36d1090b35db49fd81ca5a39f5c5050f3173d628ac5e1b9b1c5873a3d0641942c9ffc5448533baa6c4512f4e539e8eb81d53c526a8f6e41b12f6f7606746793f  0004-ping-make-ping-work-without-root-privileges.patch
6fc8fd411daec7989632b448ff73cbac05d8e4c497167f24c0b2a55517449f9c89fcc0131fa64973f163f0d5d0c5ed75613682b95b0f11900d340366693acf2a  0005-fbsplash-support-console-switching.patch
7b6300130ca72b6842283b696c5138ac119b7b79d926ef336395246549b48a0f9c7c97c4708dfc45192d90898da3cad5b9bfe309072751615c012c8fcccfbb42  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
11529fe845bbd4094dd57f99c8150aefeed69822d04bc0692975ea4f70c1691698d0b76d7522741eca9e45e8baaa877e55aed3ef21809bbaeecf67be7049bf70  0007-depmod-support-generating-kmod-binary-index-files.patch
29589a224a432363620fa1b56c605ca93e39c879d263087f58c531aa4331ca366baa531b7464c41a8fdee96e7750b155e5e00f2bb0aeaa8da50d2cae01eab4f4  0008-login-move-check_securetty-to-libbb.patch
fc291167b2e026166e283d98d2d61cb3c9701e5e83c09062692d0c5a77f3b838ba73065706461095039f9adcbd9a7e4ae60a8b578986d0499caa33789fea3050  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
f82caa1dc4395f266b024a7face267a916a80ead95f3d392b10fd397d0fdf62703e3078357bc71962616d6531ea913aef80e1a7cdf8180bca70e723c7d331238  0010-su-FEATURE_SU_NULLOK_SECURE.patch
16b513b34b3bf16002f14566aae66aab986403cb7a0f416c27264b739706bbd624a99fd37d5b56ff6efe623f3cc48aef3e8fe51c4ae2e94eda3fe9e8e618e3a1  0011-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
361959788bc11b7f20d4029bb0f561759d270983b09c44fe2a01817378c4eb1c98cd8ef73e7ef8c168b7540170f58ddb36b9e4f80a97565f3fe3ba85b593a471  0012-diff-add-support-for-no-dereference.patch
79d2ec8ad1530aacf8c5ccc5386ede252b06c3d538d1d027f9f4fc29dabcae6832939a15cbe1b78224eae9191684966e5ca5da44c046988b7fd8a55db24dc30e  0001-ash-fix-error-code-regression.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b  acpid.logrotate
5d711e387497aa884063375212cc1cf42c5bfc93b2e3e671949929dbab73557631d998ca6eb1890dd045bfed24996d270d6cca9262881a53dcf6bd93d9ffb481  busyboxconfig
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f  bbsuid.c
a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02  dad.if-up
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2  nologin.c"