aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: 5532b9b25b402f70f5d188dceba854f50634c891 (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
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.25.1
pkgrel=0
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-set-applet-location-to-correspond-to-upstream-for-vi.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-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
	0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
	0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
	0015-diff-add-support-for-no-dereference.patch
	0016-whois-make-it-actually-work.patch

	acpid.logrotate
	busyboxconfig
	bbsuid.c
	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 -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="4f4c5de50b479b11ff636d7d8eb902a2  busybox-1.25.1.tar.bz2
59028ad98544ec71c37f637df9d5c8f8  0001-ash-exec-busybox.static.patch
d6ca0a022af2f68746297b3673ca0467  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
f06a9dd453e9527a8c46ededed00a30e  0003-udhcpc-set-default-discover-retries-to-5.patch
c0ee8629bb7f2c75e6da39431b736572  0004-ping-make-ping-work-without-root-privileges.patch
50505c0b575943c85b396bbf0dad73b3  0005-fbsplash-support-console-switching.patch
b4a95d78733e08c3b960b60e70a5b965  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
c03e2940828e8c2bc9494aee74422bd3  0007-depmod-support-generating-kmod-binary-index-files.patch
17a39b0672afe6a626cd0ea81623ab00  0008-login-move-check_securetty-to-libbb.patch
5fb24a9688a638e6bea5921bcc565bb6  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
208869f8a34ef531437c4ece55115a78  0010-su-FEATURE_SU_NULLOK_SECURE.patch
5fab4d6b3461a399d66a42f9385c6ad5  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
f39e2d23f00d9a94a08d5159bd285ea5  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
bcfa838ecc36ea8f2012a27561d6910d  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
83c0e05df23b2327e6e71fa93e911154  0015-diff-add-support-for-no-dereference.patch
6234d8817d3c0ee9f4c01e83bf6a96c4  0016-whois-make-it-actually-work.patch
4046b78ee6a25259954797d73b94f4bd  acpid.logrotate
09ad409662df7d086f0f0485aa8ce259  busyboxconfig
378058009a1d6b1e321617b32b933e28  bbsuid.c
d64b58a30892c558bdbab7f0d0997577  nologin.c"
sha256sums="27667e0f2328fdbd79cfd622e4453e5c57e58f781c5da97c9be337d93aa2a02e  busybox-1.25.1.tar.bz2
4c28b5613123af696399cd6caed99aaa1a86715fde3ebc00c704425c4f086b0c  0001-ash-exec-busybox.static.patch
7a955bf237e965394ee4c96c3cbe39aa41fa638531b9185838df7ee5b2d97240  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
10fedac0023498fc68b589fec3149801475b08882254fc2a5cc1d3c9dab2d750  0003-udhcpc-set-default-discover-retries-to-5.patch
b9766d28fa8dcee8ffcbc00795c1b2edea82d99ef7a39b024876c54d258a6b59  0004-ping-make-ping-work-without-root-privileges.patch
fc8bad08a5f43e32ac2f9c169a441567266dd551f9b2b82c6f227445a745413a  0005-fbsplash-support-console-switching.patch
8fe309313982fbe560cc3bdb3c61395bb22945942f1ebe768a5b0377f35e50a6  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
e1e3f6efaba68a12a481bdb6ad4826fa10d1a3af5c6693c4066d12fb3c7ba676  0007-depmod-support-generating-kmod-binary-index-files.patch
4d5e3691b7d0e0c33c0ba1be48db65d1978a78fefb4c0bc5d0757c8c087093b0  0008-login-move-check_securetty-to-libbb.patch
a063e8a8acae6c42a8b47316279dc28b44e2d59aa924a6295cade00a08284a3a  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
28573f6d49bd8be27beb535581b3b227489f43955d68669bea868128dfdb84cb  0010-su-FEATURE_SU_NULLOK_SECURE.patch
243520c9ba069d7b58f440ce890357eca464c77f62a152eba6173f5de3968441  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
30aaba169312101b45ee113cd3daa4ca5bfdee76298cb73c692a890484888e23  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
0c4d7b8ea3844c0f771361deb52e7553f4cf198d3d591ed476fa43be56107a8e  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
cbe87aa26c161892f82cd319222c1a21768eabcd5b706c8b582a988e981aca10  0015-diff-add-support-for-no-dereference.patch
1be53b0d1aa3c3f44bff31e092bc786259c7475de4b24dfaa71e70c50672f421  0016-whois-make-it-actually-work.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48  acpid.logrotate
c94b126d5957e9fafe6270b5e191024ff0374bff074db6ec98fbbeaa5e82de95  busyboxconfig
52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39  bbsuid.c
9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d  nologin.c"
sha512sums="9648877ed11e5a55213cd14fd64f6fc64dbd17013fbfaa4e67f4fd433f59e9231ed78a88e6e8100a4794d833f1d9863bb86f75faae093418866770804bf873cb  busybox-1.25.1.tar.bz2
1d5eaba0531263c2b60697d5c7652a2f700a23132c6d2923b45127ba6d7dcc8ccc6c9bd9054e1639fe0dc40e61147348399692c4f08dbf6a6b7bac3c1f2811f7  0001-ash-exec-busybox.static.patch
14a8c43be87b6d6c19787f476405ad6de1a575198ff2420e32d7f952bc72f4869419ef8189ff0e7b11f078a48013eb1f6c73e4b82aff316abba287a5bda96195  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
1c4393102465de46481dfb2c7d652e76890da567b075a8b11674ae7608f6f0e6966a89961408c396607439bdb5a2f98c00e443102917254f338d05b0676e6ef2  0003-udhcpc-set-default-discover-retries-to-5.patch
91033878d9e5efa8b1e5cebb6b18ea9a87af68b9939ac9441f791c8493b144dff46bafcc9c8d2ff3f8bc3b2c4891faad8fddf3e7335417c099b4b3051cbe9ba4  0004-ping-make-ping-work-without-root-privileges.patch
d69050a60588669b5a7719b63d13d6ecbcb5748cd7d80d0066c22c2571e3136964437c2263f33bbf1d2d17011cdbe972cc05ff753e669d8fc20844fcc211f1b8  0005-fbsplash-support-console-switching.patch
3b31d019441c2a555c5ac01c4c0a3636c7fa5000b992a487729f6fa6929d836417b81118ea422fcb6cb8509b783ab244faf8c04e132c24400a202f8c4c087334  0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
c0ae0f753b7024bd24637ce2225dc0be3d4f5fe91a52824662bc030b9ae6adce6cb92baa633fa4c14b4fd225501d9dd1feec4f5b9b42212af4787325958a2388  0007-depmod-support-generating-kmod-binary-index-files.patch
a0f02c60f47035ddde11795f6dbf51194d2e516a88dec787ef00e7c79627dce79957e397690b6c75d2a0eccff50bffcb7ce362fefe34d505b7da559877855e42  0008-login-move-check_securetty-to-libbb.patch
af7f538953f7ff7ef527e41fbf9e8f345049d33a138d5d20942d3ee2615abc303ca59cb62cb99e3e6fcbfd27975da8220d90e44aafec3de991b6cdfba2c27ce1  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
00a2e73fd2af72ba798b5a914a01314b161ff2dce2ec6c3cb01a1816e065a20b3110c1558a2fcd4c76cd78223033737592ee1cdcabcc6d35b944ee9010fc1a83  0010-su-FEATURE_SU_NULLOK_SECURE.patch
c1d9742d0045c6d62e731bee50ce3bfdc338601d0d61571271e8a24431d2ba1e3ee522346871fc50011d4047fcdb1eed5a4321e5364eb4e42dd4b65e698dce4c  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
d7a4ee28e0bf924b372ecb2f8da67f566f3c9e78199d81085e83dfb9fc9f5655fb8d6d904285d09bfee07d5e93b50603ea5f04e37e0feaaf01375170f158b829  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
1e188dfa8c74c9e01f98edab42271260bf6b181b083ef81b76bd3af34ddbca5884a0fe7c3d0352855d0754015d0c0d8da0f1390f5db808b1237153a183a90681  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
e04ebc53049be29e5ac0c90dd789b2d275c10175629787f729c06aa323ef688b2ed266961d4f841bae90d00ff4ee454de48d6b92f84f0e5c8729d6c55d9650cd  0015-diff-add-support-for-no-dereference.patch
09cb1bf25c9442986e7d9816277e75591a2af8ba78117869c5cba35d2e189db351455137e9511cf61788864812056133fc9ec5e204f9eb18ae86c34dd8493ae8  0016-whois-make-it-actually-work.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b  acpid.logrotate
2f7c256b92f939a88f287529144f25a6bba0cd3491158680237c879507c617e571f95dab302aab586a6ce0261c2337c8210bf29048fb2c472786e55d2295b223  busyboxconfig
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f  bbsuid.c
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2  nologin.c"