summaryrefslogtreecommitdiff
path: root/aports/busybox/APKBUILD
blob: 18e2308c1ef849e7ef7b47fb34ba87bb39c2dba2 (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
# Maintainer: Gabor Pali <pali.gabor@gmail.com>
pkgname=busybox
pkgver=1.35.0
pkgrel=2 # base: 17, -initscripts: 4.2-r0
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"
# 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=
provides="/bin/sh"
install=
subpackages=
options="!check"
source="https://busybox.net/downloads/busybox-$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
	0001-modutils-check-ELF-header-before-calling-finit_module.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-ash-fix-unsafe-use-of-mempcpy.patch
	0014-ash-fix-use-after-free-in-bash-pattern-substitution.patch
	0015-ed-don-t-use-memcpy-with-overlapping-memory-regions.patch
	0016-ash-don-t-read-past-end-of-var-in-subvareval-for-bas.patch
	0017-ash-Fix-use-after-free-on-idx-variable.patch
	0001-ash-add-built-in-BB_ASH_VERSION-variable.patch
	0001-pgrep-add-support-for-matching-against-UID-and-RUID.patch
	0001-avoid-redefined-warnings-when-building-with-utmps.patch
	0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch
	0002-nslookup-sanitize-all-printed-strings-with-printable.patch
	0001-modinfo-add-k-option-for-kernel-version.patch
	CVE-2022-30065.patch

	acpid.logrotate
	config
	default.script

	acpid.initd
	crond.initd
	mdev.initd
	syslog.initd
	udhcpd.initd
	defaults.initd

	crond.confd
	syslog.confd
	udhcpd.confd
	mdev.conf
	persistent-storage
	"

# secfixes:
#   1.35.0-r15:
#     - 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() {
	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
}

package() {
	local i

	cd "$srcdir"/build
	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

	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

	# deploy init scripts
	cd "$srcdir"

	mkdir -p "$pkgdir"/etc/conf.d "$pkgdir"/etc/init.d "$pkgdir"/lib/mdev\
		"$pkgdir"/etc/acpi/PWRF
	for i in *.initd; do
		install -m755 "$srcdir"/$i "$pkgdir"/etc/init.d/${i%.*} || return 1
	done
	for i in *.confd; do
		install -m644 "$srcdir"/$i "$pkgdir"/etc/conf.d/${i%.*} || return 1
	done
	install -m644 mdev.conf "$pkgdir"/etc
	install -m755 persistent-storage \
		"$pkgdir"/lib/mdev/

	# poweroff script for acpid
	cat >"$pkgdir"/etc/acpi/PWRF/00000080 <<EOF
#!/bin/sh
poweroff
EOF
	chmod +x "$pkgdir"/etc/acpi/PWRF/00000080
}

sha512sums="
62b2e718b6669271380445ed6db249618d777a4e8d5e6d879fa39ffee43887b6a2e93ceef874c615c565ad492deb772b03a19b7475c403202741579fb151e16a  busybox-1.35.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
1efe1c4894ae983fed5ac848125f8603f157b9d91c952c53f4192b48d3e50967e05559851148397b583f34fb02d480393547904b4635e4248248be567ab268ea  0001-properly-fix-wget-https-support.patch
0cac9b944928500293e366b42e03211d4159d05b622da60664825e5ee87c9bf6d5a8ea5e794584713f7464efb4cdc431e02f439c717b7e62b1864a228bc8cbac  0001-modutils-check-ELF-header-before-calling-finit_module.patch
d8694293edc8cd55cecafeb902f03c01af318e13966f399365cf792b840793891ac086bb67ef83e7a5a2e01b246497a6c6511cb6a856834f6672dee4bca76896  0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
8c34dd5ce9a6e84279fa6494cbae0b254778976f341af1d0ccc2a3afb405fb22d374e9623ea83d1500da77c7463db2ed5218d2c9f49350a21114bd0bb17fd87d  0003-ash-exec-busybox.static.patch
a8fc2ccced4054f5eff6ea00389906a543a1716202b19ab71fda1de0e6860c8377ed3c306ffb9efabe9fb16779a306da6770b871229f6bd1d725a84fdaa03fef  0004-app-location-for-cpio-vi-and-lspci.patch
f12916e70f7cc1ef4f6d85d09b9a496a52a494e6318029fdce9a9c812ab5c7b2a046c33b66834127bf809f243c91a53c3c5e27efca026a96fe6b03421de26e60  0005-udhcpc-set-default-discover-retries-to-5.patch
89215c328a46afc686c458a133dd88dcda817586df60eb041a694715e73dc78a297fc0f9a92e8ee7d0a39ce7f6053a6b8e38f3ee078ff90ed13fac2608510105  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
df02adb3e3cd3349cc8d070911e3392164cb2e30bd72cae7ceaa974b2db6f958fdcedf809abc7b4bee37c729a4d20abf127f615b0e238a667d572137abe6a79e  0009-depmod-support-generating-kmod-binary-index-files.patch
ecbe5c890d966f09280c7eb534109f785c68e292765f17ed7ff62fcc61d20f61443c4155add0a1ebfb67ce8564e104c1aa22a8ef0400e119b0bca2bca3671f2d  0010-Add-flag-for-not-following-symlinks-when-recursing.patch
3ae5ecf3ea66c8d98762432026806fdb67b13a28075c6a3cb6e811a34ef89c2f0ed651946003aaad97fb4b7f74d132af3c394c114b7a72e1d20b319b739c5a6e  0012-udhcpc-Don-t-background-if-n-is-given.patch
6b1ebc6da26c355a63c166f4c8d1774e7a9c5456ec76b773395a2158cb4848cf245fa5553843666c0a46f4c97d03e08815abae777f2b80bbb69d916618f94761  0013-ash-fix-unsafe-use-of-mempcpy.patch
3eb7609054fa8e03d7e366f7debc5cb0630ff65d521a91be84803bdef3854f81e29d26a9567c501a121e94a55d3a3477894e774508f80def775f2ecc812805e7  0014-ash-fix-use-after-free-in-bash-pattern-substitution.patch
0040800382a6e3adcc6a8094b821488c7e297fc80304afba23a4fca43b7b26ac699378dfbd930ebbf9985336b3e431301f7ca93e2d041a071902a48740d263ef  0015-ed-don-t-use-memcpy-with-overlapping-memory-regions.patch
4c95dc4bf6aff9018bfb52b400f6d8375a1d22493b44ea516cb12dba6556f12797a3cba55768d2e59ff57c0f3247ec1ff95edb8f17561f3d37ec18d83ca47eb0  0016-ash-don-t-read-past-end-of-var-in-subvareval-for-bas.patch
ccdf098fb15eaa316708181469a1193d6eec7067131e7b7645e0219bf03cfd07f4f79e8f62c1e560f6146dcc38186a29bdee08aaa39f290e11d020b8f07d2f65  0017-ash-Fix-use-after-free-on-idx-variable.patch
6d100fe44da2b97c2cbdda253d0504b487212d195144d9315cddbe8c51d18fae3745701923b170b40e35f54b592f94f02cadbffd9cb716661c12a7f1da022763  0001-ash-add-built-in-BB_ASH_VERSION-variable.patch
e33dbc27d77c4636f4852d5d5216ef60a9a4343484e4559e391c13c813bf65c782b889914eff2e1f038d74cf02cb0d23824ebbb1044b5f8c86260d5a1bbc4e4d  0001-pgrep-add-support-for-matching-against-UID-and-RUID.patch
b4b8195390da70c96503e66e18420b8aea5754f64300082632fcaccd4ebe86cb771d6d4b912f5162e0538e6f756a9377689ad9a138f683cd729c3f54770304bf  0001-avoid-redefined-warnings-when-building-with-utmps.patch
b52050678e79e4da856956906d07fcb620cbf35f2ef6b5a8ee3b8d244ea63b4b98eef505451184d5b4937740d91eef154ed748c30d329ac485be51b37626f251  0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch
ead4ad65d270d8659e1898fa16f76b6cbcf567d8aba238eacccda3764edb4362240d9359d6389873bedc126d405f805fc6dfce653a7181618ebcc67c94bd08d2  0002-nslookup-sanitize-all-printed-strings-with-printable.patch
4f6ddd59d6096943f617b0938fca428114190b8b37732d6783faab291451a2c30c452ed39299db22d1d9679d007022f87d43e93b38a4f6ced64a8659e9233773  0001-modinfo-add-k-option-for-kernel-version.patch
22e2fa8f7a6105fd9990f93b71c235980fd4eab62269939a0e3a920fe517ee4f913c6bd0148a554b67fe01d1660bf0fd76a80e9dcac290b4b8b2c304ef6080a9  CVE-2022-30065.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1  acpid.logrotate
0b92eafab0722a6c9cc4880e3be4976de9713e1e1c715c6c727a948cbd68268fce01ce308291834f70d0cf3328f7c8a44cbdb5b7c70d90f91b15efcb5b90acb3  config
e063599f412df919b75584fee9501925418ef21689232792e9d61178f4e34a65c3cff8a3b1b4cf3e5be61efea2065cc303db35c53ec07b361d3a65e888247544  default.script
dd548670114a92404b8e35fb915fdbe5994498b05b0a418583271c3dd72fb7800950e42c095c902a014eb198c046b8a346d43dccd8e7a158048ae33767c572ed  acpid.initd
c9d0fb0f8cc27d661d3b4e58c56eb598ca368890576e18ffffd42efdf68ba35537656be9be319b2e2818aa0152d3ca8611bece2433512fbfcd4eed7988765549  crond.initd
1aed59fb048f0636ee8a095a089a20554a20eda84c70485a894ae60b0f97b792b7ce8e832557457258f59a2750735c4a25e247364ccf1180e9652b292a5f9e8d  mdev.initd
acfd45bda4526ab551a30faec1742ad1569aa85e0d315959c3e3a3d6a693f94c74efeb57a00b8791524651e8a61d3f7ea3e3e08a4b0291ec46309f594ee8124c  syslog.initd
1d4574ec7cc6d7e9952bb50b4fcb10a910868688da03a25aede492835313c686247bde1faa17f50243d61a93bfc1d8fa54cf821d7be908581e365b0f1b6a5588  udhcpd.initd
23ef7f32447f239b617d5ae221b024c7b47ca4faa9a27f80a4a6a473fd148cb4339a728fee3bb55ce67d531a141ec07c66dca533138652058d3a6a936b68d3c7  defaults.initd
34c6f3197064bb91619b899b28a201bd4d920b18bded3845440b2cb36dc6f16cabf447c96878349b16e46c30184cbe48bac00a01c5f7cf1be038c0b7136064c5  crond.confd
bf8173ee33a5d2b61cbdbc1b070e599a17a21e5433a0d8aa9beef71e4ac831304076af8e7e58dc594cdee61562329793afdc57af91e5496bf5fffb9b734a3d9c  syslog.confd
2947b23728d3ad6839f660fee11fc4c86d0d1a3fc450ceff85480932b0699e7b7293eb7258cf0e957542ed3c7a4416376ebb284992e6682aede61f48069b1043  udhcpd.confd
634fa067629febcdd8ba9516fbaafddd5be2d38ac37bff9eccfacce0fcf3b259426c12ff967b179bd93b2962401a4a2f15709d32da0623bd078688b8611817cd  mdev.conf
2873ec2ba41fe96b010b14fe3fc87d347b71eb6079c12e05ac72eac6c7f146e25096c0b29b2b9d69cbe6840e16dbf4a93ee81132de9fac497e41ab5e8bce2243  persistent-storage
"