blob: 6d40cca9a39640a300c89736c68aef8cb603c5c0 (
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=util-linux
pkgver=2.38.1
pkgrel=1
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
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="bash findutils xz"
makedepends_build="
autoconf
automake
libtool
"
makedepends_host="
libcap-ng-dev
linux-headers
ncurses-dev
zlib-dev
"
subpackages="
$pkgname-bash-completion
$pkgname-dev
$pkgname-openrc
libblkid:_mv_lib
libfdisk:_mv_lib
libmount:_mv_lib
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
setpriv:_mv_bin
sfdisk:_mv_bin
umount:_mv_bin
uuidgen:_mv_bin
wipefs:_mv_bin
"
if [ -z "$BOOTSTRAP" ]; then
checkdepends="bash 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
options="!check"
_bootstrap_config="--without-python --without-econf --disable-asciidoc --disable-login"
fi
subpackages="$subpackages $pkgname-doc $pkgname-misc"
makedepends="$makedepends_build $makedepends_host"
options="$options suid"
# please fix me!
if [ "$CARCH" = "x86" ] || [ "$CARCH" = "ppc64le" ]; then
options="$options !check"
fi
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
ttydefaults.h
rfkill.confd
rfkill.initd
login.pamd
"
# secfixes:
# 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
# FIXME: This test fails, dunno why.
rm tests/ts/col/multibyte
# FIXME: Fails on GitLab CI, but passes locally, dunno why.
rm tests/ts/misc/setarch
# XXX: Hangs on GitLab CI.
rm tests/ts/lsns/*
# XXX: succeeds in all actions but fails anyway
rm tests/ts/lsfd/mkfds-directory
# XXX: flakes 20% of the time
rm tests/ts/hardlink/options
# XXX: fail on aarch64
rm tests/ts/lsfd/mkfds-symlink
rm tests/ts/lsfd/mkfds-rw-character-device
}
build() {
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)?
export UTMPX_CFLAGS=$(pkg-config --cflags --static utmps)
export UTMPX_LIBS=$(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-silent-rules \
--enable-newgrp \
--disable-uuidd \
--disable-nls \
--disable-tls \
--disable-kill \
--disable-chfn-chsh \
--with-vendordir=/usr/lib \
$_bootstrap_config
make
}
check() {
make check
}
package() {
make -j1 DESTDIR="$pkgdir" -C "$builddir" 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
}
_mv_bin() {
local binname=$subpkgname
pkgdesc="$binname tool from util-linux"
depends=
install_if="$pkgname=$pkgver-r$pkgrel"
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 dir; for dir in usr/bin usr/sbin bin sbin; do
if [ -e "$pkgdir"/$dir/$binname ]; then
amove $dir/$binname
return 0
fi
done
return 1
}
_mv_lib() {
local libname=$subpkgname
pkgdesc="$libname library from util-linux"
depends=
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
amove lib/$libname.so.*
}
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
# install pam configuration for 'login'
install -Dm644 "$srcdir"/login.pamd "$subpkgdir"/etc/pam.d/login
}
_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 -exec gzip -9 {} \;
}
misc() {
pkgdesc="Misc binaries for $pkgname"
depends=
install="$pkgname-misc.post-upgrade"
install_if="$pkgname=$pkgver-r$pkgrel"
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=
amove usr/lib/python*
}
sha512sums="
07f11147f67dfc6c8bc766dfc83266054e6ede776feada0566b447d13276b6882ee85c6fe53e8d94a17c03332106fc0549deca3cf5f2e92dda554e9bc0551957 util-linux-2.38.1.tar.xz
88736b554b60f836357a29f537d51658bb487dd316c92cc5160ba06bed5f8cf8e34bbfb8eb7370c4e4a2e75997a6e4bd2058201d227e41f83a18abbf4a73bdbd utmps.patch
876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h
401d2ccbdbfb0ebd573ac616c1077e2c2b79ff03e9221007759d8ac25eb522c401f705abbf7daac183d5e8017982b8ec5dd0a5ebad39507c5bb0a9f31f04ee97 rfkill.confd
c4e7ba6d257496c99934add2ca532db16fb070ea2367554587c9fb4e24ab1d80b8ba3fd0fd4fdd5ef1374c3ec6414007369b292ee334ef23171d0232ef709db2 rfkill.initd
8d1c7043719af9ee1473fdb482e054ca0e0fa1ac673cb9c7db96a6aad00382456225dea05267dab96e19d5f444a00681e8dbaf7399100c75424fd388d48ad68b login.pamd
"
|