diff options
Diffstat (limited to 'main/util-linux/APKBUILD')
-rw-r--r-- | main/util-linux/APKBUILD | 353 |
1 files changed, 257 insertions, 96 deletions
diff --git a/main/util-linux/APKBUILD b/main/util-linux/APKBUILD index 118c1e9d9f1..28b133102fd 100644 --- a/main/util-linux/APKBUILD +++ b/main/util-linux/APKBUILD @@ -2,41 +2,27 @@ # Contributor: Leonardo Arena <rnalrd@alpinelinux.org> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=util-linux -pkgver=2.37.2 - -case $pkgver in - *.*.*) _v=${pkgver%.*};; - *.*) _v=$pkgver;; -esac - -pkgrel=1 +pkgver=2.40 +pkgrel=2 pkgdesc="Random collection of Linux utilities" url="https://git.kernel.org/cgit/utils/util-linux/util-linux.git" arch="all" license="GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND - LGPL-2.1-or-later AND BSD-3-Clause AND BSD-4-Clause-UC AND Public-Domain" -makedepends_build=" - asciidoctor - autoconf - automake - libtool - " + GPL-1.0-only AND LGPL-2.1-or-later AND LGPL-1.0-only AND BSD-1-Clause AND + BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain" +checkdepends="findutils xz" makedepends_host=" + bash libcap-ng-dev linux-headers ncurses-dev + sqlite-dev zlib-dev " -options="suid" -source="https://www.kernel.org/pub/linux/utils/util-linux/v$_v/util-linux-$pkgver.tar.xz - ttydefaults.h - rfkill.confd - rfkill.initd - " subpackages=" - $pkgname-bash-completion:bashcomp:noarch + $pkgname-bash-completion + $pkgname-static $pkgname-dev - $pkgname-doc $pkgname-openrc libblkid:_mv_lib @@ -45,93 +31,226 @@ subpackages=" libsmartcols:_mv_lib libuuid:_mv_lib + agetty:_mv_bin blkid:_mv_bin cfdisk:_mv_bin findmnt:_mv_bin flock:_mv_bin + fstrim:_mv_bin hexdump:_mv_bin logger:_mv_bin + losetup:_mv_bin lsblk:_mv_bin mcookie:_mv_bin + mount:_mv_bin partx:_mv_bin + setarch:_mv_bin setpriv:_mv_bin sfdisk:_mv_bin + umount:_mv_bin uuidgen:_mv_bin wipefs:_mv_bin " -if [ -z "$BOOTSTRAP" ]; then - makedepends_host="$makedepends_host linux-pam-dev python3-dev libeconf-dev" - subpackages="$subpackages py3-libmount:_py3 runuser:_mv_bin" +if [ -z "$BOOTSTRAP" ] && [ -z "$APORTS_BOOTSTRAP" ]; then + checkdepends="findutils xz procps coreutils" + makedepends_build="$makedepends_build asciidoctor" + makedepends_host="$makedepends_host + linux-pam-dev + python3-dev + libeconf-dev + utmps-dev + utmps-static + " + subpackages="$subpackages + $pkgname-login + $pkgname-login-doc:_login_doc:noarch + runuser:_mv_bin + py3-libmount:_py3 + " _bootstrap_config="--enable-runuser --with-python=3 --with-econf" else - _bootstrap_config="--without-python --without-econf" + options="!check" + _bootstrap_config="--disable-runuser --without-python --without-econf --disable-asciidoc --disable-login" fi -subpackages="$subpackages $pkgname-misc" +subpackages="$subpackages $pkgname-doc $pkgname-misc" makedepends="$makedepends_build $makedepends_host" +builddir="$srcdir/util-linux-$pkgver" +options="$options suid" + +case $pkgver in + *.*.*) _v=${pkgver%.*};; + *.*) _v=$pkgver;; +esac +source="https://www.kernel.org/pub/linux/utils/util-linux/v$_v/util-linux-$pkgver.tar.xz + utmps.patch + 0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch + ttydefaults.h + rfkill.confd + rfkill.initd + su-l.pamd + " + +# secfixes: +# 2.40-r0: +# - CVE-2024-28085 +# 2.37.4-r0: +# - CVE-2022-0563 +# 2.37.3-r0: +# - CVE-2021-3995 +# - CVE-2021-3996 +# 2.37.2-r0: +# - CVE-2021-37600 + +# login utils included in subpackage util-linux-login. +_login_cmds='newgrp last lastb login lslogins nologin su sulogin' prepare() { default_prepare cp "$srcdir"/ttydefaults.h include/ - libtoolize --force && aclocal -I m4 && autoconf \ - && automake --add-missing + + # these fail on the package builders + rm -fv tests/ts/lsfd/mkfds-netlink-protocol + rm -fv tests/ts/lsfd/option-inet + # these are flakey on the package builders + rm -fv tests/ts/lsfd/mkfds-rw-character-device + rm -fv tests/ts/lsfd/mkfds-multiplexing + + case "$CARCH" in + ppc64le) + # these fail on the CI builder + rm -fv tests/ts/lsfd/mkfds-unix-stream-requiring-sockdiag + rm -fv tests/ts/lsfd/mkfds-socketpair + ;; + esac } build() { - # login utils are provided by shadow (with PAM) or busybox (no PAM) --nenolod + if [ -z "$BOOTSTRAP" ]; then + # Linking utmps statically is strongly preferred by the utmps author + # and also much more space efficient - adds 4 kiB to each binary, that's + # 20 kiB in total for util-linux-*, versus 196 kiB (libskarnet.so). + # TODO: Find a better way (libutmps.so w/o dependency on libskarnet.so)? + # also throw in lto when not bootstrapping + export CFLAGS="$CFLAGS -ffat-lto-objects -flto=auto $(pkg-config --cflags --static utmps)" + export LDFLAGS="$LDFLAGS $(pkg-config --libs --static utmps)" + fi + + # --disable-chfn-chsh - chfn and chsh are provided by shadow package ./configure \ --build=$CBUILD \ --host=$CHOST \ --with-sysroot=$CBUILDROOT \ --prefix=/usr \ - --disable-chfn-chsh \ - --enable-raw \ + --disable-silent-rules \ + --enable-newgrp \ --disable-uuidd \ --disable-nls \ - --disable-tls \ --disable-kill \ - --disable-login \ - --disable-last \ - --disable-sulogin \ - --disable-su \ + --disable-chfn-chsh \ --with-vendordir=/usr/lib \ + --enable-fs-paths-extra=/usr/sbin \ $_bootstrap_config make } +check() { + make check +} + package() { - make -j1 DESTDIR="$pkgdir" -C "$builddir" install + make DESTDIR="$pkgdir" install + + # Move to /bin to overwrite busybox's version. + mv "$pkgdir"/usr/bin/getopt \ + "$pkgdir"/usr/bin/rev "$pkgdir"/bin + # use pkg-config install -D -m755 "$srcdir"/rfkill.initd "$pkgdir"/etc/init.d/rfkill install -D -m644 "$srcdir"/rfkill.confd "$pkgdir"/etc/conf.d/rfkill + + install -D -m644 "$srcdir"/su-l.pamd "$pkgdir"/etc/pam.d/su-l } _mv_bin() { - local _bin=$subpkgname - pkgdesc="$_bin from util-linux" + local binname=$subpkgname + pkgdesc="$binname tool from util-linux" depends= install_if="$pkgname=$pkgver-r$pkgrel" - case "$_bin" in - blkid) pkgdesc="Block device identification tool from util-linux";; - cfdisk) pkgdesc="Curses based partition table manipulator from util-linux";; - findfmt) pkgdesc="findfmt from util-linux";; - flock) pkgdesc="File locker from util-linux";; - hexdump) pkgdesc="hexdump from util-linux";; - logger) pkgdesc="Logger from util-linux";; - lsblk) pkgdesc="Block device list tool from util-linux";; - mcookie) pkgdesc="mcookie tool from util-linux";; - partx) pkgdesc="partx tool from util-linux";; - runuser) pkgdesc="Run a program with substitute user and group ID";; - setpriv) pkgdesc="Run a program with different Linux privilege settings";; - sfdisk) pkgdesc="Partition table manipulator from util-linux";; - uuidgen) pkgdesc="UUID generator from util-linux";; - wipefs) pkgdesc="wipefs from util-linux";; - *);; + + case "$binname" in + agetty) + license="Public-Domain" + pkgdesc="agetty program from util-linux" + ;; + blkid) + license="LGPL-1.0-only" + pkgdesc="Block device identification tool from util-linux" + ;; + cfdisk) + license="GPL-2.0-or-later" + pkgdesc="Curses based partition table manipulator from util-linux" + ;; + findmnt) + license="GPL-2.0-or-later" + pkgdesc="Find mount from util-linux" + ;; + flock) + license="MIT" + pkgdesc="File locker from util-linux" + ;; + fstrim) + license="GPL-2.0-or-later" + pkgdesc="File system trim from util-linux" + ;; + hexdump) + license="BSD-4-Clause-UC" + pkgdesc="Hexdump from util-linux" + ;; + logger) + license="BSD-4-Clause-UC" + pkgdesc="Logger from util-linux" + ;; + losetup) + license="GPL-2.0-or-later" + pkgdesc="Loop disk setup from util-linux" + ;; + lsblk) + license="GPL-2.0-or-later" + pkgdesc="Block device list tool from util-linux" + ;; + runuser) + license="GPL-2.0-or-later" + pkgdesc="Run a program with substitute user and group ID" + ;; + mcookie) + license="Public-Domain" + pkgdesc="Generate random numbers for xauth from util-linux" + ;; + partx) + license="GPL-2.0-or-later" + pkgdesc="Tell the kernel about disk partition changes from util-linux" + ;; + setpriv) + license="GPL-2.0-or-later" + pkgdesc="Run a program with different Linux privilege settings" + ;; + sfdisk) + license="GPL-1.0-or-later" + pkgdesc="Partition table manipulator from util-linux" + ;; + uuidgen) + license="GPL-1.0-only" + pkgdesc="UUID generator from util-linux" + ;; + wipefs) + license="GPL-2.0-or-later" + pkgdesc="Utility to wipe filesystems from device from util-linux" + ;; esac - local _path; for _path in usr/bin usr/sbin bin sbin; do - if [ -e "$pkgdir"/$_path/$_bin ]; then - mkdir -p "$subpkgdir"/$_path - mv "$pkgdir"/$_path/$_bin "$subpkgdir"/$_path/ + local dir; for dir in usr/bin usr/sbin bin sbin; do + if [ -e "$pkgdir"/$dir/$binname ]; then + amove $dir/$binname return 0 fi done @@ -139,60 +258,102 @@ _mv_bin() { } _mv_lib() { - local _lib="$subpkgname" + local libname=$subpkgname + pkgdesc="$libname library from util-linux" depends= - case "$_lib" in - libblkid) pkgdesc="Block device identification library from util-linux";; - libfdisk) pkgdesc="Partitioning library for fdisk-like programs";; - libmount) pkgdesc="Block device identification library from util-linux";; - libsmartcols) pkgdesc="Formatting library for ls-like programs.";; - libuuid) pkgdesc="DCE compatible Universally Unique Identifier library";; + + case "$libname" in + libblkid) + license="LGPL-2.1-or-later" + pkgdesc="Block device identification library from util-linux" + ;; + libfdisk) + license="LGPL-2.1-or-later" + pkgdesc="Partitioning library for fdisk-like programs" + ;; + libmount) + license="LGPL-2.1-or-later" + pkgdesc="Block device identification library from util-linux" + ;; + libsmartcols) + license="LGPL-2.1-or-later" + pkgdesc="Formatting library for ls-like programs" + ;; + libuuid) + license="BSD-3-Clause" + pkgdesc="DCE compatible Universally Unique Identifier library" + ;; esac - mkdir -p "$subpkgdir"/lib - mv "$pkgdir"/lib/$_lib.so.* "$subpkgdir"/lib/ - rmdir --ignore-fail-on-non-empty "$pkgdir"/lib + amove lib/$libname.so.* } -misc() { - pkgdesc="Misc binaries for $pkgname" - depends= - install_if="$pkgname=$pkgver-r$pkgrel" - local _path; for _path in usr/bin usr/sbin bin sbin; do - if [ -e "$pkgdir"/$_path ]; then - amove "$_path" - fi +login() { + license="GPL-2.0-or-later AND BSD-1-Clause" + pkgdesc="Login utils from util-linux package: ${_login_cmds// /, }" + depends="runuser=$pkgver-r$pkgrel" + # Commands in conflict with shadow-login: newgrp login nologin su + provides="login-utils" + provider_priority=100 # highest (other provider is shadow-login) + replaces="$pkgname-misc" # for backward compatibility (Alpine <3.16) + + cd "$pkgdir" + + local cmd dir + for cmd in $_login_cmds; do + for dir in bin sbin usr/bin usr/sbin; do + if [ -e $dir/$cmd ] || [ -L $dir/$cmd ]; then + amove $dir/$cmd + continue 2 + fi + done + error "file $cmd not found" + return 1 done - # Move rev to /bin to overwrite busybox's version. - mv "$subpkgdir"/usr/bin/rev "$subpkgdir"/bin + amove etc/pam.d/su-l } -dev() { - depends_dev="$depends_dev util-linux=$pkgver-r$pkgrel" - default_dev +_login_doc() { + pkgdesc="Login utils from util-linux package (documentation)" + depends="!shadow-login-doc" + replaces="$pkgname-doc shadow-doc" # for backward compatibility (Alpine <3.16) + install_if="docs $pkgname-login=$pkgver-r$pkgrel" + + local cmd; for cmd in $_login_cmds; do + amove usr/share/man/man*/$cmd.* + done + + find "$subpkgdir"/usr/share/man -type f ! -name "*.gz" \ + -exec gzip -9 {} \; } -bashcomp() { - pkgdesc="Bash completions for $pkgname" - depends="" - install_if="$pkgname=$pkgver-r$pkgrel bash-completion" +misc() { + pkgdesc="Misc binaries for $pkgname" + depends= + install="$pkgname-misc.post-upgrade" + install_if="$pkgname=$pkgver-r$pkgrel" - mkdir -p "$subpkgdir"/usr/share/ - mv "$pkgdir"/usr/share/bash-completion \ - "$subpkgdir"/usr/share/ + local dir; for dir in usr/bin usr/sbin bin sbin; do + if [ -e "$pkgdir"/$dir ]; then + amove $dir + fi + done } _py3() { + license="LGPL-2.1-or-later" pkgdesc="python3 bindings to libmount" depends= - mkdir -p "$subpkgdir"/usr/lib - mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ - rmdir --ignore-fail-on-non-empty "$pkgdir"/usr/lib + + amove usr/lib/python* } sha512sums=" -38f0fe820445e3bfa79550e6581c230f98c7661566ccc4daa51c7208a5f972c61b4e57dfc86bed074fdbc7c40bc79f856be8f6a05a8860c1c0cecc4208e8b81d util-linux-2.37.2.tar.xz +f06e61d4ee0e196223f7341ec75a16a6671f82d6e353823490ecff17e947bb169a6b65177e3ab0da6e733e079b24d6a77905a0e8bbfed82ca9aa22a3facb6180 util-linux-2.40.tar.xz +c1c9cd816d20582438cda75a9c0ea4e687eee124e657172729aff410f52558be19cc5d649dae07c03f7618411e5aa6c23bcebc3fdf25529517a61b6b343966ef utmps.patch +d0fbba3fb3a7ca56e6c2fbe63557bac01c25389e21c51ff5c111463a96a7b8e2eacbc5d02db811dbc3807031543ec1fc759a9669ed26e059dafdce8ae16a1558 0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch 876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h 401d2ccbdbfb0ebd573ac616c1077e2c2b79ff03e9221007759d8ac25eb522c401f705abbf7daac183d5e8017982b8ec5dd0a5ebad39507c5bb0a9f31f04ee97 rfkill.confd -c4e7ba6d257496c99934add2ca532db16fb070ea2367554587c9fb4e24ab1d80b8ba3fd0fd4fdd5ef1374c3ec6414007369b292ee334ef23171d0232ef709db2 rfkill.initd +b0e11226c611fd52d54f599a40d23c4f748d5bd6971732dba2d25581aedaf5d2c62bcb49515d175569ff9aa1cf49a3dff25d1a5d4dcd89428c7020fc7ea3a581 rfkill.initd +0c8e764308ac1d084ebb4246eb97203de983bc0170066c958a56b412d9fd2f98da7f78f059e59512542c56a2639d6b2da35eff6469a48ebce6b2c406e94a96a7 su-l.pamd " |