aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: d0666d0b2637ce6e560e2aca0de75afcd8d5da60 (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.0
pkgrel=1
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
	0012-gzip-fix-compression-level-bug.-Closes-9131.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

	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="b05af9645076f75429a8683f8afcbdb3  busybox-1.25.0.tar.bz2
59028ad98544ec71c37f637df9d5c8f8  0001-ash-exec-busybox.static.patch
d6ca0a022af2f68746297b3673ca0467  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
59298fbff57e569a736e93395035cfec  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
f3127ef3a4c2556e450a8d5af629d555  0007-depmod-support-generating-kmod-binary-index-files.patch
309801ed120b4a48d3da8df509679e3b  0008-login-move-check_securetty-to-libbb.patch
fbaa10f5a9f1dee17e9f106bcf7c476a  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
7a6be7fc37d858ceebe78f1170292d61  0010-su-FEATURE_SU_NULLOK_SECURE.patch
860021f9fb7f28c5e99973be70c6959a  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
a3beeb8c62d14f8c56d97e226bbeb180  0012-gzip-fix-compression-level-bug.-Closes-9131.patch
4de903bcbc4a0f9cea00ad7397f13084  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
a6c50952f8eecb4dc8ad961c18c99908  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
bc228dbf77eab3a5b7b982f603722177  0015-diff-add-support-for-no-dereference.patch
4046b78ee6a25259954797d73b94f4bd  acpid.logrotate
468cf612bd9e06a60fdf41e88a915270  busyboxconfig
378058009a1d6b1e321617b32b933e28  bbsuid.c
d64b58a30892c558bdbab7f0d0997577  nologin.c"
sha256sums="5a0fe06885ee1b805fb459ab6aaa023fe4f2eccee4fb8c0fd9a6c17c0daca2fc  busybox-1.25.0.tar.bz2
4c28b5613123af696399cd6caed99aaa1a86715fde3ebc00c704425c4f086b0c  0001-ash-exec-busybox.static.patch
7a955bf237e965394ee4c96c3cbe39aa41fa638531b9185838df7ee5b2d97240  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
996304829ad49ffc08e38800021a7da43ddda6e12081360fe766178106d0b452  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
8407ae754eb03c42a93c56fe2f248f4fc74301975923eb6b36e84b79cff658b0  0007-depmod-support-generating-kmod-binary-index-files.patch
23170f53ffb93bdaf555719f2233058803ae333a0176070dc0c38bb6fb1b35db  0008-login-move-check_securetty-to-libbb.patch
d2e1896b39c50988397a5ccc35074860fb0f032a837c47569530b505fc5d51eb  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
1d1ce2ea21668ea619b3cf48dd9bb8c9620ac0f73bad1679fc78a8e352dee6b6  0010-su-FEATURE_SU_NULLOK_SECURE.patch
748766cbc5df632ab659245e2e3e8082b8ba064a9701d6ecc7dc149b31e0e2e1  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
1025555ca503fd38cd98cea4b2049b3af32723950e4ff7ecdb0e2c67db7190ec  0012-gzip-fix-compression-level-bug.-Closes-9131.patch
9b70547101e717b677838cefdb65071dbecde335a860c332406adb70261d6e1b  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
f01c371de9a8cf7970220f9f72436199e70cdf68bb6a0ce640fa0e972699f078  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
8941ba9517694c10bb9c4bda30cd88a7ea6e82aa93a41b2561405315ab6b96b5  0015-diff-add-support-for-no-dereference.patch
f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48  acpid.logrotate
2d8ab0c6ac5610adaf8fd1c094da32727f23fda69434e1ab9cc115744cfa712b  busyboxconfig
52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39  bbsuid.c
9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d  nologin.c"
sha512sums="4122a457709a19f697547f1f84fb37da6ae85dd22afefcb49f551b2c6386838e07bfed0d7d58e70ee8199ae8fd35fd4397bf7d8b3bdd66f60aefb3153376efe4  busybox-1.25.0.tar.bz2
1d5eaba0531263c2b60697d5c7652a2f700a23132c6d2923b45127ba6d7dcc8ccc6c9bd9054e1639fe0dc40e61147348399692c4f08dbf6a6b7bac3c1f2811f7  0001-ash-exec-busybox.static.patch
14a8c43be87b6d6c19787f476405ad6de1a575198ff2420e32d7f952bc72f4869419ef8189ff0e7b11f078a48013eb1f6c73e4b82aff316abba287a5bda96195  0002-set-applet-location-to-correspond-to-upstream-for-vi.patch
1157d65dbb0b2391b29222770dc8d67c87cea40c66e8734db15435dce413437f7bc54fa0b88412fb3618f63c5d244084870373b85d9616111d9a15a458f9734b  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
e0efce50a6bd89d04a5c0a579206f5069d2bcf8b694e9673c3c1792023d64250e156e9cfdd1de0de5399e3c4306a79eaf5ea5f4c9dd07e830e5ff0d85efab317  0007-depmod-support-generating-kmod-binary-index-files.patch
c9829ee74246a0acbccd3679f01b20399c7ea0e0c1b07edd21f4f2a26daa37f0746bba504dee2654a4f4003fbbd417017fbb3840565cb137b9c7d85e6a7a027b  0008-login-move-check_securetty-to-libbb.patch
db4f00959f44c1a85df3b4a1e1c87cdce3927929cbcd4627d8fe448413fbff44641be12f39189dc3d1fe91f44b5c083fb553aff0f32018821aa2fbad3e5a3d6a  0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
cf244528fa204455c16cfcf0b092dc4ea07dad26a0ab96accd261afa8178d41edc8606f35d76cd1b0b24ae303c4b3f846c486f914468db344c64347d6a7c5b9c  0010-su-FEATURE_SU_NULLOK_SECURE.patch
2e4d8345bf12c8b1f59958cbdb3bc0fc7d439cf54c1f3582a5b04b407c1c1fb414aafaa8d44c26e22bd76eb7e44429bebd7b3696e737ca4792c7ac23cf4004a3  0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch
beef81211dfb16d3bc54654eab4d32df5cf5b4c23ec911ba39517760177a02223cdaef1177b54a0d8589e0b517d476d25f5decc5023558478d982d1e3008752b  0012-gzip-fix-compression-level-bug.-Closes-9131.patch
3437629d5cca10d736e40604b77ae1a51561f40b0f8a7a662be7af8c1ba69c947a14f4788845ff1689483863d7fbc4a2bf7cc25ab034dff9c02df886f6b54e64  0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch
a175d4641954ae533a3ef30d62285d36ea890071efd52173ce6ed215bc7b834374fd96c787ba5de17302b71feb510f7eabe26055ae759783e93955778e495531  0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch
1851e83a23c0fdd2cb692e5bcb00830030a70e367b9926054295b78d38977a9fd1f8a88997c23f0425047bf4ef3e9bf6e309073497c118c049d15b27676aeca1  0015-diff-add-support-for-no-dereference.patch
dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b  acpid.logrotate
1820adcd6b8759cf568e4b8fb78b22d8f67e1b33f2252fd05a1edd2d65aa7294769c802fdf50edf102675d0a13f8423727ade40ce5bf741ef95225c86675259c  busyboxconfig
c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f  bbsuid.c
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2  nologin.c"