summaryrefslogtreecommitdiff
path: root/aports/busybox/APKBUILD
blob: 633f898e14e9d61b5538e9b253a23738928dea55 (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
222
223
224
225
226
227
228
229
230
231
# Maintainer: Gabor Pali <pali.gabor@gmail.com>
pkgname=busybox
pkgver=1.36.1
pkgrel=1 # base: 2
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url="https://busybox.net/"
arch="all"
license="GPL-2.0-only"
makedepends_build="perl"
makedepends_host="linux-headers openssl-dev>3"
# Only build with UTMPS support if we are not bootstrapping.
# skalibs-static is needed for utmps-static
[ -z "$BOOTSTRAP" ] && makedepends_host="$makedepends_host utmps-dev utmps-static skalibs-static"
makedepends="$makedepends_build $makedepends_host"
checkdepends="zip"
install=
subpackages=
options="!check"

_openrc_files="acpid.initd
	crond.confd crond.initd
	defaults.initd
	syslog.confd syslog.initd
	udhcpd.confd udhcpd.initd"
_mdev_openrc_files="mdev.initd"

source="https://busybox.net/downloads/busybox-$pkgver.tar.bz2
	0001-modutils-check-ELF-header-before-calling-finit_modul.patch
	0002-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
	0003-ash-add-built-in-BB_ASH_VERSION-variable.patch
	0004-Avoid-redefined-warnings-when-buiding-with-utmps.patch
	0005-libbb-sockaddr2str-ensure-only-printable-characters-.patch
	0006-modinfo-add-k-option-for-kernel-version.patch
	0007-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
	0008-pgrep-add-support-for-matching-against-UID-and-RUID.patch
	0009-properly-fix-wget-https-support.patch
	0010-sed-check-errors-writing-file-with-sed-i.patch
	0011-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
	0012-nslookup-sanitize-all-printed-strings-with-printable.patch
	0013-ash-exec-busybox.static.patch
	0014-app-location-for-cpio-vi-and-lspci.patch
	0015-udhcpc-set-default-discover-retries-to-5.patch
	0016-ping-make-ping-work-without-root-privileges.patch
	0017-fbsplash-support-console-switching.patch
	0018-fbsplash-support-image-and-bar-alignment-and-positio.patch
	0019-depmod-support-generating-kmod-binary-index-files.patch
	0020-Add-flag-for-not-following-symlinks-when-recursing.patch
	0021-udhcpc-Don-t-background-if-n-is-given.patch

	0023-tests-fix-tarball-creation.patch
	0024-tests-musl-doesn-t-seem-to-recognize-UTC0-as-a-timez.patch
	0025-Hackfix-to-disable-HW-acceleration-for-MD5-SHA1-on-x.patch
	0026-lineedit-Handle-SIGWINCH-gracefully.patch
	0027-umount-Implement-O-option-to-unmount-by-mount-option.patch
	0028-ash-use-after-free-in-bash-pattern-substitution.patch
	0029-awk-fix-use-after-realloc-CVE-2021-42380-closes-1560.patch
	0030-shell-avoid-segfault-on-0-0-0-09J-.-Closes-15216.patch

	acpid.logrotate
	config
	default.script
	$_openrc_files
	$_mdev_openrc_files
"

# secfixes:
#   1.35.0-r17:
#     - CVE-2022-30065
#   1.35.0-r7:
#     - ALPINE-13661
#     - CVE-2022-28391
#   1.34.1-r5:
#     - ALPINE-13661
#     - CVE-2022-28391
#   1.34.0-r0:
#     - CVE-2021-42374
#     - CVE-2021-42375
#     - CVE-2021-42378
#     - CVE-2021-42379
#     - CVE-2021-42380
#     - CVE-2021-42381
#     - CVE-2021-42382
#     - CVE-2021-42383
#     - CVE-2021-42384
#     - CVE-2021-42385
#     - CVE-2021-42386
#   1.33.0-r5:
#     - CVE-2021-28831
#   1.30.1-r2:
#     - CVE-2019-5747
#   1.29.3-r10:
#     - CVE-2018-20679
#   1.28.3-r2:
#     - CVE-2018-1000500
#   1.27.2-r4:
#     - CVE-2017-16544
#     - CVE-2017-15873
#     - CVE-2017-15874
#   0:
#     - CVE-2021-42373
#     - CVE-2021-42376
#     - CVE-2021-42377

prepare() {
	default_prepare

	mkdir -p "$srcdir"/build
}

build() {
	local _extra_cflags= _extra_libs=
	if [ -z "$BOOTSTRAP" ] ; then
		_extra_cflags="$(pkg-config --cflags --static utmps)"
		_extra_libs="$(pkg-config --libs --static utmps)"
	fi

	cd "$srcdir"/build
	echo "COPIED CONFIG to $(pwd)/.config"
	cp "$srcdir"/config .config
	[ "$CLIBC" = musl ] && sed -i \
		-e "s/CONFIG_EXTRA_COMPAT=y/CONFIG_EXTRA_COMPAT=n/" \
		.config
	make -C "$builddir" O="$PWD" silentoldconfig
	make CONFIG_EXTRA_CFLAGS="$_extra_cflags" CONFIG_EXTRA_LDLIBS="$_extra_libs"
}

package() {
	local file

	mkdir -p "$pkgdir"/usr/sbin "$pkgdir"/usr/bin "$pkgdir"/tmp \
		"$pkgdir"/var/cache/misc "$pkgdir"/bin "$pkgdir"/sbin \
		"$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d
	chmod 1777 "$pkgdir"/tmp
	cd "$srcdir"
	for file in *.confd; do
		install -D -m 0644 ${file} "$pkgdir"/etc/conf.d/${file%%\.confd}
	done
	for file in *.initd; do
		install -D -m 0755 ${file} "$pkgdir"/etc/init.d/${file%%\.initd}
	done

	cd "$srcdir"/build
	install -m755 busybox "$pkgdir"/bin/busybox

	for target in $("$pkgdir"/bin/busybox --list-full | sort); do
		ln -s /bin/busybox "$pkgdir"/"$target"
	done

	#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 -Dm644 "$srcdir"/acpid.logrotate \
		"$pkgdir/etc/logrotate.d/acpid"

	mkdir -p \
		"$pkgdir"/var/lib/udhcpd \
		"$pkgdir"/etc/udhcpc

	ln -s /media/etc/udhcpd.conf "$pkgdir"/etc
	cat >"$pkgdir"/etc/securetty <<EOF
console
ttyS0
EOF
	cat >"$pkgdir"/etc/udhcpc/udhcpc.conf <<EOF
RESOLV_CONF="/tmp/resolv.conf"
UDHCPD_CONF_TEMPLATE="/etc/udhcpd.conf"
UDHCPD_CONF="/tmp/udhcpd.conf"
EOF

	# script for udhcpc
	install -Dm755 "$srcdir"/default.script \
		"$pkgdir"/usr/share/udhcpc/default.script

	cd "$srcdir"

	mkdir -p "$pkgdir"/etc/acpi/PWRF
	# poweroff script for acpid
	{ echo '#!/bin/sh'; echo poweroff ; } > "$pkgdir"/etc/acpi/PWRF/00000080
	chmod 0755 "$pkgdir"/etc/acpi/PWRF/00000080
}

sha512sums="
8c0c754c9ae04b5e6b23596283a7d3a4ef96225fe179f92d6f6a99c69c0caa95b1aa56c267f52d7c807f6cc69e1f0b7dd29a8ac624098f601738f8c0c57980d4  busybox-1.36.1.tar.bz2
17249174b24ba77b6138d640eee4eebcda567a86656623122d8b31044a762ea472096c406d70ba1a1f79450236fa259d4f46c363fa25db6cc4d44950e7a4b223  0001-modutils-check-ELF-header-before-calling-finit_modul.patch
7ebb1ab462083564d2ace3e5719464326b91a40cfcf6117de4b393d3f01ed7acd37a583725323dce4220e255ba742428e0160072a90e4d566b4d7053d1f4a37f  0002-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
f7caad3ef18db7de6deff0fb7b7a7e82fff613d4245f334b56a11e982c40ebcfc6160c235e49d0b4fa7d39b58c0e4924e14473a3770a66d1ef7d4df379b6d858  0003-ash-add-built-in-BB_ASH_VERSION-variable.patch
383cbc2f2f644dc34678d145ea27696a7fa7f46b8952a3448de78d516cb0452872abbc37cb3dcf2b6725c6f7675b972554404b462dec377a8e61c3b73c1cd890  0004-Avoid-redefined-warnings-when-buiding-with-utmps.patch
ce30a642e6804827ef4f7e453d162747143a52dc905950998e996d84767d19548bbbd51bd25530575670c5942137f6926e3cb6f8668e7410569d695bb4165170  0005-libbb-sockaddr2str-ensure-only-printable-characters-.patch
fa0c2f58e5bb8f646bc8451ce00375d860ded228fb7ec4ed61e3920e41990822be1fcdd8cdf9c0342318ba263516a71a837549a9bf52875b1ba652fbc7c54f92  0006-modinfo-add-k-option-for-kernel-version.patch
7313809f283d68521308f7178f6d6e458ee5c826f4c50f40a4595c7a71042d0fe83d938ad2af08e95cbfbc7c0c690fb6c2b2578c2f3e41055bf06bc5cc22d2f2  0007-nologin-Install-applet-to-sbin-instead-of-usr-sbin.patch
24b57ec15205a006310096c63829c8e09820aa8a816a9652bbf9f90efc3e6d28893be1d917deac9793121cd9cca811773272776ead121cc30e9e77cbe904cbcd  0008-pgrep-add-support-for-matching-against-UID-and-RUID.patch
63dae6bf0adb2def1436bed2bcd6ea889bbf666799a8282345e6a4bbf2b567732456fdb20439df870ead5bf242ce2b403170075429b951c5fdf53c134c9e9ef3  0009-properly-fix-wget-https-support.patch
7fea95c4d686b4f5cc5d86b3f5e0df246767b2f86349d36a9596c05af10e7d616edaee2597bcbe96c73b8d307ca6286d276308dce52b881085e67eaaa2b23542  0010-sed-check-errors-writing-file-with-sed-i.patch
2ddf584e1e960a45675e08f6bd4e61a80251bed0fe76ad968b79f4a15d0da89039a3ca62ee6f9605c56ca7e86d8c5696e8ec235acb90bed0998073fef1a4b2dd  0011-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
05b00a98c2d5a2cab89bb6b6b80a39cea5fc2f5ea27589d39232fb2f8b85e2fca78cef84f55de202702274c1c7f7802dd04497a212834ae931297767a9186dc9  0012-nslookup-sanitize-all-printed-strings-with-printable.patch
85d85dcf1fc9c54ed7cbb7ffac36971b6d0a1024e7b6df7fcdccb7e3832bf6b1fa0b0d2e2b7990d0154b752af35a9e8b9b815e244226a9d190c56bf09e9094eb  0013-ash-exec-busybox.static.patch
42a61fa7ad5eeb757f1985331d10ac3a9977aeed8add0eff16aba3da20be0b0e19ed4b9544b6efa75c31d481af5353d7a9707750f5dcb99975f40591bed49a03  0014-app-location-for-cpio-vi-and-lspci.patch
a4a440645f1e8be9b1a92d8611190425e339049cf3e21e837f41b348796b3bb81c4369846d837359e7fbc74a32c34cea7e6924d77ca0865550c84f47fd73a1de  0015-udhcpc-set-default-discover-retries-to-5.patch
c1c522487cde86f73efb4800f610d54674d3fa381a0266598cf6c1b002b2b18be9011014b26d5d5ab82c22f6a9eaa920f32cfbb956790880497ff4316c26a64d  0016-ping-make-ping-work-without-root-privileges.patch
a9f7dd37b2722265089b39d24d47e9c4911ff1e31f9dd1c3d5ba49bca7656f3fd2b42dcfd2f837ba5ae6b850dd1b02bb6af9a97a3980fe098daf1c20fb2a4630  0017-fbsplash-support-console-switching.patch
5653c818400c38966726adf1c99b603f6f760179a291c13b5320b79e0ef63d1ad9251b276d6eed68a6b8c95bfabd95eccce9d73edbc2ea888b994d6a02763050  0018-fbsplash-support-image-and-bar-alignment-and-positio.patch
ce4316e44148562addc1f5839166ca9314ee6f26dae218617c287791a8d9239e374f993688a9299e24c9a237e4c21e481a0b35baa4e8b123ce9e2b23d065001c  0019-depmod-support-generating-kmod-binary-index-files.patch
80c426dc2ea6cafa359a078a4a283735db0b3611a6c953ee7b7b2ec00c41a1263b61085c37447fcc50a01c229db93fa8fa675b8c995040eb31e9ed6f3723a0cf  0020-Add-flag-for-not-following-symlinks-when-recursing.patch
22c1d3233b210b8a334f31101eb6ff15d276eaef009758cff57a642b660ebe38114d7f3c8055113f12d6620acc8a8f0a2fe51dbede9100cd3d0eb5cdd2d01e39  0021-udhcpc-Don-t-background-if-n-is-given.patch
923c29b050f456210fbb06d72c77f53eff2179757e8595a8e9cd1ad3f1d4d300c525bec88de3170fa16dbe6a0ea498cdf01ab5a20a289af913ca05b27abab27d  0023-tests-fix-tarball-creation.patch
192fe9b535b3ae4cfbd8455d642e9c73b134ddbdf9265b3ebd1a185122bbb1064cf2c1f01840a8cf35d0665969846ff7168c215fdce96b46b031d73c16f7622f  0024-tests-musl-doesn-t-seem-to-recognize-UTC0-as-a-timez.patch
0a0e4c425879d8250b4dee925dc9feb2595ed68b1fdb5c22e78f3452e46dc17c882ea47f119c2308915f4105b69e5c6f38156131bee1fe9ba0ff684bfd10a049  0025-Hackfix-to-disable-HW-acceleration-for-MD5-SHA1-on-x.patch
09358ed36d6c13a50119a9d96898fdc2d3e6ca089659780604425ae3d32960a17c3083de81a131b1cf9a9a2b449e40a8ed6af3a8b916247571ebc41765ab365b  0026-lineedit-Handle-SIGWINCH-gracefully.patch
e3670ab567818a42593698546dcdabaa447c10682261c128901b4390eb2bf2dbea9e84f8f2dcdd6d67c82bf93bb1eed14406e5a8dd723b4670d1995b6100651f  0027-umount-Implement-O-option-to-unmount-by-mount-option.patch
d3bd84c42487de573c0c5165a847fd233ddcd4d53a61b1e03c30a46b6dba3993e741f12daf167b8347fb7a420b188f4027582f16e92dc822eb3293804dfc62f8  0028-ash-use-after-free-in-bash-pattern-substitution.patch
5f8c1a848f28aff2b28085950c561e1a51dfcea043da455e3daf9b960025dd8789ecfe43370553cb727d4ec239aa23c42e3ae5f6ef1cd5768d69c80c31b8f39e  0029-awk-fix-use-after-realloc-CVE-2021-42380-closes-1560.patch
28748a431718f270b2d0023d09f059e6a32501afb9fd243c4b127fec28bc9312ffb7fdcc1563544a2cb29bed66383ecfea7957d557f7b21402ec3bdb6938004f  0030-shell-avoid-segfault-on-0-0-0-09J-.-Closes-15216.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1  acpid.logrotate
b1e13a736eaf8a621b648d97c2526fe72215a5bfb13277a58c7d631bcee08cbcea20dd3d11ea8a97e545ec137adc41bd75f5f6dcbcfae96934fe6b3d14c94b46  config
6c1d25c733fd9ac6ba7d3c7f474c836fbfd41d8f1753ec9c21c08d57cd6249023a0b16f81da4d2ec5d56d14509f7ba1fffadf691504f0670f90017aaf1ed564b  default.script
fcb532233fd7ba8cad302d037b88cff00ee8b96b37c90b34fc823479208cf7cdda48818c972ce2c4703b7283fd58e99ba8a724818f884f3b09eaa7e2d6ffad21  acpid.initd
34c6f3197064bb91619b899b28a201bd4d920b18bded3845440b2cb36dc6f16cabf447c96878349b16e46c30184cbe48bac00a01c5f7cf1be038c0b7136064c5  crond.confd
f3a104095c659eef79925e8df850cdac499f6c7756fb9647088a24b98dc72f37413c3869da6113bcc578c2178c1c2e5ab8d31a50ad2e472c06aaf408e8924d6a  crond.initd
4624388f7e853fc1c2cdb170b31e60888ed9226bb62c3c1f59f06b91a6c9f8d4feb10f5680b1fbebc516967058ad247ecbcd5dc7d4c0ca43d542cdb6b669bad9  defaults.initd
bf8173ee33a5d2b61cbdbc1b070e599a17a21e5433a0d8aa9beef71e4ac831304076af8e7e58dc594cdee61562329793afdc57af91e5496bf5fffb9b734a3d9c  syslog.confd
a13a6add6f7fb10a3a2563391b6f8b68161249147e9f50e6d857c5689123f6d974368ce4f13b8d93312fa38d05f604d67c4c976d8a7eef301af50a3a6ad50c23  syslog.initd
2947b23728d3ad6839f660fee11fc4c86d0d1a3fc450ceff85480932b0699e7b7293eb7258cf0e957542ed3c7a4416376ebb284992e6682aede61f48069b1043  udhcpd.confd
4a8d1e924284fca730a262fedc3cb76b4f4689a6c650b0c5544b65eeab6cfd9e8eb91f448d9ebbba6efbb056695428c1b26e5eaeb7233bae090676d1789954cc  udhcpd.initd
6ce0b2a8fe69cc7ea657c5b9076aba51c8f0beeaafa4a887d8673bcc9f9cf8ee40f4b07d2d901ec7a1a1e4f29c150c496559559e803595d0bd487dec56b530a2  mdev.initd
"