aboutsummaryrefslogblamecommitdiffstats
path: root/main/busybox/APKBUILD
blob: a4a135b086c87131437c862375a5d5c38efd83d0 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                   
                                                         
                                                   
               
             
         

                                                              
          
                 
                    
                                                                  
                                                  
                  
                  

                                                                   
                                                                      
                     
                                                                       
                                                              
                                                  












                                                                       
                                          
                                              
                                                                       
                                                                       

                            
 
                       
                     
                            
                
                 
                 
                    
         

           


                      

                        
              


                      
 
                                   
 

                                 
                                             
                               
                                             
 
           
                       
 
                      
                                                           
                                          
 
 
         
                      
                             
                                                          
                                                                  
 
                                 

                                                                                                                 
 






                                                                     

                                                    
 









                                                                     
                      
                        
                                     
                                                     

                                                             
                                                                   
                                    
                                         
                                       

                                                                     

                                                    
                                 

 
         




                                                                

 
           
                     
                                                                     
                                                                     
                                
                                                               

                                                            







                                                      

                                                                           

                                                  
                                               
 


                                                               













                                          

 





                                                                                


                                          


                                 
                                                     

 
          
                                           
                                 
                                                    
                                               

 



                                                                       
                                                                  




                                               














                                                                                                                                                                                                 
                                                                                                                                                                    
                                                                                                                                                                        
                                                                                                                                                                                                 
                                                                                                                                                                                                 

                                                                                                                                                      
                                                                                                                                                 
                                                                                                                                               
                                                                                                                                                      
                                                                                                                                          
                                                                                                                                           
                                                                                                                                           
                                                                                                                                               
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.29.3
pkgrel=10
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://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-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
	0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
	0012-udhcpc-Don-t-background-if-n-is-given.patch
	0013-testsuite-fix-cpio-tests.patch
	0014-miscutils-microcom-Fixed-segfault.patch
	0015-ip-print-dadfailed-flag.patch
	0001-cp-optional-reflink-support.patch
	0001-adduser-prevent-creation-from-invalid-entry-without-.patch
	0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
	CVE-2018-20679.patch
	CVE-2019-5747.patch

	acpid.logrotate
	busyboxconfig
	busyboxconfig-extras
	bbsuid.c
	dad.if-up
	nologin.c
	ssl_client.c
	"

# secfixes:
#   1.29.3-r10:
#     - CVE-2018-20679
#     - CVE-2019-5747
#   1.28.3-r2:
#     - CVE-2018-1000500
#   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"
	cp "$srcdir"/nologin.c loginutils/
}

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"
	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="bf90e24b4564071e0ac2785e2ee4ec4ea0e229a1ff330bb38befe7a27c5a529e7b0657354ce731473814325a27a0c181ab922e0a0a89d5023ba08a6d80472297  busybox-1.29.3.tar.bz2
d09a5cca79b33a7ae05b2c52ba11028ef104aa8a2378c31ef1fa50c45d8e32c397906d4349d48fcbdf65f328b4875efde811704540bdc4c6981895921ef0e445  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
60863a5eca8b88189ee93822fb3f9d45dd5ff43022e64b8ec5394c129c0cfe9999075c3e9f187dff76aea280726e02e5329dd48e9eb21954b118aa454a5da331  0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
025ad19f4e0cd299f11eba4a0c852c166fc91787756838f9c755405dad924fd1fe3c08067b938e14f9d8c609881d2ce5915152810e855eaa5ca510a76650069e  0012-udhcpc-Don-t-background-if-n-is-given.patch
d8926f0e4ed7d2fe5af89ff2a944d781b45b109c9edf1ef2591e7bce2a8bbadd7c8ca814cb3c928ae09027d9603434fe70496f308d701f3d42260ebd1e9e9b29  0013-testsuite-fix-cpio-tests.patch
8cb91903f2be3620b5500a4e8f4190537c93601282510b82303c3b516141b36ab872aeff5a7f5ae00f270439abab862ceabda531bdf180643da165b2f3b35d9f  0014-miscutils-microcom-Fixed-segfault.patch
2fdf01e4bb26a3b6fd7ff73649f15eff599d38db1bc61a699576ec9caae2fb37c49d689baca8b1a3a7b2999fbe04751da897518c2fb42d6f21756b468aa7599d  0015-ip-print-dadfailed-flag.patch
c26e846dc4576a94c376132644ea26755f8cc531fa03b975f2f7e874e2fcbaaca3804ba46849c29b69061b1f411aebedef451418063ec457f88636198dae3be9  0001-cp-optional-reflink-support.patch
06a341de7b34bbe5d7981366772c2ce46599af3e9640d114aa28f7ba4936489fc00c58d4b09c546409e383ef70ca51da179223a9ef53ed51f3575e652506e08e  0001-adduser-prevent-creation-from-invalid-entry-without-.patch
a2787a3ecaf6746dadef62166e8ee6ecaa166147e5ad8b917c5838536057c875bab5f9cf40c3e05eba74d575484ac662929ac3799d58432d3a99ac46f364f302  0001-adduser-default-to-sbin-nologin-as-shell-for-system-.patch
7d94fbd6e25a3d7bbe150fba4edbd18cc29922d5769b63de10d8f1cd65522e5b2a880a275e0970d6180b7519c376c70775d8f88c308ab197e71be1c974c60aea  CVE-2018-20679.patch
6952770be92a980174691ac65fda778eaafd23bf8da63ad62149f2cb0f289bef216bb512ae5e013328b3bd5289a351124d22dd819b1e3116cc2244b435eb7287  CVE-2019-5747.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1  acpid.logrotate
924ff0dac14b4f7213618bd1503ae1b251fea9c3ce11dd87a6ad23ac4fca9b3f765afefdc50f39613579f56b200547320977ec815f87f2c69e20b5aeb484116c  busyboxconfig
74ab7aa1bad3d572869aa5dffae1e3c87d0d24159db5dc8b5521fc652dd32f904d973abd6adf43f21624d53b0844cd66ba93f02f962133a9c432f2ac7bfb42b3  busyboxconfig-extras
0becc2186d6c32fb0c401cf7bc0e46268b38ce8892db33be1daf40273024c1c02d518283f44086a313a2ccef34230a1d945ec148cc173f26e6aa9d88a7426e54  bbsuid.c
b993ce589685d5d1f806153d0b7f71657f2d37556654ec60884130a40f09acc4944a13e0a4d02914000bedd779e5a35da08c760fed5f7ca5b601243aff7ba2c9  dad.if-up
061f7417c1cbf0424a5fab77e2f5912aa1593f39b33ea294af4c03518ca712d793a77ea82ff1f36e9cb98751d9faacb9d0240cdf0894efd8f26c13c28a692404  nologin.c
646ad9aefe3596d0170d92c8506ca1846e43b5b83cbef97ae565f15ffa7b14665a8c7061bc69c608c043f834c134c5d63f042509f8999031e89163508a868e46  ssl_client.c"