Complete Yocto mirror with license table for TQMa6UL (2038-compliance)
- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# To allow util-linux to optionally build-depend on cryptsetup, libuuid is
|
||||
# split out of the main recipe, as it's needed by cryptsetup
|
||||
|
||||
require util-linux.inc
|
||||
|
||||
inherit autotools gettext pkgconfig
|
||||
|
||||
S = "${WORKDIR}/util-linux-${PV}"
|
||||
|
||||
EXTRA_AUTORECONF += "--exclude=gtkdocize"
|
||||
EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
|
||||
|
||||
LICENSE = "BSD-3-Clause"
|
||||
|
||||
do_install:append() {
|
||||
rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
48
sources/poky/meta/recipes-core/util-linux/util-linux.inc
Normal file
48
sources/poky/meta/recipes-core/util-linux/util-linux.inc
Normal file
@@ -0,0 +1,48 @@
|
||||
SUMMARY = "A suite of basic system administration utilities"
|
||||
HOMEPAGE = "https://en.wikipedia.org/wiki/Util-linux"
|
||||
DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
|
||||
commonly found on most Linux systems. Some of the more important utilities include \
|
||||
disk partitioning, kernel message management, filesystem creation, and system login."
|
||||
|
||||
SECTION = "base"
|
||||
|
||||
LICENSE = "GPL-1.0-or-later & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & BSD-4-Clause & MIT"
|
||||
LICENSE:${PN}-fcntl-lock = "MIT"
|
||||
LICENSE:${PN}-fdisk = "GPL-1.0-or-later"
|
||||
LICENSE:${PN}-libblkid = "LGPL-2.1-or-later"
|
||||
LICENSE:${PN}-libfdisk = "LGPL-2.1-or-later"
|
||||
LICENSE:${PN}-libmount = "LGPL-2.1-or-later"
|
||||
LICENSE:${PN}-libsmartcols = "LGPL-2.1-or-later"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://README.licensing;md5=cc80239f106687ab39ef0271ff5cf4ba \
|
||||
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
|
||||
file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
|
||||
file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
|
||||
file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
|
||||
file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
|
||||
file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
|
||||
file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
|
||||
file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
|
||||
file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
|
||||
file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
|
||||
"
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
|
||||
MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
|
||||
SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
|
||||
file://mit-license.patch \
|
||||
file://configure-sbindir.patch \
|
||||
file://runuser.pamd \
|
||||
file://runuser-l.pamd \
|
||||
file://ptest.patch \
|
||||
file://run-ptest \
|
||||
file://display_testname_for_subtest.patch \
|
||||
file://avoid_parallel_tests.patch \
|
||||
file://0001-login-utils-include-libgen.h-for-basename-API.patch \
|
||||
file://fcntl-lock.c \
|
||||
file://CVE-2024-28085-0001.patch \
|
||||
file://CVE-2024-28085-0002.patch \
|
||||
file://fstab-isolation.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f"
|
||||
@@ -0,0 +1,60 @@
|
||||
From d44e3ad1f6f8b5c1b3098bb7d537943a4c21d22f Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 3 Dec 2023 19:59:46 -0800
|
||||
Subject: [PATCH] login-utils: include libgen.h for basename API
|
||||
|
||||
musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
|
||||
|
||||
include libgen.h for using the posix declaration of the funciton.
|
||||
|
||||
Fixes
|
||||
|
||||
../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
|
||||
847 | shell_basename = basename(shell);
|
||||
| ^
|
||||
|
||||
[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2615]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
login-utils/su-common.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
|
||||
index b674920..3297c78 100644
|
||||
--- a/login-utils/su-common.c
|
||||
+++ b/login-utils/su-common.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
+#include <libgen.h>
|
||||
#include <security/pam_appl.h>
|
||||
#ifdef HAVE_SECURITY_PAM_MISC_H
|
||||
# include <security/pam_misc.h>
|
||||
@@ -840,17 +841,20 @@ static void run_shell(
|
||||
su->simulate_login ? " login" : "",
|
||||
su->fast_startup ? " fast-start" : ""));
|
||||
|
||||
+ char* tmp = xstrdup(shell);
|
||||
if (su->simulate_login) {
|
||||
char *arg0;
|
||||
char *shell_basename;
|
||||
|
||||
- shell_basename = basename(shell);
|
||||
+ shell_basename = basename(tmp);
|
||||
arg0 = xmalloc(strlen(shell_basename) + 2);
|
||||
arg0[0] = '-';
|
||||
strcpy(arg0 + 1, shell_basename);
|
||||
args[0] = arg0;
|
||||
- } else
|
||||
- args[0] = basename(shell);
|
||||
+ } else {
|
||||
+ args[0] = basename(tmp);
|
||||
+ }
|
||||
+ free(tmp);
|
||||
|
||||
if (su->fast_startup)
|
||||
args[argno++] = "-f";
|
||||
@@ -0,0 +1,36 @@
|
||||
From 07f0f0f5bd1e5e2268257ae1ff6d76a9b6c6ea8b Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 17 Jan 2024 12:37:08 +0100
|
||||
Subject: [PATCH] wall: fix calloc cal [-Werror=calloc-transposed-args]
|
||||
|
||||
term-utils/wall.c:143:37: error: xcalloc sizes specified with sizeof in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
|
||||
143 | buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups);
|
||||
| ^
|
||||
term-utils/wall.c:143:37: note: earlier argument should specify number of elements, later size of each element
|
||||
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
|
||||
CVE: CVE-2024-28085
|
||||
|
||||
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/07f0f0f5bd1e5e2268257ae1ff6d76a9b6c6ea8b]
|
||||
|
||||
Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
|
||||
---
|
||||
term-utils/wall.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/term-utils/wall.c b/term-utils/wall.c
|
||||
index 377db45..85c006a 100644
|
||||
--- a/term-utils/wall.c
|
||||
+++ b/term-utils/wall.c
|
||||
@@ -135,7 +135,7 @@ static struct group_workspace *init_group_workspace(const char *group)
|
||||
|
||||
buf->requested_group = get_group_gid(group);
|
||||
buf->ngroups = sysconf(_SC_NGROUPS_MAX) + 1; /* room for the primary gid */
|
||||
- buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups);
|
||||
+ buf->groups = xcalloc(buf->ngroups, sizeof(*buf->groups));
|
||||
|
||||
return buf;
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
@@ -0,0 +1,34 @@
|
||||
From 404b0781f52f7c045ca811b2dceec526408ac253 Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Thu, 21 Mar 2024 11:16:20 +0100
|
||||
Subject: [PATCH] wall: fix escape sequence Injection [CVE-2024-28085]
|
||||
|
||||
Let's use for all cases the same output function.
|
||||
|
||||
Reported-by: Skyler Ferrante <sjf5462@rit.edu>
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
|
||||
CVE: CVE-2024-28085
|
||||
|
||||
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/404b0781f52f7c045ca811b2dceec526408ac253]
|
||||
|
||||
Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
|
||||
---
|
||||
term-utils/wall.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/term-utils/wall.c b/term-utils/wall.c
|
||||
index 85c006a..0212c03 100644
|
||||
--- a/term-utils/wall.c
|
||||
+++ b/term-utils/wall.c
|
||||
@@ -328,7 +328,7 @@ static char *makemsg(char *fname, char **mvec, int mvecsz,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < mvecsz; i++) {
|
||||
- fputs(mvec[i], fs);
|
||||
+ fputs_careful(mvec[i], fs, '^', true, TERM_WIDTH);
|
||||
if (i < mvecsz - 1)
|
||||
fputc(' ', fs);
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0b05e4695a0616badef71dfa459a00ef6ff1b521 Mon Sep 17 00:00:00 2001
|
||||
From: Tudor Florea <tudor.florea@enea.com>
|
||||
Date: Mon, 14 Jun 2021 14:00:31 +0200
|
||||
Subject: [PATCH] util-linux: Add ptest
|
||||
|
||||
Ptest needs buildtest-TESTS and runtest-TESTS targets.
|
||||
serial-tests is required to generate those targets.
|
||||
Revert run.sh script accordingly to serialize running tests
|
||||
|
||||
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
|
||||
Upstream-Status: Inappropriate
|
||||
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 890212f..870e817 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
|
||||
dnl the compiler (like LT_INIT) to avoid autoconf errors.
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
|
||||
+AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
|
||||
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
|
||||
@@ -0,0 +1,32 @@
|
||||
From c79222a9a5e3425c55e150edc0b7ac59c573aa2f Mon Sep 17 00:00:00 2001
|
||||
From: Phil Blundell <pb@pbcl.net>
|
||||
Date: Mon, 24 Sep 2012 07:24:51 +0100
|
||||
Subject: [PATCH] util-linux: Ensure that ${sbindir} is respected
|
||||
|
||||
util-linux: take ${sbindir} from the environment if it is set there
|
||||
fix the test, the [ ] syntax was getting eaten by autoconf
|
||||
|
||||
Signed-off-by: Phil Blundell <pb@pbcl.net>
|
||||
Signed-off-by: Saul Wold <sgw@linux.intel.com
|
||||
Upstream-Status: Inappropriate [configuration]
|
||||
|
||||
---
|
||||
configure.ac | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 36c24b4..890212f 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -102,7 +102,10 @@ AC_SUBST([runstatedir])
|
||||
usrbin_execdir='${exec_prefix}/bin'
|
||||
AC_SUBST([usrbin_execdir])
|
||||
|
||||
-usrsbin_execdir='${exec_prefix}/sbin'
|
||||
+if test -z "$usrsbin_execdir" ;
|
||||
+then
|
||||
+ usrsbin_execdir='${exec_prefix}/sbin'
|
||||
+fi
|
||||
AC_SUBST([usrsbin_execdir])
|
||||
|
||||
AS_CASE([$libdir],
|
||||
@@ -0,0 +1,25 @@
|
||||
From fc5de1de898fd1a372a2fd2fa493dc57323a029d Mon Sep 17 00:00:00 2001
|
||||
From: Tudor Florea <tudor.florea@enea.com>
|
||||
Date: Thu, 3 Dec 2015 04:08:00 +0100
|
||||
Subject: [PATCH] Display testname for subtest
|
||||
|
||||
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
|
||||
Upstream-Status: Pending
|
||||
|
||||
---
|
||||
tests/functions.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/functions.sh b/tests/functions.sh
|
||||
index 5a562a3..098145e 100644
|
||||
--- a/tests/functions.sh
|
||||
+++ b/tests/functions.sh
|
||||
@@ -437,7 +437,7 @@ function ts_init_subtest {
|
||||
|
||||
if [ "$TS_PARSABLE" != "yes" ]; then
|
||||
[ $TS_NSUBTESTS -eq 1 ] && echo
|
||||
- printf "%16s: %-27s ..." "" "$TS_SUBNAME"
|
||||
+ printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
// From https://github.com/magnumripper/fcntl-lock
|
||||
// SPDX-License-Identifier: MIT
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
|
||||
* Copyright 2015 magnum (fcntl version)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall
|
||||
* be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include <sysexits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define PACKAGE_STRING "magnum"
|
||||
#define _(x) (x)
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{ "shared", 0, NULL, 's' },
|
||||
{ "exclusive", 0, NULL, 'x' },
|
||||
{ "unlock", 0, NULL, 'u' },
|
||||
{ "nonblocking", 0, NULL, 'n' },
|
||||
{ "nb", 0, NULL, 'n' },
|
||||
{ "timeout", 1, NULL, 'w' },
|
||||
{ "wait", 1, NULL, 'w' },
|
||||
{ "close", 0, NULL, 'o' },
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
const char *program;
|
||||
|
||||
static void usage(int ex)
|
||||
{
|
||||
fputs("fcntl-lock (" PACKAGE_STRING ")\n", stderr);
|
||||
fprintf(stderr,
|
||||
_("Usage: %1$s [-sxun][-w #] fd#\n"
|
||||
" %1$s [-sxon][-w #] file [-c] command...\n"
|
||||
" %1$s [-sxon][-w #] directory [-c] command...\n"
|
||||
" -s --shared Get a shared lock\n"
|
||||
" -x --exclusive Get an exclusive lock\n"
|
||||
" -u --unlock Remove a lock\n"
|
||||
" -n --nonblock Fail rather than wait\n"
|
||||
" -w --timeout Wait for a limited amount of time\n"
|
||||
" -o --close Close file descriptor before running command\n"
|
||||
" -c --command Run a single command string through the shell\n"
|
||||
" -h --help Display this text\n"
|
||||
" -V --version Display version\n"),
|
||||
program);
|
||||
exit(ex);
|
||||
}
|
||||
|
||||
|
||||
static sig_atomic_t timeout_expired = 0;
|
||||
|
||||
static void timeout_handler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
|
||||
timeout_expired = 1;
|
||||
}
|
||||
|
||||
|
||||
static char * strtotimeval(const char *str, struct timeval *tv)
|
||||
{
|
||||
char *s;
|
||||
long fs; /* Fractional seconds */
|
||||
int i;
|
||||
|
||||
tv->tv_sec = strtol(str, &s, 10);
|
||||
fs = 0;
|
||||
|
||||
if ( *s == '.' ) {
|
||||
s++;
|
||||
|
||||
for ( i = 0 ; i < 6 ; i++ ) {
|
||||
if ( !isdigit(*s) )
|
||||
break;
|
||||
|
||||
fs *= 10;
|
||||
fs += *s++ - '0';
|
||||
}
|
||||
|
||||
for ( ; i < 6; i++ )
|
||||
fs *= 10;
|
||||
|
||||
while ( isdigit(*s) )
|
||||
s++;
|
||||
}
|
||||
|
||||
tv->tv_usec = fs;
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct itimerval timeout, old_timer;
|
||||
int have_timeout = 0;
|
||||
int type = F_WRLCK;
|
||||
int block = F_SETLKW;
|
||||
int fd = -1;
|
||||
int opt, ix;
|
||||
int do_close = 0;
|
||||
int err;
|
||||
int status;
|
||||
char *eon;
|
||||
char **cmd_argv = NULL, *sh_c_argv[4];
|
||||
struct flock lock;
|
||||
const char *filename = NULL;
|
||||
struct sigaction sa, old_sa;
|
||||
|
||||
program = argv[0];
|
||||
|
||||
if ( argc < 2 )
|
||||
usage(EX_USAGE);
|
||||
|
||||
memset(&timeout, 0, sizeof timeout);
|
||||
|
||||
optopt = 0;
|
||||
while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) {
|
||||
switch(opt) {
|
||||
case 's':
|
||||
type = F_RDLCK;
|
||||
break;
|
||||
case 'e':
|
||||
case 'x':
|
||||
type = F_WRLCK;
|
||||
break;
|
||||
case 'u':
|
||||
type = F_UNLCK;
|
||||
break;
|
||||
case 'o':
|
||||
do_close = 1;
|
||||
break;
|
||||
case 'n':
|
||||
block = F_SETLK;
|
||||
break;
|
||||
case 'w':
|
||||
have_timeout = 1;
|
||||
eon = strtotimeval(optarg, &timeout.it_value);
|
||||
if ( *eon )
|
||||
usage(EX_USAGE);
|
||||
break;
|
||||
case 'V':
|
||||
printf("fcntl-lock (%s)\n", PACKAGE_STRING);
|
||||
exit(0);
|
||||
default:
|
||||
/* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */
|
||||
usage(optopt ? EX_USAGE : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( argc > optind+1 ) {
|
||||
/* Run command */
|
||||
|
||||
if ( !strcmp(argv[optind+1], "-c") ||
|
||||
!strcmp(argv[optind+1], "--command") ) {
|
||||
|
||||
if ( argc != optind+3 ) {
|
||||
fprintf(stderr, _("%s: %s requires exactly one command argument\n"),
|
||||
program, argv[optind+1]);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
cmd_argv = sh_c_argv;
|
||||
|
||||
cmd_argv[0] = getenv("SHELL");
|
||||
if ( !cmd_argv[0] || !*cmd_argv[0] )
|
||||
cmd_argv[0] = _PATH_BSHELL;
|
||||
|
||||
cmd_argv[1] = "-c";
|
||||
cmd_argv[2] = argv[optind+2];
|
||||
cmd_argv[3] = 0;
|
||||
} else {
|
||||
cmd_argv = &argv[optind+1];
|
||||
}
|
||||
|
||||
filename = argv[optind];
|
||||
fd = open(filename, O_RDWR|O_NOCTTY|O_CREAT, 0666);
|
||||
/* Linux doesn't like O_CREAT on a directory, even though it should be a
|
||||
no-op */
|
||||
if (fd < 0 && errno == EISDIR)
|
||||
fd = open(filename, O_RDONLY|O_NOCTTY);
|
||||
|
||||
if ( fd < 0 ) {
|
||||
err = errno;
|
||||
fprintf(stderr, _("%s: cannot open lock file %s: %s\n"),
|
||||
program, argv[optind], strerror(err));
|
||||
exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR :
|
||||
(err == EROFS||err == ENOSPC) ? EX_CANTCREAT :
|
||||
EX_NOINPUT);
|
||||
}
|
||||
|
||||
} else if (optind < argc) {
|
||||
/* Use provided file descriptor */
|
||||
|
||||
fd = (int)strtol(argv[optind], &eon, 10);
|
||||
if ( *eon || !argv[optind] ) {
|
||||
fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Bad options */
|
||||
|
||||
fprintf(stderr, _("%s: requires file descriptor, file or directory\n"),
|
||||
program);
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
|
||||
if ( have_timeout ) {
|
||||
if ( timeout.it_value.tv_sec == 0 &&
|
||||
timeout.it_value.tv_usec == 0 ) {
|
||||
/* -w 0 is equivalent to -n; this has to be special-cased
|
||||
because setting an itimer to zero means disabled! */
|
||||
|
||||
have_timeout = 0;
|
||||
block = F_SETLK;
|
||||
} else {
|
||||
memset(&sa, 0, sizeof sa);
|
||||
|
||||
sa.sa_handler = timeout_handler;
|
||||
sa.sa_flags = SA_RESETHAND;
|
||||
sigaction(SIGALRM, &sa, &old_sa);
|
||||
|
||||
setitimer(ITIMER_REAL, &timeout, &old_timer);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&lock, 0, sizeof(lock));
|
||||
lock.l_type = type;
|
||||
while ( fcntl(fd, block, &lock) ) {
|
||||
switch( (err = errno) ) {
|
||||
case EAGAIN: /* -n option set and failed to lock */
|
||||
case EACCES: /* -n option set and failed to lock */
|
||||
exit(1);
|
||||
case EINTR: /* Signal received */
|
||||
if ( timeout_expired )
|
||||
exit(1); /* -w option set and failed to lock */
|
||||
continue; /* otherwise try again */
|
||||
default: /* Other errors */
|
||||
if ( filename )
|
||||
fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err));
|
||||
else
|
||||
fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err));
|
||||
exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR);
|
||||
}
|
||||
}
|
||||
|
||||
if ( have_timeout ) {
|
||||
setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */
|
||||
sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */
|
||||
}
|
||||
|
||||
status = 0;
|
||||
|
||||
if ( cmd_argv ) {
|
||||
pid_t w, f;
|
||||
|
||||
/* Clear any inherited settings */
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
f = fork();
|
||||
|
||||
if ( f < 0 ) {
|
||||
err = errno;
|
||||
fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err));
|
||||
exit(EX_OSERR);
|
||||
} else if ( f == 0 ) {
|
||||
if ( do_close )
|
||||
close(fd);
|
||||
err = errno;
|
||||
execvp(cmd_argv[0], cmd_argv);
|
||||
/* execvp() failed */
|
||||
fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
|
||||
_exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
|
||||
} else {
|
||||
do {
|
||||
w = waitpid(f, &status, 0);
|
||||
if (w == -1 && errno != EINTR)
|
||||
break;
|
||||
} while ( w != f );
|
||||
|
||||
if (w == -1) {
|
||||
err = errno;
|
||||
status = EXIT_FAILURE;
|
||||
fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
|
||||
} else if ( WIFEXITED(status) )
|
||||
status = WEXITSTATUS(status);
|
||||
else if ( WIFSIGNALED(status) )
|
||||
status = WTERMSIG(status) + 128;
|
||||
else
|
||||
status = EX_OSERR; /* WTF? */
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
From 51f1e56cc8b6843bf65ceadc5eca1545258bf020 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
|
||||
Date: Sat, 22 Apr 2023 17:48:58 +0200
|
||||
Subject: [PATCH 1/3] tests: (functions.sh) create variable for test fstab
|
||||
location
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
||||
(cherry picked from commit ed3d33faff17fb702a3acfca2f9f24e69f4920de)
|
||||
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/ed3d33faff17fb702a3acfca2f9f24e69f4920de]
|
||||
Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
|
||||
---
|
||||
tests/functions.sh | 13 +++++++------
|
||||
tests/ts/mount/fstab-broken | 2 +-
|
||||
2 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tests/functions.sh b/tests/functions.sh
|
||||
index 5a562a39a..c2e2f33ae 100644
|
||||
--- a/tests/functions.sh
|
||||
+++ b/tests/functions.sh
|
||||
@@ -386,6 +386,7 @@ function ts_init_env {
|
||||
TS_ENABLE_UBSAN="yes"
|
||||
fi
|
||||
|
||||
+ TS_FSTAB="/etc/fstab"
|
||||
BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
|
||||
|
||||
declare -a TS_SUID_PROGS
|
||||
@@ -824,12 +825,12 @@ function ts_is_mounted {
|
||||
}
|
||||
|
||||
function ts_fstab_open {
|
||||
- echo "# <!-- util-linux test entry" >> /etc/fstab
|
||||
+ echo "# <!-- util-linux test entry" >> "$TS_FSTAB"
|
||||
}
|
||||
|
||||
function ts_fstab_close {
|
||||
- echo "# -->" >> /etc/fstab
|
||||
- sync /etc/fstab 2>/dev/null
|
||||
+ echo "# -->" >> "$TS_FSTAB"
|
||||
+ sync "$TS_FSTAB" 2>/dev/null
|
||||
}
|
||||
|
||||
function ts_fstab_addline {
|
||||
@@ -838,7 +839,7 @@ function ts_fstab_addline {
|
||||
local FS=${3:-"auto"}
|
||||
local OPT=${4:-"defaults"}
|
||||
|
||||
- echo "$SPEC $MNT $FS $OPT 0 0" >> /etc/fstab
|
||||
+ echo "$SPEC $MNT $FS $OPT 0 0" >> "$TS_FSTAB"
|
||||
}
|
||||
|
||||
function ts_fstab_lock {
|
||||
@@ -862,9 +863,9 @@ function ts_fstab_clean {
|
||||
ba
|
||||
}
|
||||
s/# <!-- util-linux.*-->//;
|
||||
-/^$/d" /etc/fstab
|
||||
+/^$/d" "$TS_FSTAB"
|
||||
|
||||
- sync /etc/fstab 2>/dev/null
|
||||
+ sync "$TS_FSTAB" 2>/dev/null
|
||||
ts_unlock "fstab"
|
||||
}
|
||||
|
||||
diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken
|
||||
index 19edc5fe3..3b7a1ee9d 100755
|
||||
--- a/tests/ts/mount/fstab-broken
|
||||
+++ b/tests/ts/mount/fstab-broken
|
||||
@@ -34,7 +34,7 @@ mkdir -p $MNT
|
||||
|
||||
ts_fstab_lock
|
||||
ts_fstab_open
|
||||
-echo "tmpd $MNT tmpfs" >> /etc/fstab
|
||||
+echo "tmpd $MNT tmpfs" >> "$TS_FSTAB"
|
||||
ts_fstab_close
|
||||
|
||||
ts_init_subtest "mount"
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
From 1e4a9141ca7d310030311e09123a81591f994f83 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
|
||||
Date: Sat, 22 Apr 2023 17:20:45 +0200
|
||||
Subject: [PATCH 2/3] tests: (functions.sh) use per-test fstab file
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
||||
(cherry picked from commit 6aa8d17b6b53b86a46c5da68c02a893113130496)
|
||||
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/6aa8d17b6b53b86a46c5da68c02a893113130496]
|
||||
Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
|
||||
---
|
||||
tests/functions.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/functions.sh b/tests/functions.sh
|
||||
index c2e2f33ae..3089e8cda 100644
|
||||
--- a/tests/functions.sh
|
||||
+++ b/tests/functions.sh
|
||||
@@ -386,7 +386,7 @@ function ts_init_env {
|
||||
TS_ENABLE_UBSAN="yes"
|
||||
fi
|
||||
|
||||
- TS_FSTAB="/etc/fstab"
|
||||
+ TS_FSTAB="$TS_OUTDIR/${TS_TESTNAME}.fstab"
|
||||
BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
|
||||
|
||||
declare -a TS_SUID_PROGS
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
||||
From 02c483f982e23a86d58cd7c6a4eb4b6e4d5def1a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
|
||||
Date: Sat, 22 Apr 2023 17:34:28 +0200
|
||||
Subject: [PATCH 3/3] mount: (tests) explicitly use test fstab location
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
||||
(cherry picked from commit b1580bd760519a2cf052f023057846e54de47484)
|
||||
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/b1580bd760519a2cf052f023057846e54de47484]
|
||||
Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
|
||||
---
|
||||
tests/ts/mount/fslists | 2 +-
|
||||
tests/ts/mount/fstab-bind | 2 +-
|
||||
tests/ts/mount/fstab-broken | 4 ++--
|
||||
tests/ts/mount/fstab-btrfs | 8 ++++----
|
||||
tests/ts/mount/fstab-devname | 4 ++--
|
||||
tests/ts/mount/fstab-devname2label | 2 +-
|
||||
tests/ts/mount/fstab-devname2uuid | 2 +-
|
||||
tests/ts/mount/fstab-label | 6 +++---
|
||||
tests/ts/mount/fstab-label2devname | 4 ++--
|
||||
tests/ts/mount/fstab-label2uuid | 4 ++--
|
||||
tests/ts/mount/fstab-loop | 4 ++--
|
||||
tests/ts/mount/fstab-none | 2 +-
|
||||
tests/ts/mount/fstab-symlink | 2 +-
|
||||
tests/ts/mount/fstab-uuid | 6 +++---
|
||||
tests/ts/mount/fstab-uuid2devname | 4 ++--
|
||||
tests/ts/mount/fstab-uuid2label | 4 ++--
|
||||
16 files changed, 30 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/tests/ts/mount/fslists b/tests/ts/mount/fslists
|
||||
index 230186a1e..6ac72c3ce 100755
|
||||
--- a/tests/ts/mount/fslists
|
||||
+++ b/tests/ts/mount/fslists
|
||||
@@ -61,7 +61,7 @@ ts_finalize_subtest
|
||||
ts_init_subtest "more-types-fstab"
|
||||
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
||||
ts_fstab_add $DEVICE $TS_MOUNTPOINT "foo,bar,ext2"
|
||||
-$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_fstab_clean
|
||||
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $TS_MOUNTPOINT
|
||||
diff --git a/tests/ts/mount/fstab-bind b/tests/ts/mount/fstab-bind
|
||||
index 2c799df78..cae016dd2 100755
|
||||
--- a/tests/ts/mount/fstab-bind
|
||||
+++ b/tests/ts/mount/fstab-bind
|
||||
@@ -20,7 +20,7 @@ ts_fstab_add $MY_SOURCE "$TS_MOUNTPOINT" "none" "bind,default,noauto"
|
||||
mkdir -p $MY_SOURCE
|
||||
mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
-$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
[ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT"
|
||||
|
||||
$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null
|
||||
diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken
|
||||
index 3b7a1ee9d..ec4c34241 100755
|
||||
--- a/tests/ts/mount/fstab-broken
|
||||
+++ b/tests/ts/mount/fstab-broken
|
||||
@@ -38,7 +38,7 @@ echo "tmpd $MNT tmpfs" >> "$TS_FSTAB"
|
||||
ts_fstab_close
|
||||
|
||||
ts_init_subtest "mount"
|
||||
-$TS_CMD_MOUNT $MNT &> /dev/null
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $MNT &> /dev/null
|
||||
[ "$?" = "0" ] || ts_log "error: mount $MNT"
|
||||
$TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
@@ -57,7 +57,7 @@ ts_finalize_subtest
|
||||
|
||||
|
||||
ts_init_subtest "mount-all"
|
||||
-$TS_CMD_MOUNT -a &> /dev/null
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a &> /dev/null
|
||||
[ "$?" = "0" ] || ts_log "error: mount -a"
|
||||
$TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
diff --git a/tests/ts/mount/fstab-btrfs b/tests/ts/mount/fstab-btrfs
|
||||
index a1003ab52..8e76dbba6 100755
|
||||
--- a/tests/ts/mount/fstab-btrfs
|
||||
+++ b/tests/ts/mount/fstab-btrfs
|
||||
@@ -94,8 +94,8 @@ ts_fstab_addline "$DEVICE" "$TS_MOUNTPOINT_SUBVOLID" "btrfs" "subvolid=$NON_DEFA
|
||||
ts_fstab_addline "$TS_MOUNTPOINT_SUBVOLID" "$TS_MOUNTPOINT_BIND" "auto" "bind"
|
||||
ts_fstab_close
|
||||
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
|
||||
$TS_CMD_UMOUNT "$TS_MOUNTPOINT_BIND" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
$TS_CMD_UMOUNT "$TS_MOUNTPOINT_DEFAULT" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
@@ -124,8 +124,8 @@ ts_fstab_addline "$DEVICE" "$TS_MOUNTPOINT_SUBVOLID" "auto" "subvolid=$NON_DEFAU
|
||||
ts_fstab_addline "$TS_MOUNTPOINT_SUBVOL/bind-mnt" "$TS_MOUNTPOINT_BIND" "auto" "bind"
|
||||
ts_fstab_close
|
||||
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
|
||||
$TS_CMD_UMOUNT "$TS_MOUNTPOINT_BIND" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
$TS_CMD_UMOUNT "$TS_MOUNTPOINT_DEFAULT" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
diff --git a/tests/ts/mount/fstab-devname b/tests/ts/mount/fstab-devname
|
||||
index 5b64a32a6..6ac03b5a7 100755
|
||||
--- a/tests/ts/mount/fstab-devname
|
||||
+++ b/tests/ts/mount/fstab-devname
|
||||
@@ -42,13 +42,13 @@ MOUNTPOINT=$TS_MOUNTPOINT
|
||||
ts_fstab_add $DEVICE
|
||||
|
||||
ts_init_subtest "mountpoint"
|
||||
-$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE || >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "device-name"
|
||||
-$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-devname2label b/tests/ts/mount/fstab-devname2label
|
||||
index 1d8562109..44066e153 100755
|
||||
--- a/tests/ts/mount/fstab-devname2label
|
||||
+++ b/tests/ts/mount/fstab-devname2label
|
||||
@@ -41,7 +41,7 @@ ts_device_has "LABEL" $LABEL $DEVICE \
|
||||
ts_fstab_add "LABEL=$LABEL"
|
||||
ts_udevadm_settle "$DEVICE" "LABEL"
|
||||
|
||||
-$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
|
||||
|
||||
diff --git a/tests/ts/mount/fstab-devname2uuid b/tests/ts/mount/fstab-devname2uuid
|
||||
index 8105fa028..503959103 100755
|
||||
--- a/tests/ts/mount/fstab-devname2uuid
|
||||
+++ b/tests/ts/mount/fstab-devname2uuid
|
||||
@@ -39,7 +39,7 @@ UUID=$(ts_uuid_by_devname "$DEVICE") || ts_die "Cannot find UUID on $DEVICE"
|
||||
ts_fstab_add "UUID=$UUID"
|
||||
ts_udevadm_settle "$DEVICE" "UUID"
|
||||
|
||||
-$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
|
||||
|
||||
diff --git a/tests/ts/mount/fstab-label b/tests/ts/mount/fstab-label
|
||||
index 4b23e7fee..a3cc06d52 100755
|
||||
--- a/tests/ts/mount/fstab-label
|
||||
+++ b/tests/ts/mount/fstab-label
|
||||
@@ -42,19 +42,19 @@ ts_fstab_add "LABEL=$LABEL"
|
||||
ts_udevadm_settle "$DEVICE" "LABEL"
|
||||
|
||||
ts_init_subtest "no-option"
|
||||
-$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "L-option"
|
||||
-$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "LABEL-option"
|
||||
-$TS_CMD_MOUNT LABEL=$LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" LABEL=$LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-label2devname b/tests/ts/mount/fstab-label2devname
|
||||
index 75ca05e8c..fddbfa0ba 100755
|
||||
--- a/tests/ts/mount/fstab-label2devname
|
||||
+++ b/tests/ts/mount/fstab-label2devname
|
||||
@@ -44,13 +44,13 @@ ts_udevadm_settle "$DEVICE" "LABEL"
|
||||
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
ts_init_subtest "L-option"
|
||||
-$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "LABEL-option"
|
||||
-$TS_CMD_MOUNT "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-label2uuid b/tests/ts/mount/fstab-label2uuid
|
||||
index 4bfcae4b9..927cde9aa 100755
|
||||
--- a/tests/ts/mount/fstab-label2uuid
|
||||
+++ b/tests/ts/mount/fstab-label2uuid
|
||||
@@ -46,13 +46,13 @@ ts_udevadm_settle "$DEVICE" "LABEL" "UUID"
|
||||
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
ts_init_subtest "L-option"
|
||||
-$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "LABEL-option"
|
||||
-$TS_CMD_MOUNT "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-loop b/tests/ts/mount/fstab-loop
|
||||
index 7cc589fd2..0541e3a74 100755
|
||||
--- a/tests/ts/mount/fstab-loop
|
||||
+++ b/tests/ts/mount/fstab-loop
|
||||
@@ -39,10 +39,10 @@ ts_fstab_lock
|
||||
ts_fstab_open
|
||||
|
||||
ts_fstab_addline "$IMG" "$TS_MOUNTPOINT-1" "ext2" "loop"
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
|
||||
ts_fstab_addline "$IMG" "$TS_MOUNTPOINT-2" "ext2" "loop"
|
||||
-$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
|
||||
ts_fstab_close
|
||||
|
||||
diff --git a/tests/ts/mount/fstab-none b/tests/ts/mount/fstab-none
|
||||
index 6a4d05b62..95daa6cee 100755
|
||||
--- a/tests/ts/mount/fstab-none
|
||||
+++ b/tests/ts/mount/fstab-none
|
||||
@@ -17,7 +17,7 @@ ts_fstab_add "none" "$TS_MOUNTPOINT" "tmpfs" "rw,nosuid,nodev,relatime"
|
||||
|
||||
mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
-$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
[ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT"
|
||||
|
||||
$TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null
|
||||
diff --git a/tests/ts/mount/fstab-symlink b/tests/ts/mount/fstab-symlink
|
||||
index 4d3e37b19..6d419f9fe 100755
|
||||
--- a/tests/ts/mount/fstab-symlink
|
||||
+++ b/tests/ts/mount/fstab-symlink
|
||||
@@ -46,7 +46,7 @@ ln -s $DEVICE $LINKNAME
|
||||
ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user"
|
||||
|
||||
# variant A) -- UID=0
|
||||
-$TS_CMD_MOUNT $LINKNAME >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $LINKNAME >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME"
|
||||
|
||||
diff --git a/tests/ts/mount/fstab-uuid b/tests/ts/mount/fstab-uuid
|
||||
index 03917b782..f51bb294e 100755
|
||||
--- a/tests/ts/mount/fstab-uuid
|
||||
+++ b/tests/ts/mount/fstab-uuid
|
||||
@@ -42,19 +42,19 @@ ts_fstab_add "UUID=$UUID"
|
||||
ts_udevadm_settle "$DEVICE" "UUID"
|
||||
|
||||
ts_init_subtest "no-option"
|
||||
-$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "U-option"
|
||||
-$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "UUID-option"
|
||||
-$TS_CMD_MOUNT UUID=$UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" UUID=$UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-uuid2devname b/tests/ts/mount/fstab-uuid2devname
|
||||
index 9bf165e16..2b338acb1 100755
|
||||
--- a/tests/ts/mount/fstab-uuid2devname
|
||||
+++ b/tests/ts/mount/fstab-uuid2devname
|
||||
@@ -42,13 +42,13 @@ ts_udevadm_settle "$DEVICE" "UUID"
|
||||
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
ts_init_subtest "U-option"
|
||||
-$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "UUID-option"
|
||||
-$TS_CMD_MOUNT "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
diff --git a/tests/ts/mount/fstab-uuid2label b/tests/ts/mount/fstab-uuid2label
|
||||
index de10ff0b0..02eb6b985 100755
|
||||
--- a/tests/ts/mount/fstab-uuid2label
|
||||
+++ b/tests/ts/mount/fstab-uuid2label
|
||||
@@ -45,13 +45,13 @@ ts_udevadm_settle "$DEVICE" "LABEL" "UUID"
|
||||
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
||||
|
||||
ts_init_subtest "U-option"
|
||||
-$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
|
||||
ts_init_subtest "UUID-option"
|
||||
-$TS_CMD_MOUNT "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
+$TS_CMD_MOUNT -T "$TS_FSTAB" "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG
|
||||
ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts"
|
||||
$TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>>$TS_ERRLOG
|
||||
ts_finalize_subtest
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From 5b8fab1584017d9d9be008c23b90128bba41a7b5 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
Date: Thu, 28 Mar 2024 12:16:57 +0000
|
||||
Subject: [PATCH] README.licensing/flock: Add MIT license mention
|
||||
|
||||
Looking at the license text, flock.c is under the MIT license (see
|
||||
https://spdx.org/licenses/MIT).
|
||||
|
||||
Add an SPDX license identifier header and add to the list of licenses the
|
||||
source so everything is correctly listed/identified.
|
||||
|
||||
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2870]
|
||||
|
||||
---
|
||||
README.licensing | 2 ++
|
||||
sys-utils/flock.c | 4 +++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/README.licensing b/README.licensing
|
||||
index 4454f8392a..535ad34813 100644
|
||||
--- a/README.licensing
|
||||
+++ b/README.licensing
|
||||
@@ -12,6 +12,8 @@ There is code under:
|
||||
|
||||
* LGPL-2.1-or-later - GNU Lesser General Public License 2.1 or any later version
|
||||
|
||||
+ * MIT - MIT License
|
||||
+
|
||||
* BSD-2-Clause - Simplified BSD License
|
||||
|
||||
* BSD-3-Clause - BSD 3-Clause "New" or "Revised" License
|
||||
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
|
||||
index fed29d7270..7d878ff810 100644
|
||||
--- a/sys-utils/flock.c
|
||||
+++ b/sys-utils/flock.c
|
||||
@@ -1,4 +1,6 @@
|
||||
-/* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
|
||||
+/* SPDX-License-Identifier: MIT
|
||||
+ *
|
||||
+ * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -0,0 +1,24 @@
|
||||
From d0a69ce80c579cbb7627a2f20e8b92e006a8d8ad Mon Sep 17 00:00:00 2001
|
||||
From: Tudor Florea <tudor.florea@enea.com>
|
||||
Date: Thu, 3 Dec 2015 04:08:00 +0100
|
||||
Subject: [PATCH] Define TESTS variable
|
||||
|
||||
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
|
||||
Upstream-Status: Pending
|
||||
|
||||
---
|
||||
Makefile.am | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index effbb02..7d2bd1e 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -57,6 +57,7 @@ systemdsystemunit_DATA =
|
||||
dist_bashcompletion_DATA =
|
||||
check_PROGRAMS =
|
||||
dist_check_SCRIPTS =
|
||||
+TESTS = $(check_PROGRAMS)
|
||||
|
||||
PATHFILES =
|
||||
ADOCFILES_COMMON =
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# When udevd (from eudev) is running most eject/mount tests will fail because
|
||||
# of automount. We need to stop udevd before executing util-linux's tests.
|
||||
# The systemd-udevd daemon doesn't change the outcome of util-linux's tests.
|
||||
UDEV_PID="`pidof "@base_sbindir@/udevd"`"
|
||||
if [ "x$UDEV_PID" != "x" ]; then
|
||||
/etc/init.d/udev stop
|
||||
fi
|
||||
|
||||
current_path=$(readlink -f $0)
|
||||
export bindir=$(dirname $current_path)
|
||||
export PATH=$bindir/bin:$PATH
|
||||
|
||||
# losetup tests will be skipped and/or fail otherwise
|
||||
modprobe loop
|
||||
|
||||
# required for mount/fallback test to pass
|
||||
# systemd does this by default, but ptest images do not use it
|
||||
# see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html
|
||||
# for a long description of mount namespaces in Linux
|
||||
mount --make-shared /
|
||||
|
||||
# lsfd/option-inet has races in the test script:
|
||||
# https://github.com/util-linux/util-linux/issues/2399
|
||||
./tests/run.sh --use-system-commands --parsable --show-diff --exclude=lsfd/option-inet | sed -u '{
|
||||
s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
|
||||
s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
|
||||
s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
|
||||
}'
|
||||
|
||||
if [ "x$UDEV_PID" != "x" ]; then
|
||||
/etc/init.d/udev start
|
||||
fi
|
||||
@@ -0,0 +1,3 @@
|
||||
auth include runuser
|
||||
session optional pam_keyinit.so force revoke
|
||||
session include runuser
|
||||
@@ -0,0 +1,4 @@
|
||||
auth sufficient pam_rootok.so
|
||||
session optional pam_keyinit.so revoke
|
||||
session required pam_limits.so
|
||||
session required pam_unix.so
|
||||
355
sources/poky/meta/recipes-core/util-linux/util-linux_2.39.3.bb
Normal file
355
sources/poky/meta/recipes-core/util-linux/util-linux_2.39.3.bb
Normal file
@@ -0,0 +1,355 @@
|
||||
require util-linux.inc
|
||||
|
||||
inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc
|
||||
DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
|
||||
|
||||
PACKAGES =+ "${PN}-swaponoff"
|
||||
PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
|
||||
|
||||
python util_linux_binpackages () {
|
||||
def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
|
||||
pn = d.getVar('PN')
|
||||
d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
|
||||
|
||||
if d.getVar('ALTERNATIVE:' + pkg):
|
||||
return
|
||||
if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
|
||||
d.setVar('ALTERNATIVE:' + pkg, modulename)
|
||||
|
||||
bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
|
||||
for dir in bindirs:
|
||||
do_split_packages(d, root=dir,
|
||||
file_regex=r'(.*)', output_pattern='${PN}-%s',
|
||||
description='${PN} %s',
|
||||
hook=pkg_hook, extra_depends='')
|
||||
|
||||
# There are some symlinks for some binaries which we have ignored
|
||||
# above. Add them to the package owning the binary they are
|
||||
# pointing to
|
||||
extras = {}
|
||||
dvar = d.getVar('PKGD')
|
||||
for root in bindirs:
|
||||
for walkroot, dirs, files in os.walk(dvar + root):
|
||||
for f in files:
|
||||
file = os.path.join(walkroot, f)
|
||||
if not os.path.islink(file):
|
||||
continue
|
||||
|
||||
pkg = os.path.basename(os.readlink(file))
|
||||
extras.setdefault(pkg, [])
|
||||
extras[pkg].append(file.replace(dvar, '', 1))
|
||||
|
||||
pn = d.getVar('PN')
|
||||
for pkg, links in extras.items():
|
||||
of = d.getVar('FILES:' + pn + '-' + pkg)
|
||||
links = of + " " + " ".join(sorted(links))
|
||||
d.setVar('FILES:' + pn + '-' + pkg, links)
|
||||
}
|
||||
|
||||
# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
|
||||
PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
|
||||
|
||||
# skip libuuid as it will be packaged by the util-linux-libuuid recipe
|
||||
python util_linux_libpackages() {
|
||||
do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
|
||||
output_pattern='${PN}-lib%s',
|
||||
description='${PN} lib%s',
|
||||
extra_depends='', prepend=True, allow_links=True)
|
||||
}
|
||||
|
||||
PACKAGESPLITFUNCS =+ "util_linux_libpackages"
|
||||
|
||||
PACKAGES_DYNAMIC = "^${PN}-.*"
|
||||
|
||||
UTIL_LINUX_LIBDIR = "${libdir}"
|
||||
UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
|
||||
EXTRA_OECONF = "\
|
||||
--enable-libuuid --enable-libblkid \
|
||||
\
|
||||
--enable-fsck --enable-kill --enable-last --enable-mesg \
|
||||
--enable-mount --enable-partx --enable-rfkill \
|
||||
--enable-unshare --enable-write \
|
||||
\
|
||||
--disable-bfs --disable-login \
|
||||
--disable-makeinstall-chown --disable-minix --disable-newgrp \
|
||||
--disable-use-tty-group --disable-vipw --disable-raw \
|
||||
\
|
||||
--without-udev \
|
||||
\
|
||||
usrsbin_execdir='${sbindir}' \
|
||||
--libdir='${UTIL_LINUX_LIBDIR}' \
|
||||
"
|
||||
|
||||
EXTRA_OECONF:append:class-target = " --enable-setpriv"
|
||||
EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
|
||||
EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
|
||||
EXTRA_OECONF:append = " --disable-hwclock-gplv3"
|
||||
|
||||
# enable pcre2 for native/nativesdk to match host distros
|
||||
# this helps to keep same expectations when using the SDK or
|
||||
# build host versions during development
|
||||
#
|
||||
PACKAGECONFIG ?= "pcre2"
|
||||
PACKAGECONFIG:class-target ?= "\
|
||||
libmount-mountfd-support \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)} \
|
||||
"
|
||||
# inherit manpages requires this to be present, however util-linux does not have
|
||||
# configuration options, and installs manpages always
|
||||
PACKAGECONFIG[manpages] = ""
|
||||
PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
|
||||
# Respect the systemd feature for uuidd
|
||||
PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
|
||||
# Build python bindings for libmount
|
||||
PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
|
||||
# Readline support
|
||||
PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
|
||||
# PCRE support in hardlink
|
||||
PACKAGECONFIG[pcre2] = ",,libpcre2"
|
||||
PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
|
||||
PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
|
||||
PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
|
||||
# Using the new file descriptors based mount kernel API can cause rootfs remount failure with some older kernels.
|
||||
# Of currently supported LTS kernels, the old mount API should be used with:
|
||||
# - versions prior to 6.6.18 in the 6.6.y series.
|
||||
# - versions prior to 6.1.79 in the 6.1.y series.
|
||||
# - versions till at least 5.15.164 in the 5.15.y series.
|
||||
# - with 5.10.y, 5.4.y and 4.19.y series kernels, libmount seemed to use the old API regardless of this option.
|
||||
PACKAGECONFIG[libmount-mountfd-support] = "--enable-libmount-mountfd-support,--disable-libmount-mountfd-support"
|
||||
|
||||
EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
|
||||
|
||||
ALLOW_EMPTY:${PN} = "1"
|
||||
FILES:${PN} = ""
|
||||
FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
|
||||
FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
|
||||
FILES:${PN}-mount = "${sysconfdir}/default/mountall"
|
||||
FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
|
||||
FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
|
||||
CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
|
||||
FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
|
||||
${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
|
||||
${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
|
||||
|
||||
# Util-linux' blkid replaces the e2fsprogs one
|
||||
RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
|
||||
RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
|
||||
|
||||
RRECOMMENDS:${PN}:class-native = ""
|
||||
RRECOMMENDS:${PN}:class-nativesdk = ""
|
||||
RDEPENDS:${PN}:class-native = ""
|
||||
RDEPENDS:${PN}:class-nativesdk = ""
|
||||
|
||||
RDEPENDS:${PN} += " util-linux-libuuid"
|
||||
RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
|
||||
|
||||
RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
|
||||
|
||||
RDEPENDS:${PN}-bash-completion += "${PN}-lsblk"
|
||||
RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz"
|
||||
RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash"
|
||||
RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
|
||||
ALLOW_EMPTY:${PN}-swaponoff = "1"
|
||||
|
||||
#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
|
||||
SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
|
||||
SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
|
||||
SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
|
||||
SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
|
||||
|
||||
do_compile:append () {
|
||||
cp ${WORKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
|
||||
${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
|
||||
}
|
||||
|
||||
do_install () {
|
||||
# with ccache the timestamps on compiled files may
|
||||
# end up earlier than on their inputs, this allows
|
||||
# for the resultant compilation in the install step.
|
||||
oe_runmake 'CC=${CC}' 'LD=${LD}' \
|
||||
'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
|
||||
|
||||
mkdir -p ${D}${base_bindir}
|
||||
|
||||
sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
|
||||
sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
|
||||
binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
|
||||
|
||||
if [ "${base_sbindir}" != "${sbindir}" ]; then
|
||||
mkdir -p ${D}${base_sbindir}
|
||||
for p in $sbinprogs $sbinprogs_a; do
|
||||
if [ -f "${D}${sbindir}/$p" ]; then
|
||||
mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "${base_bindir}" != "${bindir}" ]; then
|
||||
mkdir -p ${D}${base_bindir}
|
||||
for p in $binprogs_a; do
|
||||
if [ -f "${D}${bindir}/$p" ]; then
|
||||
mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
install -d ${D}${sysconfdir}/default/
|
||||
echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
|
||||
|
||||
rm -f ${D}${bindir}/chkdupexe
|
||||
|
||||
install -m 0755 ${B}/fcntl-lock ${D}${bindir}
|
||||
}
|
||||
|
||||
do_install:append:class-target () {
|
||||
if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
|
||||
install -d ${D}${sysconfdir}/pam.d
|
||||
install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
|
||||
install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
|
||||
# Required for "su -" aka "su --login" because
|
||||
# otherwise it uses "other", which has "auth pam_deny.so"
|
||||
# and thus prevents the operation.
|
||||
ln -s su ${D}${sysconfdir}/pam.d/su-l
|
||||
fi
|
||||
}
|
||||
# nologin causes a conflict with shadow-native
|
||||
# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
|
||||
do_install:append:class-native () {
|
||||
rm -f ${D}${base_sbindir}/nologin
|
||||
rm -f ${D}${base_bindir}/kill
|
||||
}
|
||||
|
||||
# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
|
||||
# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
|
||||
do_install:append () {
|
||||
rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
|
||||
}
|
||||
|
||||
ALTERNATIVE_PRIORITY = "80"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
|
||||
ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
|
||||
ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
|
||||
ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
|
||||
ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
|
||||
ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
|
||||
ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
|
||||
ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
|
||||
ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
|
||||
ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
|
||||
ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs"
|
||||
ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
|
||||
ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
|
||||
ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
|
||||
ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
|
||||
ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
|
||||
ALTERNATIVE:${PN}-agetty = "getty"
|
||||
ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
|
||||
ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
|
||||
ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
|
||||
ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
|
||||
ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
|
||||
ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm"
|
||||
ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs"
|
||||
ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
|
||||
ALTERNATIVE:${PN}-last = "last lastb"
|
||||
ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
|
||||
ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
|
||||
ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
|
||||
ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
|
||||
ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
|
||||
ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
|
||||
ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie"
|
||||
ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
|
||||
ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
|
||||
ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
|
||||
ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
|
||||
ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
|
||||
ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
|
||||
ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit"
|
||||
ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
|
||||
ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
|
||||
ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
|
||||
ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
|
||||
ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
|
||||
ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay"
|
||||
ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
|
||||
ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
|
||||
ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
|
||||
ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
|
||||
ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
|
||||
ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
|
||||
ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
|
||||
ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
|
||||
ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
|
||||
ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
|
||||
ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
|
||||
ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
|
||||
ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
|
||||
|
||||
ALTERNATIVE:${PN}-doc = "\
|
||||
blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
|
||||
mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
|
||||
"
|
||||
ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
|
||||
|
||||
ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
|
||||
ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
|
||||
ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
|
||||
ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
|
||||
ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
|
||||
ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
|
||||
ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
|
||||
ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
|
||||
ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
|
||||
ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
|
||||
ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
|
||||
ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
|
||||
ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
|
||||
ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
|
||||
ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
|
||||
ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
|
||||
ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
|
||||
ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
|
||||
ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
PTEST_BINDIR = "1"
|
||||
do_compile_ptest() {
|
||||
oe_runmake buildtest-TESTS
|
||||
}
|
||||
|
||||
do_install_ptest() {
|
||||
mkdir -p ${D}${PTEST_PATH}/tests/ts
|
||||
find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
|
||||
find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
|
||||
find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
|
||||
|
||||
cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
|
||||
cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
|
||||
cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
|
||||
cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
|
||||
|
||||
sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
|
||||
|
||||
# chfn needs PAM
|
||||
if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
|
||||
rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
|
||||
fi
|
||||
# remove raid tests, known failures and avoid dependency on mdadm therefore
|
||||
# See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d
|
||||
rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole
|
||||
rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part
|
||||
rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole
|
||||
rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md
|
||||
}
|
||||
|
||||
# Delete tests not working on musl
|
||||
do_install_ptest:append:libc-musl() {
|
||||
for t in tests/ts/col/multibyte \
|
||||
tests/ts/lib/timeutils \
|
||||
tests/ts/dmesg/limit; do
|
||||
rm -rf ${D}${PTEST_PATH}/$t
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user