summaryrefslogtreecommitdiff
path: root/aports/busybox/APKBUILD
blob: a1e83c6359ef51cc6ffde0b44eeadd71a2c3e16b (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
# Maintainer: Gabor Pali <pali.gabor@gmail.com>
pkgname=busybox
pkgver=1.34.1
pkgrel=5
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 openssl1.1-compat-dev libretls-dev"
makedepends="$makedepends_build $makedepends_host"
checkdepends=
provides="/bin/sh"
install=
subpackages=
options="!check"
source="https://busybox.net/downloads/busybox-$pkgver.tar.bz2
	0001-rev-correct-output-for-long-input-lines.patch

	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

	0001-ash-add-built-in-BB_ASH_VERSION-variable.patch

	0001-cpio-add-support-for-ignore-devno-like-GNU-cpio.patch
	0002-cpio-add-support-for-renumber-inodes-like-GNU-cpio.patch

	0001-pgrep-add-support-for-matching-against-UID-and-RUID.patch

	0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch
	0002-nslookup-sanitize-all-printed-strings-with-printable.patch

	acpid.logrotate
	config
	default.script

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

# secfixes:
#   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"
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="
fb7e53a56c07b1098a12ee7232ad5401b147816648a0619b3b5358fdcf0915cfbb054500c0e0dd4acb3bc0a93a584b62bc5448e1f16b28004f58b39518a13b9d  busybox-1.34.1.tar.bz2
054e766429887e610c4a17846f495b7099bb419217f5fcc0dce0ed62b8740c2d4ee53b12a609b1830c26ac2af1eca9beb6140063b7d2665939f99f8664dfcc05  0001-rev-correct-output-for-long-input-lines.patch
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
d12246f1134bbd3993462d27172c4739cc601b251d57ce8e088745773afa965551236e8cb8b9013dfc142fd055e369a771d86c7c54615c89bd30393400bfa390  0001-ash-add-built-in-BB_ASH_VERSION-variable.patch
6f8fa4ec190d64d6c3d5377994be933885ed0b40361c99ca35881684db3b1b79664d6eab56a389df290b9f6c4db502c617ec8e4ffa6d5284bd41cea1f478b26c  0001-cpio-add-support-for-ignore-devno-like-GNU-cpio.patch
97109be04445b7b887c402b7072c1da57212ef11f2eca6d34c24d5a4e3b2866ee79aca7a0ca41043726293d9bed1b2fa8aab100501569f00b8670c280a87a01c  0002-cpio-add-support-for-renumber-inodes-like-GNU-cpio.patch
e33dbc27d77c4636f4852d5d5216ef60a9a4343484e4559e391c13c813bf65c782b889914eff2e1f038d74cf02cb0d23824ebbb1044b5f8c86260d5a1bbc4e4d  0001-pgrep-add-support-for-matching-against-UID-and-RUID.patch
b52050678e79e4da856956906d07fcb620cbf35f2ef6b5a8ee3b8d244ea63b4b98eef505451184d5b4937740d91eef154ed748c30d329ac485be51b37626f251  0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch
ead4ad65d270d8659e1898fa16f76b6cbcf567d8aba238eacccda3764edb4362240d9359d6389873bedc126d405f805fc6dfce653a7181618ebcc67c94bd08d2  0002-nslookup-sanitize-all-printed-strings-with-printable.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1  acpid.logrotate
8b766b424d110c73696e13162ebc077ea27d402d81354c33be90988f39d2b2584444f4d87a24d048e10f18649d39e7771c84574d3b31dff96c3cbe206caac706  config
c3194ccffe7300a0f55d50fb56d38c8df55d588adac13056fd0be2676594974477f94de5570a5a882bc864c3711cf67aa43b6ad6808e672f4533dd0f7363d2f5  default.script
dd548670114a92404b8e35fb915fdbe5994498b05b0a418583271c3dd72fb7800950e42c095c902a014eb198c046b8a346d43dccd8e7a158048ae33767c572ed  acpid.initd
c9d0fb0f8cc27d661d3b4e58c56eb598ca368890576e18ffffd42efdf68ba35537656be9be319b2e2818aa0152d3ca8611bece2433512fbfcd4eed7988765549  crond.initd
1aed59fb048f0636ee8a095a089a20554a20eda84c70485a894ae60b0f97b792b7ce8e832557457258f59a2750735c4a25e247364ccf1180e9652b292a5f9e8d  mdev.initd
acfd45bda4526ab551a30faec1742ad1569aa85e0d315959c3e3a3d6a693f94c74efeb57a00b8791524651e8a61d3f7ea3e3e08a4b0291ec46309f594ee8124c  syslog.initd
1d4574ec7cc6d7e9952bb50b4fcb10a910868688da03a25aede492835313c686247bde1faa17f50243d61a93bfc1d8fa54cf821d7be908581e365b0f1b6a5588  udhcpd.initd
34c6f3197064bb91619b899b28a201bd4d920b18bded3845440b2cb36dc6f16cabf447c96878349b16e46c30184cbe48bac00a01c5f7cf1be038c0b7136064c5  crond.confd
bf8173ee33a5d2b61cbdbc1b070e599a17a21e5433a0d8aa9beef71e4ac831304076af8e7e58dc594cdee61562329793afdc57af91e5496bf5fffb9b734a3d9c  syslog.confd
634fa067629febcdd8ba9516fbaafddd5be2d38ac37bff9eccfacce0fcf3b259426c12ff967b179bd93b2962401a4a2f15709d32da0623bd078688b8611817cd  mdev.conf
0f54666072a8ee32965cc1b5205a6d35bc2ba6655f298c37ba9ccd72949fa7c41b1e540ec91f41b11f4b261ace614cdcc42dccf390bf0a22698d0ba499feae39  persistent-storage
"