aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/APKBUILD
blob: bfdebea1eb80b501ba19c314a2d3ae7374b6382e (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.23.0
pkgrel=3
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
license="GPL-2"
depends=
makedepends="linux-headers"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-static"
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
	busybox-uname-is-not-gnu.patch
	bb-app-location.patch
	loginutils-sha512.patch
	udhcpc-discover-retries.patch

	busybox-1.23.0-ash.patch
	busybox-1.23.0-modprobe.patch
	busybox-1.23.0-vi.patch

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

	0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.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

	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
	install -m4111 bbsuid "$pkgdir"/bin/bbsuid || 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
}

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

md5sums="6dffeb16044c6022476c64744492106a  busybox-1.23.0.tar.bz2
8485cf1e389e891914cbb8771a6d9bbd  bbsuid.c
d64b58a30892c558bdbab7f0d0997577  nologin.c
4c0f3b486eaa0674961b7ddcd0c60a9b  busybox-1.11.1-bb.patch
b5375210f13fd6e1ca61a565e8fabd35  busybox-uname-is-not-gnu.patch
c5a8dbc8696db6da9c4624b0e11d8fba  bb-app-location.patch
8c42c9ef0f0419c314c86bcaf7796106  loginutils-sha512.patch
91a7584a562a72ba886936558e576bbd  udhcpc-discover-retries.patch
31bbf1c3957a939a4508528055a300ec  busybox-1.23.0-ash.patch
345f21ccf074904aa591206fc056285d  busybox-1.23.0-modprobe.patch
539be43937fdb198c111b077b0771f3b  busybox-1.23.0-vi.patch
04eeda8c49d4688e6dec02451f8b6aae  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
e1c183cbe1ca18a0fa0d9597314076c9  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
239dbe5dae5d36bbf73548b2749a22b1  0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.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
3cff842a3618c84465d7ef5425c8749b  busyboxconfig
befaac2c59c380e36a452b3f1c1d4a3a  glibc.patch"
sha256sums="483ab594dd962ddbb332fd24e36ffdd6e36ac2182fbff055c56e1ca49fda09e4  busybox-1.23.0.tar.bz2
81957f1fe0c386120dad1c8174ccc1fcfeed98c14d229db7d164d4fb4c938b3d  bbsuid.c
9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d  nologin.c
327bb8049e2726351a5c8b6b2cef864f6ce58725d4453983f97092ea73656ccc  busybox-1.11.1-bb.patch
a31ce8bcb8b81b20e80ffa407600a530d085806c6471f4e4249fcb3a491b79ef  busybox-uname-is-not-gnu.patch
576366b4d50f1078da6c0364ef70415de92d97c93c64f4d790b11d7a34cdccd2  bb-app-location.patch
57674b20158c0b266ed028b0c65299f9cbcad7d33d19c9fcc403d3967daba493  loginutils-sha512.patch
90825a443339f1c8c249d05f7b025ce53e374d305f8e113d98d45146b105494d  udhcpc-discover-retries.patch
fed81c2c8d2cda7d710e2825c549a0fe42fcb58fd342866729c37e9789d5c9e5  busybox-1.23.0-ash.patch
e59ce711b44bb0fdc7adb5bed648287ce4a3212ac1e4afd94bdf5bd6ae0fb590  busybox-1.23.0-modprobe.patch
24595c896674c282c7ab264355d4a7dfb819e86d12cbdc2e7d101689027cffe1  busybox-1.23.0-vi.patch
2e9d56335ca39e944b9abd9ecc91d0e47a3fe3434f8b7ec3f526bc8fa0895ada  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
53563c6dc4db13004d0b37f7bf1748e861b5a5c4244c1d34f102c23b689420c5  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
ac2cd5fed91bfaec22ed1f2766396d0feb29b9b96f20b2c12d5d8ac8769afae9  0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.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
342bb69c144a1e63d7a7fe4c24578ce5b483c09751ac16bb36d1b88929068141  busyboxconfig
c604ef791c31d35a8c5ee4558d21428a46f37a6d762c4a7e29864f4037fc44a0  glibc.patch"
sha512sums="02c8f9dd9e47ad67b417fa58ba952bbdda6e79bad5399fba3d8217803053c2fd045228bd76d56e97d40c98296841dc66e4fa829887c05378a83bdeabafeb7f72  busybox-1.23.0.tar.bz2
16b3dd6a8b76b062d51458351fcb44f84b49eb4bf898584c933df90fb2cb3966f9547865a4d7447589bb20b7c203beb04ff7512f76f85d29138d2cff4eb9ee81  bbsuid.c
4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2  nologin.c
eb7cce973bfd53ce3350713437b9e2751becfb8dfb10b14f27c4f812297c403b90f80dc2906179d499e8dffbe6df8aa37ae27625c552162923d59fe35b55b32b  busybox-1.11.1-bb.patch
225c0608972f7daaca672eafdf647eea392e076537287370ca7791931de4803645d4d159385dc2909314028dccba3c64d0c89fa4e1184f856959b17c58459ed1  busybox-uname-is-not-gnu.patch
5c42b05be69c834c9fd5372c6b0d55a6399c74146a94ea09eae7285dd4fa75d1bde38bf7ab73e98638f65eb72db02115453cbdfe85a0085d742940366f617c7d  bb-app-location.patch
69af4800fcf765b4ae029daced7ff171b6b04d810c94a987c7ba848e275a27b77b18b38df1b85f4a12c4a47ed42f62e0768260eb1198e2aff1c3cea898b85c61  loginutils-sha512.patch
34415fe69f6b8d42756046aa8e6d9e4f64a3b0ceb9f57c4c988e35870fe975f05d0ac76f1f9a712196e9c59e67aa2a54abf398242009134fb3aca342c25a3646  udhcpc-discover-retries.patch
e70fc7b37f18b14638f3526ae1730bb178c190d6bb6c931beadbc5ef3d883dee9b994624af62641ca75edc50cae0e1259f3d52ffcf0d3cb78ceac90000df8962  busybox-1.23.0-ash.patch
13088f5d2e2b2da8155697d6e1787815a49bc1b353650fa596d99be966c836a967f774725d8258508239f041d5c6f74a55abe407f917a51b2f5b72d75b0c2e5a  busybox-1.23.0-modprobe.patch
b9099407a17ab29b30e9aa3cc30f1b0d05115cf14b49fcfb41167a6f2c77eafd7455f07e9b2ccaa5770cfa45e6458c3931d618c1330ed3ec4e8b613575db3d19  busybox-1.23.0-vi.patch
f2ed7bf994766a20ceecb28bea8c66307b6b66cdd7099408b1f29a529786ce07e55824b21256321708663e00d6fe9428480b0d3e121b67d6ebd8a8a87b1486d1  0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch
b1a1cc2ada657a3d3364c8c96853575d73784e769cd8768c170c27a3e59abd2beace75dff6d5047c4391725e961d93149f9c3f45ed75fb1c582bf18b818282c9  0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch
6781b10ca078296b243373d2c3f2bca2507a9df18a6b06d051e9ce84ed31a238aef3b2bb085daf12b145550be68c07c854272bd78a6f77da9197779b9c7cd9e9  0001-linedit-deluser-use-POSIX-getpwent-instead-of-getpwe.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
2efb13f23c48a4dc3e2eb6343256694719c3425fe8ddd36ce9fb1837e45fafa3326c2630a08d731abc6bbc104536218d095b2d997861c5b35a7f7907177d2e66  busyboxconfig
1d2739379dab1deb3eae7cffd4845300eb7d30f7343b4a1209b21a5680860d55080ad45fdefe098b249ce3040c01951fa7f0a79cd447b2d7b260eb000099d9dc  glibc.patch"