blob: 3567a2510b9412dfb26253c22b176cdc02491fd5 (
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
|
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Oliver Smith <ollieparanoid@postmarketos.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.31.0
pkgrel=1
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url="https://busybox.net/"
arch="all"
license="GPL-2.0"
makedepends_build=""
makedepends_host="linux-headers openssl-dev libtls-standalone-dev"
makedepends="$makedepends_build $makedepends_host"
checkdepends="zip"
provides="/bin/sh"
install="$pkgname.post-install $pkgname.post-upgrade
$pkgname-extras.post-install $pkgname-extras.pre-deinstall"
subpackages="$pkgname-static $pkgname-suid $pkgname-extras ssl_client"
options="suid !check"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="https://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0001-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
0001-properly-fix-wget-https-support.patch
0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
0003-ash-exec-busybox.static.patch
0004-app-location-for-cpio-vi-and-lspci.patch
0005-udhcpc-set-default-discover-retries-to-5.patch
0006-ping-make-ping-work-without-root-privileges.patch
0007-fbsplash-support-console-switching.patch
0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
0009-depmod-support-generating-kmod-binary-index-files.patch
0010-Add-flag-for-not-following-symlinks-when-recursing.patch
0012-udhcpc-Don-t-background-if-n-is-given.patch
0013-testsuite-fix-cpio-tests.patch
acpid.logrotate
busyboxconfig
busyboxconfig-extras
bbsuid.c
dad.if-up
ssl_client.c
"
# secfixes:
# 1.30.1-r2:
# - CVE-2019-5747
# 1.29.3-r10:
# - CVE-2018-20679
# - CVE-2019-5747
# 1.27.2-r4:
# - CVE-2017-16544
# - CVE-2017-15873
# - CVE-2017-15874
builddir="$srcdir"/$pkgname-$pkgver
_staticdir="$srcdir"/build-static
_dyndir="$srcdir"/build-dynamic
_dyndir_extras="$srcdir"/build-dynamic-extras
_config="$srcdir"/busyboxconfig
_config_extras="$srcdir"/busyboxconfig-extras
prepare() {
default_prepare
cd "$builddir"
mkdir -p "$_staticdir" "$_dyndir" "$_dyndir_extras"
}
build() {
# build bbsuid
msg "Building bbsuid"
${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} \
${LDFLAGS} "$srcdir"/bbsuid.c -o "$_dyndir"/bbsuid
msg "Building ssl_client"
${CC:-${CROSS_COMPILE}gcc} ${CPPFLAGS} ${CFLAGS} $(pkg-config --cflags libtls-standalone) \
"$srcdir"/ssl_client.c -o "$_dyndir"/ssl_client ${LDFLAGS} $(pkg-config --libs libtls-standalone)
# build dynamic
cd "$_dyndir"
msg "Building dynamic busybox"
echo "COPIED CONFIG to $(pwd)/.config"
cp "$_config" .config
[ "$CLIBC" = musl ] && sed -i \
-e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
.config
make -C "$builddir" O="$PWD" silentoldconfig
make
# build dynamic (extras)
cd "$_dyndir_extras"
msg "Building dynamic busybox-extras"
cp "$_config_extras" .config
[ "$CLIBC" = musl ] && sed -i \
-e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
.config
make -C "$builddir" O="$PWD" silentoldconfig
make
# build static
cd "$_staticdir"
msg "Building static busybox"
# enable internal ssl_client for static build
sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \
-e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \
-e "s/.*CONFIG_SSL_CLIENT.*/CONFIG_SSL_CLIENT=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 "$builddir" O="$PWD" silentoldconfig
make
mv busybox busybox.static
}
check() {
cd "$_dyndir"
SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check
cd "$_dyndir_extras"
SKIP_KNOWN_BUGS=1 make -C "$builddir" O="$PWD" V=1 check
}
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
install -m775 "$srcdir"/dad.if-up "$pkgdir"/etc/network/if-up.d/dad
install -Dm644 "$srcdir"/acpid.logrotate \
"$pkgdir/etc/logrotate.d/acpid"
mkdir -p "$pkgdir"/var/lib/udhcpd
install -Dm644 "$builddir"/examples/udhcp/udhcpd.conf \
"$pkgdir"/etc/udhcpd.conf
cat >"$pkgdir"/etc/securetty <<EOF
console
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
EOF
}
extras() {
pkgdesc="Additional binaries of Busybox"
depends="${pkgname}"
install -Dm755 "$_dyndir_extras"/busybox "$subpkgdir"/bin/busybox-extras
}
suid() {
pkgdesc="suid binaries of Busybox"
depends="${pkgname}"
cd "$_dyndir"
mkdir -p "$subpkgdir"/bin
install -m4111 bbsuid "$subpkgdir"/bin/bbsuid
}
static() {
pkgdesc="Statically linked Busybox"
mkdir -p "$subpkgdir"/bin
install -m755 "$_staticdir"/busybox.static \
"$subpkgdir"/bin/busybox.static
}
ssl_client() {
pkgdesc="EXternal ssl_client for busybox wget"
local _sslver=$(pkg-config --modversion libssl)
# automatically pull in if both busybox and libssl is installed
install_if="$pkgname=$pkgver-r$pkgrel libssl${_sslver%.*}"
mkdir -p "$subpkgdir"/usr/bin
install -m755 "$_dyndir"/ssl_client \
"$subpkgdir"/usr/bin/ssl_client
}
sha512sums="cd58f0b2b6e3bb1b771fcf3d15f420518fb9b10086a45cfb1d7f136ac035be89eec28f9350e42b3fc38454d8bef9190eae0376497487c73785e8fde44c793730 busybox-1.31.0.tar.bz2
ead3403578c071c2216de17ab0543984c1f1509c12c062f03af49141547c3ea21356f3e8f0f0695550f05a41a1379dd73fc3cc18dcd78addbb411f247351e353 0001-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
a2787a3ecaf6746dadef62166e8ee6ecaa166147e5ad8b917c5838536057c875bab5f9cf40c3e05eba74d575484ac662929ac3799d58432d3a99ac46f364f302 0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
78f4c602e518b01d600824cea246992e58961f2a65737741b1a2283c96900f11504b791423f2482eec79090a9f612b2088c66f6c9f22153daca08b7fe534cca5 0001-properly-fix-wget-https-support.patch
d8694293edc8cd55cecafeb902f03c01af318e13966f399365cf792b840793891ac086bb67ef83e7a5a2e01b246497a6c6511cb6a856834f6672dee4bca76896 0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
8c34dd5ce9a6e84279fa6494cbae0b254778976f341af1d0ccc2a3afb405fb22d374e9623ea83d1500da77c7463db2ed5218d2c9f49350a21114bd0bb17fd87d 0003-ash-exec-busybox.static.patch
e4be12a1453a306a58c4ea59cd8a0bf1f261514ae090ea962ac6f7609dc1e9dab0d4d8d351d7adf4f76bf52d37db9ad0102116635e437945c131f762d5750d19 0004-app-location-for-cpio-vi-and-lspci.patch
f96d66ce5a0295a2459a2c49c281b64e016de675ebd31a49af18cb06f3498fe27dfbc8667324b4391fdf8136aea8533dce643f1c740d10de811808985950bd15 0005-udhcpc-set-default-discover-retries-to-5.patch
136e35be699b6953e1b624c65bcc41fd096cf98fb00de4409855d0eda8b8a1ee830eb6eb1f0d0dd7d47ee940321e056b3765fd77747bf6a90a07d9cf84a9626c 0006-ping-make-ping-work-without-root-privileges.patch
7873b98c676a92faea61511d50c1efac1220354d20afd53de19e2c8f1472559cb333b9dd4e0d6432616d8c5f59885f1503c448c86a912e8031c9bfed628c2db1 0007-fbsplash-support-console-switching.patch
2c56906dac70dea6276e4c573707cb06c4c8b53defcd33b1e5a28f928e7dafe905a52ce40571de430e4af7e00a75ecc0f249d2fec02da5f3d9edd4e904919a35 0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
907aef47c88f60e93bcd290eb43102721978ab6fc6eca52914172801ace7306ae8b11f38ed8b086452bbf46d75424740161e4f1e7840a485f0f78024455f902b 0009-depmod-support-generating-kmod-binary-index-files.patch
3b13ba6bd9b697e48864cb5376849c1ac95b30650e3e27605cc05edf4fdc1ecbb4c4503d4fe9012a581bcd660f6bb44d644575cf437d30423614cb83ee92c22c 0010-Add-flag-for-not-following-symlinks-when-recursing.patch
b0f956e98ed1b670dc27f835441407d32395d371599780cf87a5fb2eee43ad2f77c8c484d20f08b1ed5d2bdee039668ff1a0b02561fa8206832072ab3b89cc45 0012-udhcpc-Don-t-background-if-n-is-given.patch
d8926f0e4ed7d2fe5af89ff2a944d781b45b109c9edf1ef2591e7bce2a8bbadd7c8ca814cb3c928ae09027d9603434fe70496f308d701f3d42260ebd1e9e9b29 0013-testsuite-fix-cpio-tests.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1 acpid.logrotate
ace97d165b80121968458f57d856d7f0b12ff342defe87c33ed5f994f7b00027b65f7389f6d23120a7d11449378e3d503552e87b17a3bb18337d74992b125b14 busyboxconfig
5f9739b9d0c1ba5d77e3153c373593a1bcb813cf466f951b00a2a040262e5077fb13c1a7aa17d67d1533a473bfcacc1a22833b7f491b4dde9dcb5638ad585f9a busyboxconfig-extras
0becc2186d6c32fb0c401cf7bc0e46268b38ce8892db33be1daf40273024c1c02d518283f44086a313a2ccef34230a1d945ec148cc173f26e6aa9d88a7426e54 bbsuid.c
b993ce589685d5d1f806153d0b7f71657f2d37556654ec60884130a40f09acc4944a13e0a4d02914000bedd779e5a35da08c760fed5f7ca5b601243aff7ba2c9 dad.if-up
646ad9aefe3596d0170d92c8506ca1846e43b5b83cbef97ae565f15ffa7b14665a8c7061bc69c608c043f834c134c5d63f042509f8999031e89163508a868e46 ssl_client.c"
|