sys-fs/lvm2: Sync with Gentoo

It's from Gentoo commit ef878f9169b08c18c5097b3205ebcb947891abe3.
This commit is contained in:
Krzesimir Nowak 2025-04-04 09:05:28 +02:00
parent 3abb159785
commit f62dc224f3
38 changed files with 1283 additions and 827 deletions

View File

@ -1 +1,2 @@
DIST LVM2.2.02.188.tgz 2421550 BLAKE2B bed90c8454cd4b20fdeec6dcbf5a9f97c9310671aea3b2252f8069cfa439fcb050f5ad95f928a7125a1734a4dc5ac985da99a4a570538e377a7205191a505476 SHA512 8c9db17c49dc8ebcab6c7f246ab85870a80658be811cf7f4d8f36abbebafa355b030bfc1e3bcbad73ccccb7fcd06d4a95ac547ca15d18d33715126da92703dca DIST LVM2.2.03.21.tgz 2742294 BLAKE2B 529bc01b3d1ba6207c9ddc95309b39e6293fcd0286334240b9fdc076da0b7bc7e026338ec0243564ec153f2fb5009014149c3f8e0db0cd47a29418af62068728 SHA512 6024811c3fa92afd2fc13a10d1c3542352aa9a016f40c3ef588bd2f5f3e41245fed4b36c8a87d9f7f8dddc6e13b7253396f5c811f99665df27751676dc7b5bde
DIST LVM2.2.03.22.tgz 2755031 BLAKE2B 79bbea84bd82f111c1bb5de336e6a9f1368b2c9e43f075dccaa90c7746a364259ad278adf650379eca75f2803ed74e74dd372be2cca8518462182657f96a0033 SHA512 17cd24ceee8026481566824b688dafd03ec816201d5cb3549cb7fc8a36f4cdaa982faaef4dcd26debfe775dea5ffa2744798164314ea6dc99a84f8ccccfc33ff

View File

@ -1,20 +0,0 @@
We keep this package in overlay, because we carry one extra patch for
the unit generator. It was posted upstream and remains
unacknowledged. We could try sending the patch to gentoo, so we can
bring this package back to portage-stable.
The lvm2-activation(-early).service was triggered multiple times which
if done too quickly leads to a failure like this:
systemd[1]: Finished Activation of LVM2 logical volumes.
systemd[1]: lvm2-activation-early.service: Start request repeated too quickly.
systemd[1]: lvm2-activation-early.service: Failed with result 'start-limit-hit'.
Set RemainAfterExit=yes as done for the other oneshot services to
prevent the unit from running multiple times in a row and hitting the
restart limit.
We also patch the configure script to use the correct path for systemd
util directory.

View File

@ -1,12 +0,0 @@
diff -ur LVM2.2.02.145/scripts/lvm2_activation_generator_systemd_red_hat.c LVM2.2.02.145-patch/scripts/lvm2_activation_generator_systemd_red_hat.c
--- LVM2.2.02.145/scripts/lvm2_activation_generator_systemd_red_hat.c 2016-03-04 19:03:29.000000000 +0100
+++ LVM2.2.02.145-patch/scripts/lvm2_activation_generator_systemd_red_hat.c 2020-07-28 18:15:35.766505354 +0200
@@ -153,7 +153,7 @@
fputs("ExecStart=" LVM_PATH " vgchange -aay --ignoreskippedcluster", f);
if (sysinit_needed)
fputs (" --sysinit", f);
- fputs("\nType=oneshot\n", f);
+ fputs("\nType=oneshot\nRemainAfterExit=yes\n", f);
if (fclose(f) < 0) {
kmsg(LOG_ERR, "LVM: Failed to write unit file %s: %m.\n", unit_name);

View File

@ -1,12 +0,0 @@
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -505,7 +505,9 @@
dev->flags |= DEV_NOT_O_NOATIME;
if ((dev->fd = open(name, flags, 0777)) >= 0) {
log_debug_devs("%s: Not using O_NOATIME", name);
+#ifdef O_DIRECT_SUPPORT
goto opened;
+#endif
}
}
#endif

View File

@ -1,13 +0,0 @@
diff --git a/make.tmpl.in b/make.tmpl.in
index a40eaaa15..7eea943aa 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -53,7 +53,7 @@ PYCOMPILE = $(top_srcdir)/autoconf/py-compile
LIBS = @LIBS@
# Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
+STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS) $(M_LIBS)
DEFS += @DEFS@
# FIXME set this only where it's needed, not globally?
CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@

View File

@ -1,29 +0,0 @@
--- LVM2.2.02.176/libdm/libdevmapper.pc.in
+++ LVM2.2.02.176/libdm/libdevmapper.pc.in
@@ -9,4 +9,4 @@
Cflags: -I${includedir}
Libs: -L${libdir} -ldevmapper
Requires.private: @SELINUX_PC@ @UDEV_PC@
-Libs.private: -lm @RT_LIBS@
+Libs.private: -lm @RT_LIBS@ @PTHREAD_LIBS@
--- LVM2.2.02.176/tools/Makefile.in
+++ LVM2.2.02.176/tools/Makefile.in
@@ -93,6 +93,7 @@
INSTALL_LVM_TARGETS += install_tools_static
INSTALL_DMSETUP_TARGETS += install_dmsetup_static
INSTALL_CMDLIB_TARGETS += install_cmdlib_static
+ STATIC_LIBS += @PTHREAD_LIBS@
endif
LVMLIBS = $(LVMINTERNAL_LIBS) -ldevmapper
@@ -118,6 +119,10 @@
include $(top_builddir)/make.tmpl
+ifeq ("@STATIC_LINK@", "yes")
+ STATIC_LIBS += @PTHREAD_LIBS@
+endif
+
device-mapper: $(TARGETS_DM)
CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)

View File

@ -1,15 +0,0 @@
http://bugs.gentoo.org/330255
liblvm2app.so: undefined reference to `floor'
--- LVM2.2.02.178/liblvm/Makefile.in
+++ LVM2.2.02.178/liblvm/Makefile.in
@@ -43,7 +43,7 @@
include $(top_builddir)/make.tmpl
LDFLAGS += -L$(top_builddir)/lib -L$(top_builddir)/daemons/dmeventd
-LIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio
+LIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio -lm
.PHONY: install_dynamic install_static install_include install_pkgconfig

View File

@ -1,59 +0,0 @@
--- LVM2.2.02.178/configure.ac
+++ LVM2.2.02.178/configure.ac
@@ -33,6 +33,7 @@
CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
# equivalent to -rdynamic
ELDFLAGS="-Wl,--export-dynamic"
+ STATIC_LDFLAGS="-Wl,--no-export-dynamic"
# FIXME Generate list and use --dynamic-list=.dlopen.sym
CLDWHOLEARCHIVE="-Wl,-whole-archive"
CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
@@ -2042,6 +2043,7 @@
AC_SUBST(SYSTEMD_LIBS)
AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
+AC_SUBST(STATIC_LDFLAGS)
AC_SUBST(STATIC_LINK)
AC_SUBST(TESTSUITE_DATA)
AC_SUBST(THIN)
--- LVM2.2.02.178/daemons/dmeventd/Makefile.in
+++ LVM2.2.02.178/daemons/dmeventd/Makefile.in
@@ -64,7 +64,7 @@
-o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS)
dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
- $(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
-o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS) $(STATIC_LIBS)
ifeq ("@PKGCONFIG@", "yes")
--- LVM2.2.02.178/make.tmpl.in
+++ LVM2.2.02.178/make.tmpl.in
@@ -64,6 +64,7 @@
# FIXME set this only where it's needed, not globally?
CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
LDFLAGS ?= @LDFLAGS@
+STATIC_LDFLAGS += @STATIC_LDFLAGS@
CLDFLAGS += @CLDFLAGS@
ELDFLAGS += @ELDFLAGS@
LDDEPS += @LDDEPS@
--- LVM2.2.02.178/tools/Makefile.in
+++ LVM2.2.02.178/tools/Makefile.in
@@ -129,7 +129,7 @@
dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \
-o $@ dmsetup.o -ldevmapper $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
all: device-mapper
@@ -159,7 +159,7 @@
lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
$(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o

View File

@ -1,102 +0,0 @@
--- LVM2.2.02.178/configure.ac
+++ LVM2.2.02.178/configure.ac
@@ -1238,6 +1238,7 @@
PKG_CHECK_MODULES(BLKID, blkid >= 2.24,
[ BLKID_WIPING=yes
BLKID_PC="blkid"
+ BLKID_STATIC_LIBS=`$PKG_CONFIG --static --libs $BLKID_PC`
DEFAULT_USE_BLKID_WIPING=1
AC_DEFINE([BLKID_WIPING_SUPPORT], 1, [Define to 1 to use libblkid detection of signatures when wiping.])
], [if test "$BLKID_WIPING" = maybe; then
@@ -1286,6 +1287,7 @@
if test "$UDEV_SYNC" = yes; then
pkg_config_init
PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
+ UDEV_STATIC_LIBS=`$PKG_CONFIG --static --libs libudev`
AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
AC_CHECK_LIB(udev, udev_device_get_is_initialized, AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1,
@@ -1564,19 +1566,32 @@
if test "$SELINUX" = yes; then
AC_CHECK_LIB([sepol], [sepol_check_context], [
AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
- SELINUX_LIBS="-lsepol"])
+ SEPOL_LIBS="-lsepol"])
+
+ dnl -- init pkgconfig if required
+ if test x$PKGCONFIG_INIT != x1; then
+ pkg_config_init
+ fi
+ PKG_CHECK_MODULES(SELINUX, libselinux, [
+ SELINUX_PC="libselinux"
+ SELINUX_STATIC_LIBS=`$PKG_CONFIG --static --libs libselinux`
+ SELINUX_LIBS="$SELINUX_LIBS $SEPOL_LIBS"
+ AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
+ ],[
+ dnl -- old non-pkgconfig method, is buggy with static builds
AC_CHECK_LIB([selinux], [is_selinux_enabled], [
AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
AC_CHECK_HEADERS([selinux/label.h])
AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
- SELINUX_LIBS="-lselinux $SELINUX_LIBS"
+ SELINUX_LIBS="-lselinux $SEPOL_LIBS"
SELINUX_PC="libselinux"
HAVE_SELINUX=yes ], [
AC_MSG_WARN(Disabling selinux)
SELINUX_LIBS=
SELINUX_PC=
HAVE_SELINUX=no ])
+ ])
fi
################################################################################
@@ -1927,6 +1942,7 @@
################################################################################
AC_SUBST(APPLIB)
AC_SUBST(AWK)
+AC_SUBST(BLKID_STATIC_LIBS)
AC_SUBST(BLKID_PC)
AC_SUBST(BUILD_CMIRRORD)
AC_SUBST(BUILD_DMEVENTD)
@@ -2037,6 +2053,7 @@
AC_SUBST(SALCK_LIBS)
AC_SUBST(SBINDIR)
AC_SUBST(SELINUX_LIBS)
+AC_SUBST(SELINUX_STATIC_LIBS)
AC_SUBST(SELINUX_PC)
AC_SUBST(SYSCONFDIR)
AC_SUBST(SYSTEMD_LIBS)
@@ -2053,6 +2070,7 @@
AC_SUBST(CACHE_DUMP_CMD)
AC_SUBST(CACHE_REPAIR_CMD)
AC_SUBST(CACHE_RESTORE_CMD)
+AC_SUBST(UDEV_STATIC_LIBS)
AC_SUBST(UDEV_PC)
AC_SUBST(UDEV_RULES)
AC_SUBST(UDEV_SYNC)
--- LVM2.2.02.178/make.tmpl.in
+++ LVM2.2.02.178/make.tmpl.in
@@ -59,7 +59,7 @@
LIBS = @LIBS@
# Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
DEFS += @DEFS@
# FIXME set this only where it's needed, not globally?
CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
@@ -75,10 +75,13 @@
PTHREAD_LIBS = @PTHREAD_LIBS@
READLINE_LIBS = @READLINE_LIBS@
SELINUX_LIBS = @SELINUX_LIBS@
+SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
UDEV_CFLAGS = @UDEV_CFLAGS@
UDEV_LIBS = @UDEV_LIBS@
+UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
BLKID_CFLAGS = @BLKID_CFLAGS@
BLKID_LIBS = @BLKID_LIBS@
+BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
SYSTEMD_LIBS = @SYSTEMD_LIBS@
VALGRIND_CFLAGS = @VALGRIND_CFLAGS@

View File

@ -1,13 +0,0 @@
https://bugs.gentoo.org/686652
--- LVM2.2.02.184/tools/Makefile.in
+++ LVM2.2.02.184/tools/Makefile.in
@@ -220,6 +220,6 @@
echo "/* Do not edit. This file is generated by the Makefile. */" && \
echo -en "const char _command_input[] =\n\n\"" && \
$(EGREP) -v '^#|\-\-\-|^$$' $(srcdir)/command-lines.in | $(AWK) 'BEGIN {ORS = "\\n\"\n\""} //' && \
- echo "\\n\";" \
+ printf "%s\n" "\\n\";" \
) > $@
$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h cmds.h

View File

@ -1,34 +0,0 @@
From f98f79a047dd1c4980008e0ed6c9ad4e18596cdc Mon Sep 17 00:00:00 2001
From: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue, 13 Aug 2019 15:18:30 +0200
Subject: [PATCH] udev: remove unsupported OPTIONS+="event_timeout" rule
The OPTIONS+="event_timeout" is Unsupported since systemd/udev version 216,
that is ~5 years ago.
Since systemd/udev version 243, there's a new message printed if unsupported
OPTIONS value is used:
Invalid value for OPTIONS key, ignoring: 'event_timeout=180'
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1740666
---
udev/11-dm-lvm.rules.in | 2 --
1 file changed, 2 deletions(-)
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index 91cb991df9..7c589943b7 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -37,8 +37,6 @@ ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", ENV{DM_NOSCAN}=="1", ENV{DM_UDEV_DISABLE_OTHE
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
-OPTIONS+="event_timeout=180"
-
# Do not create symlinks for inappropriate subdevices.
ENV{DM_LV_NAME}=="pvmove?*|?*_vorigin", GOTO="lvm_disable"
ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
--
2.24.0

View File

@ -1,72 +0,0 @@
--- LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd.orig 2006-11-21 22:41:56.000000000 +0000
+++ LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd 2009-12-26 01:47:08.025224602 +0000
@@ -54,7 +54,9 @@
DEVRAM=/tmp/initrd.$$
# set defaults
-BINFILES=${BINFILES:-"`which lvm` `which bash` `which busybox` `which pivot_root`"}
+LVM=`which lvm.static`
+LVM=${LVM:-"`which lvm`"}
+BINFILES=${BINFILES:-"${LVM} `which bash` `which busybox` `which pivot_root`"}
BASICDEVICES=${BASICDEVICES:-"std consoleonly fd"}
BLOCKDEVICES=${BLOCKDEVICES:-"md hda hdb hdc hdd sda sdb sdc sdd"}
MAKEDEV=${MAKEDEV:-"debian"}
@@ -119,6 +121,10 @@
echo "$PRE Mounting /proc"
mount -t proc none /proc
+# We need /sys for lvm
+echo "$PRE Mounting /sys"
+mount -t sysfs sysfs /sys
+
# plug in modules listed in /etc/modules
if [ -f /etc/modules ]; then
echo -n "$PRE plugging in kernel modules:"
@@ -179,26 +185,29 @@
# run a shell if we're passed lvm2rescue on commandline
grep lvm2rescue /proc/cmdline 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
- lvm vgchange --ignorelockingfailure -P -a y
+ $LVM vgchange --ignorelockingfailure -P -a y
do_shell
else
- lvm vgchange --ignorelockingfailure -a y
+ $LVM vgchange --ignorelockingfailure -a y
fi
echo "$PRE Mounting root filesystem $rootvol ro"
mkdir /rootvol
if ! mount -t auto -o ro $rootvol /rootvol; then
- echo "\t*FAILED*";
+ echo "\t*FAILED TRYING TO MOUNT ROOTVOL*";
do_shell
fi
echo "$PRE Umounting /proc"
umount /proc
+echo "$PRE Umounting /sys"
+umount /sys
+
echo "$PRE Changing roots"
cd /rootvol
if ! pivot_root . initrd ; then
- echo "\t*FAILED*"
+ echo "\t*FAILED PIVOT TO NEW ROOT*"
do_shell
fi
@@ -356,7 +365,7 @@
fi
verbose "creating basic set of directories in $TMPMNT"
-(cd $TMPMNT; mkdir bin dev etc lib proc sbin var)
+(cd $TMPMNT; mkdir bin dev etc lib proc sbin sys var)
if [ $? -ne 0 ]; then
echo "$cmd -- ERROR creating directories in $TMPMNT"
cleanup 1
@@ -499,4 +508,3 @@
FINALTXT
cleanup 0
-

View File

@ -1,42 +0,0 @@
diff -Nuar --exclude '*~' LVM2.2.02.63.orig/daemons/dmeventd/Makefile.in LVM2.2.02.63/daemons/dmeventd/Makefile.in
--- LVM2.2.02.63.orig/daemons/dmeventd/Makefile.in 2010-04-09 14:42:48.000000000 -0700
+++ LVM2.2.02.63/daemons/dmeventd/Makefile.in 2010-04-19 11:53:27.000000000 -0700
@@ -28,11 +28,12 @@
INSTALL_LIB_TARGETS = install_lib_dynamic
LIB_NAME = libdevmapper-event
+LIB_STATIC = $(LIB_NAME).a
+INSTALL_LIB_TARGETS += install_lib_static
+TARGETS += $(LIB_STATIC)
ifeq ("@STATIC_LINK@", "yes")
- LIB_STATIC = $(LIB_NAME).a
- TARGETS += $(LIB_STATIC) dmeventd.static
+ TARGETS += dmeventd.static
INSTALL_DMEVENTD_TARGETS += install_dmeventd_static
- INSTALL_LIB_TARGETS += install_lib_static
endif
LIB_VERSION = $(LIB_VERSION_DM)
diff -Nuar --exclude '*~' LVM2.2.02.63.orig/libdm/Makefile.in LVM2.2.02.63/libdm/Makefile.in
--- LVM2.2.02.63.orig/libdm/Makefile.in 2010-04-09 14:42:51.000000000 -0700
+++ LVM2.2.02.63/libdm/Makefile.in 2010-04-19 11:52:20.000000000 -0700
@@ -34,8 +34,8 @@
INCLUDES = -I$(srcdir)/$(interface) -I$(srcdir)
-ifeq ("@STATIC_LINK@", "yes")
LIB_STATIC = $(interface)/libdevmapper.a
+ifeq ("@STATIC_LINK@", "yes")
endif
LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX)
@@ -63,8 +63,8 @@
INSTALL_TYPE = install_dynamic
-ifeq ("@STATIC_LINK@", "yes")
INSTALL_TYPE += install_static
+ifeq ("@STATIC_LINK@", "yes")
endif
ifeq ("@PKGCONFIG@", "yes")

View File

@ -1,18 +0,0 @@
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=301331
X-Gentoo-Bug: 301331
diff -Nuar LVM2.2.02.67.orig/scripts/lvm2create_initrd/lvm2create_initrd LVM2.2.02.67/scripts/lvm2create_initrd/lvm2create_initrd
--- LVM2.2.02.67.orig/scripts/lvm2create_initrd/lvm2create_initrd 2010-06-07 18:44:34.182980475 +0000
+++ LVM2.2.02.67/scripts/lvm2create_initrd/lvm2create_initrd 2010-06-07 18:51:27.636312899 +0000
@@ -469,9 +469,9 @@
rmdir $TMPMNT/lost+found
echo "$cmd -- ummounting ram disk"
-umount $DEVRAM
+umount $TMPMNT
if [ $? -ne 0 ]; then
- echo "$cmd -- ERROR umounting $DEVRAM"
+ echo "$cmd -- ERROR umounting $TMPMNT"
cleanup 1
fi

View File

@ -1,11 +0,0 @@
--- LVM2/make.tmpl.in
+++ LVM2/make.tmpl.in
@@ -395,7 +395,7 @@
( cat $(srcdir)/.exported_symbols; \
if test x$(EXPORTED_HEADER) != x; then \
$(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
- $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
+ LC_ALL=C $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
fi \
) > $@

View File

@ -0,0 +1,11 @@
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -76,7 +76,7 @@
# it's better suited to appearing in the journal.
IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event --udevoutput --journal=output $env{DEVNAME}"
-ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="(SYSTEMDRUN) --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} (LVM_EXEC)/lvm vgchange -aay --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
+ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="(LVM_EXEC)/lvm vgchange -aay --nohints --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
GOTO="lvm_end"
LABEL="lvm_end"

View File

@ -1,5 +1,6 @@
From ab3ae0a22dfbe20e2d17e7dc60e0f76184ec098c Mon Sep 17 00:00:00 2001
From: "Robin H. Johnson" <robbat2@gentoo.org> From: "Robin H. Johnson" <robbat2@gentoo.org>
Date: Wed, 17 Apr 2019 06:54:27 +0000 Date: Wed, 24 Jul 2019 11:22:32 +0200
Subject: [PATCH] dmeventd configurable idle exit time Subject: [PATCH] dmeventd configurable idle exit time
dmeventd nominally exits after 1 hour of idle time. There are use cases for dmeventd nominally exits after 1 hour of idle time. There are use cases for
@ -11,11 +12,9 @@ that can be -1 to not exit, or a configurable time for different idle exit.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Fixes: https://bugs.gentoo.org/682556 Fixes: https://bugs.gentoo.org/682556
--- a/daemons/dmeventd/dmeventd.c
diff -Nuar LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.184/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c
--- LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c 2019-03-22 03:14:59.000000000 -0700 @@ -2169,6 +2169,18 @@
+++ LVM2.2.02.184/daemons/dmeventd/dmeventd.c 2019-04-17 00:18:23.535029906 -0700
@@ -2158,6 +2158,18 @@
.server_path = DM_EVENT_FIFO_SERVER .server_path = DM_EVENT_FIFO_SERVER
}; };
time_t now, idle_exit_timeout = DMEVENTD_IDLE_EXIT_TIMEOUT; time_t now, idle_exit_timeout = DMEVENTD_IDLE_EXIT_TIMEOUT;
@ -34,7 +33,7 @@ diff -Nuar LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.184/daemons/
opterr = 0; opterr = 0;
optind = 0; optind = 0;
@@ -2253,7 +2265,7 @@ @@ -2265,7 +2277,7 @@
_process_initial_registrations(); _process_initial_registrations();
for (;;) { for (;;) {
@ -43,7 +42,7 @@ diff -Nuar LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.184/daemons/
if (_exit_now) { if (_exit_now) {
if (_exit_now == DM_SCHEDULED_EXIT) if (_exit_now == DM_SCHEDULED_EXIT)
break; /* Only prints shutdown message */ break; /* Only prints shutdown message */
@@ -2262,7 +2274,7 @@ @@ -2274,7 +2286,7 @@
(long) (time(NULL) - _idle_since)); (long) (time(NULL) - _idle_since));
break; break;
} }
@ -52,13 +51,12 @@ diff -Nuar LVM2.2.02.184.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.184/daemons/
now = time(NULL); now = time(NULL);
if (now < _idle_since) if (now < _idle_since)
_idle_since = now; /* clock change? */ _idle_since = now; /* clock change? */
diff -Nuar LVM2.2.02.184.orig/man/dmeventd.8_main LVM2.2.02.184/man/dmeventd.8_main --- a/man/dmeventd.8_main
--- LVM2.2.02.184.orig/man/dmeventd.8_main 2019-03-22 03:15:00.000000000 -0700 +++ b/man/dmeventd.8_main
+++ LVM2.2.02.184/man/dmeventd.8_main 2019-04-17 00:17:46.076023638 -0700 @@ -169,6 +169,10 @@
@@ -143,6 +143,10 @@ Variable is set by thin and vdo plugin to prohibit recursive interaction
Variable is set by thin plugin to prohibit recursive interation
with dmeventd by any executed lvm2 command from with dmeventd by any executed lvm2 command from
a thin_command environment. a thin_command, vdo_command environment.
+.TP +.TP
+.B DMEVENTD_IDLE_EXIT_TIMEOUT +.B DMEVENTD_IDLE_EXIT_TIMEOUT
+Configure the dmeventd idle exit timeout behavior, value in seconds. Default +Configure the dmeventd idle exit timeout behavior, value in seconds. Default

View File

@ -1,26 +1,18 @@
--- LVM2.2.02.178/conf/example.conf.in Add Gentoo specific changes
+++ LVM2.2.02.178/conf/example.conf.in
@@ -128,6 +128,9 @@ --- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -170,6 +170,9 @@
# Example # Example
# Accept every block device: # Accept every block device:
# filter = [ "a|.*/|" ] # filter = [ "a|.*|" ]
+ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel + # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
+ # noise when you probed while not available. + # noise when you probed while not available.
+ filter = [ "r|/dev/nbd.*|", "a/.*/" ] + filter = [ "r|/dev/nbd.*|", "a|.*|" ]
# Reject the cdrom drive: # Reject the cdrom drive:
# filter = [ "r|/dev/cdrom|" ] # filter = [ "r|/dev/cdrom|" ]
# Work with just loopback devices, e.g. for testing: # Work with just loopback devices, e.g. for testing:
@@ -704,7 +707,8 @@ @@ -1843,7 +1846,7 @@
# Configuration option global/fallback_to_lvm1.
# This setting is no longer used.
# This configuration option has an automatic default value.
- # fallback_to_lvm1 = 0
+ # Gentoo: the LVM tools are a seperate package.
+ fallback_to_lvm1 = 0
# Configuration option global/format.
# This setting is no longer used.
@@ -1508,7 +1512,7 @@
# Configuration section metadata. # Configuration section metadata.
# This configuration section has an automatic default value. # This configuration section has an automatic default value.
@ -29,7 +21,7 @@
# Configuration option metadata/check_pv_device_sizes. # Configuration option metadata/check_pv_device_sizes.
# Check device sizes are not smaller than corresponding PV sizes. # Check device sizes are not smaller than corresponding PV sizes.
@@ -1553,7 +1557,8 @@ @@ -1888,7 +1891,8 @@
# #
# This configuration option is advanced. # This configuration option is advanced.
# This configuration option has an automatic default value. # This configuration option has an automatic default value.
@ -39,10 +31,10 @@
# Configuration option metadata/vgmetadatacopies. # Configuration option metadata/vgmetadatacopies.
# Number of copies of metadata to maintain for each VG. # Number of copies of metadata to maintain for each VG.
@@ -1608,7 +1613,7 @@ @@ -1931,7 +1935,7 @@
#
# This configuration option is advanced. # This configuration option is advanced.
# This configuration option does not have a default value defined. # This configuration option has an automatic default value.
# stripesize = 64
-# } -# }
+} +}

View File

@ -0,0 +1,54 @@
From 4cf08811e112100a2b10c60047f3c537ad21d674 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Sat, 28 Jan 2023 14:22:42 +0100
Subject: [PATCH] Use `freopen()` on {stdin,stdout,stderr}
* ISO C does not guarantee that the standard streams are modifiable
lvalues. Glibc even calls out this behaviour as non-portable:
https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -208,7 +208,11 @@ int reopen_standard_stream(FILE **stream, const char *mode)
_check_and_replace_standard_log_streams(old_stream, new_stream);
+#ifdef __GLIBC__
*stream = new_stream;
+#else
+ freopen(NULL, mode, *stream);
+#endif
return 1;
}
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3422,7 +3422,7 @@ static int _check_standard_fds(void)
int err = is_valid_fd(STDERR_FILENO);
if (!is_valid_fd(STDIN_FILENO) &&
- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
+ !freopen(_PATH_DEVNULL, "r", stdin)) {
if (err)
perror("stdin stream open");
else
@@ -3432,7 +3432,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDOUT_FILENO) &&
- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
+ !freopen(_PATH_DEVNULL, "w", stdout)) {
if (err)
perror("stdout stream open");
/* else no stdout */
@@ -3440,7 +3440,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDERR_FILENO) &&
- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
+ !freopen(_PATH_DEVNULL, "w", stderr)) {
printf("stderr stream open: %s\n",
strerror(errno));
return 0;
--
2.39.2

View File

@ -0,0 +1,30 @@
https://bugs.gentoo.org/920798
https://gitlab.com/lvmteam/lvm2/-/merge_requests/4
From 39cb34e56b8c04b4d652eb9dbd643e10a05ff21c Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Mon, 6 Nov 2023 16:44:41 +0800
Subject: [PATCH] configure.ac: check egrep
The macro AC_HEADER_STDC which requires AC_PROG_EGREP has been removed
from configure.ac, then it fails to substitute '@EGREP@':
| [GEN] command-lines-input.h
| /bin/bash: line 2: @EGREP@: command not found
| [GEN] command-count.h
Call AC_PROG_EGREP to fix the error.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,7 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_RANLIB
+AC_PROG_EGREP
AC_CHECK_TOOL([READELF], [readelf])
AC_CHECK_TOOL(AR, ar)
AC_PATH_TOOL(CFLOW_CMD, cflow)
--
GitLab

View File

@ -0,0 +1,34 @@
https://bugs.gentoo.org/937239
https://github.com/lvmteam/lvm2/commit/f98d2ffe8753895c84160a7abce4223bd127cd9e
From f98d2ffe8753895c84160a7abce4223bd127cd9e Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 27 Mar 2024 00:28:14 +0100
Subject: [PATCH] device_id: use dm_basename
Avoid problems for other libc like muslc and use dm_basename.
Prototype for basename has been removed from string.h from latest musl [1]
compilers e.g. clang-18 flags the absense of prototype as error. therefore
include libgen.h for providing it.
[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
Reported-by: Khem Raj <raj.khem@gmail.com>
---
lib/device/device_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 7d67a1cb7..200d39432 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -740,7 +740,7 @@ static int _dev_read_sys_serial(struct cmd_context *cmd, struct device *dev,
int ret;
/* /dev/vda to vda */
- base = basename(devname);
+ base = dm_basename(devname);
/* vda1 to vda */
for (i = 0; i < strlen(base); i++) {

View File

@ -0,0 +1,137 @@
https://gitlab.com/lvmteam/lvm2/-/merge_requests/18
From 25f0398b1c9d108160a39de43af6f2fa3f952db5 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sun, 17 Nov 2024 10:45:29 -0500
Subject: [PATCH] configure: update thin_check_needs_check logic
If the user has explicitly passed a value for thin_check_needs_check,
skip the autodetection logic entirely. Same for cache_check_needs_check.
This allows lvm2 to be built consistently without having
thin-provisioning-tools installed.
---
configure.ac | 84 ++++++++++++++++++++++++++++------------------------
1 file changed, 46 insertions(+), 38 deletions(-)
diff --git a/configure.ac b/configure.ac
index cbea6adc6..4f77b4e6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -422,7 +422,7 @@ dnl -- thin_check needs-check flag
AC_ARG_ENABLE(thin_check_needs_check,
AS_HELP_STRING([--disable-thin_check_needs_check],
[required if thin_check version is < 0.3.0]),
- THIN_CHECK_NEEDS_CHECK=$enableval, THIN_CHECK_NEEDS_CHECK="yes")
+ THIN_CHECK_NEEDS_CHECK=$enableval, THIN_CHECK_NEEDS_CHECK="autodetect")
# Test if necessary thin tools are available
# if not - use plain defaults and warn user
@@ -437,20 +437,24 @@ AS_CASE(["$THIN"],
THIN_CONFIGURE_WARN="y"
])
])
- AS_IF([test "$THIN_CHECK_NEEDS_CHECK" = "yes" && test "$THIN_CONFIGURE_WARN" != "y"], [
- THIN_CHECK_VSN=$("$THIN_CHECK_CMD" -V 2>/dev/null)
- THIN_CHECK_VSN=${THIN_CHECK_VSN##* } # trim away all before the first space
- THIN_CHECK_VSN_MAJOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}')
- THIN_CHECK_VSN_MINOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}')
-
- AS_IF([test -z "$THIN_CHECK_VSN_MAJOR" || test -z "$THIN_CHECK_VSN_MINOR"], [
- AC_MSG_WARN([$THIN_CHECK_CMD: Bad version "$THIN_CHECK_VSN" found])
- THIN_CHECK_VERSION_WARN="y"
- THIN_CHECK_NEEDS_CHECK="no"
- ], [test "$THIN_CHECK_VSN_MAJOR" -eq 0 && test "$THIN_CHECK_VSN_MINOR" -lt 3], [
- AC_MSG_WARN([$THIN_CHECK_CMD: Old version "$THIN_CHECK_VSN" found])
- THIN_CHECK_VERSION_WARN="y"
- THIN_CHECK_NEEDS_CHECK="no"
+ AS_IF([test "$THIN_CHECK_NEEDS_CHECK" = "autodetect"], [
+ AS_IF([test "$THIN_CONFIGURE_WARN" != "y"], [
+ THIN_CHECK_VSN=$("$THIN_CHECK_CMD" -V 2>/dev/null)
+ THIN_CHECK_VSN=${THIN_CHECK_VSN##* } # trim away all before the first space
+ THIN_CHECK_VSN_MAJOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}')
+ THIN_CHECK_VSN_MINOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}')
+
+ AS_IF([test -z "$THIN_CHECK_VSN_MAJOR" || test -z "$THIN_CHECK_VSN_MINOR"], [
+ AC_MSG_WARN([$THIN_CHECK_CMD: Bad version "$THIN_CHECK_VSN" found])
+ THIN_CHECK_VERSION_WARN="y"
+ THIN_CHECK_NEEDS_CHECK="no"
+ ], [test "$THIN_CHECK_VSN_MAJOR" -eq 0 && test "$THIN_CHECK_VSN_MINOR" -lt 3], [
+ AC_MSG_WARN([$THIN_CHECK_CMD: Old version "$THIN_CHECK_VSN" found])
+ THIN_CHECK_VERSION_WARN="y"
+ THIN_CHECK_NEEDS_CHECK="no"
+ ], [
+ THIN_CHECK_NEEDS_CHECK="yes"
+ ])
])
])
# Empty means a config way to ignore thin dumping
@@ -535,7 +539,7 @@ dnl -- cache_check needs-check flag
AC_ARG_ENABLE(cache_check_needs_check,
AS_HELP_STRING([--disable-cache_check_needs_check],
[required if cache_check version is < 0.5]),
- CACHE_CHECK_NEEDS_CHECK=$enableval, CACHE_CHECK_NEEDS_CHECK="yes")
+ CACHE_CHECK_NEEDS_CHECK=$enableval, CACHE_CHECK_NEEDS_CHECK="autodetect")
# Test if necessary cache tools are available
# if not - use plain defaults and warn user
@@ -550,30 +554,34 @@ AS_CASE(["$CACHE"],
CACHE_CONFIGURE_WARN="y"
])
])
- AS_IF([test "$CACHE_CHECK_NEEDS_CHECK" = "yes" && test "$CACHE_CONFIGURE_WARN" != "y"], [
- "$CACHE_CHECK_CMD" -V 2>/dev/null >conftest.tmp
- read -r CACHE_CHECK_VSN < conftest.tmp
- IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
- rm -f conftest.tmp
-
- # Require version >= 0.5.4 for --clear-needs-check-flag
- CACHE_CHECK_VSN_MAJOR=${CACHE_CHECK_VSN_MAJOR##* }
- AS_IF([test -z "$CACHE_CHECK_VSN_MAJOR" \
- || test -z "$CACHE_CHECK_VSN_MINOR" \
- || test -z "$CACHE_CHECK_VSN_PATCH"], [
- AC_MSG_WARN([$CACHE_CHECK_CMD: Bad version "$CACHE_CHECK_VSN" found])
- CACHE_CHECK_VERSION_WARN="y"
- CACHE_CHECK_NEEDS_CHECK="no"
- ], [test "$CACHE_CHECK_VSN_MAJOR" -eq 0], [
- AS_IF([test "$CACHE_CHECK_VSN_MINOR" -lt 5 \
- || ( test "$CACHE_CHECK_VSN_MINOR" -eq 5 && test "$CACHE_CHECK_VSN_PATCH" -lt 4 )], [
- AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" found])
+ AS_IF([test "$CACHE_CHECK_NEEDS_CHECK" = "autodetect"], [
+ AS_IF([test "$CACHE_CONFIGURE_WARN" != "y"], [
+ "$CACHE_CHECK_CMD" -V 2>/dev/null >conftest.tmp
+ read -r CACHE_CHECK_VSN < conftest.tmp
+ IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
+ rm -f conftest.tmp
+
+ # Require version >= 0.5.4 for --clear-needs-check-flag
+ CACHE_CHECK_VSN_MAJOR=${CACHE_CHECK_VSN_MAJOR##* }
+ AS_IF([test -z "$CACHE_CHECK_VSN_MAJOR" \
+ || test -z "$CACHE_CHECK_VSN_MINOR" \
+ || test -z "$CACHE_CHECK_VSN_PATCH"], [
+ AC_MSG_WARN([$CACHE_CHECK_CMD: Bad version "$CACHE_CHECK_VSN" found])
CACHE_CHECK_VERSION_WARN="y"
CACHE_CHECK_NEEDS_CHECK="no"
- ])
- AS_IF([test "$CACHE_CHECK_VSN_MINOR" -lt 7], [
- AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" does not support new cache format V2])
- CACHE_CHECK_VERSION_WARN=y
+ ], [test "$CACHE_CHECK_VSN_MAJOR" -eq 0], [
+ AS_IF([test "$CACHE_CHECK_VSN_MINOR" -lt 5 \
+ || ( test "$CACHE_CHECK_VSN_MINOR" -eq 5 && test "$CACHE_CHECK_VSN_PATCH" -lt 4 )], [
+ AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" found])
+ CACHE_CHECK_VERSION_WARN="y"
+ CACHE_CHECK_NEEDS_CHECK="no"
+ ])
+ AS_IF([test "$CACHE_CHECK_VSN_MINOR" -lt 7], [
+ AC_MSG_WARN([$CACHE_CHECK_CMD: Old version "$CACHE_CHECK_VSN" does not support new cache format V2])
+ CACHE_CHECK_VERSION_WARN=y
+ ])
+ ], [
+ CACHE_CHECK_NEEDS_CHECK="yes"
])
])
])
--
2.47.0

View File

@ -0,0 +1,59 @@
From f117d47ffa781f7f1ad452505c250b4826cdcc7f Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 10 Oct 2023 22:03:50 +0200
Subject: [PATCH] configure.ac: version checking for new dmpd tools
New rust version of thin_check returns now also binary name in version,
so adapt the version checking to handle this variant.
---
configure.ac | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1550f1f70..59d4b65af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -426,6 +426,7 @@ AS_CASE(["$THIN"],
])
AS_IF([test "$THIN_CHECK_NEEDS_CHECK" = "yes" && test "$THIN_CONFIGURE_WARN" != "y"], [
THIN_CHECK_VSN=$("$THIN_CHECK_CMD" -V 2>/dev/null)
+ THIN_CHECK_VSN=${THIN_CHECK_VSN##* } # trim away all before the first space
THIN_CHECK_VSN_MAJOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}')
THIN_CHECK_VSN_MINOR=$(echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}')
@@ -467,7 +468,7 @@ AS_CASE(["$THIN"],
])
])
- AC_MSG_CHECKING([whether thin_check supports the needs-check flag])
+ AC_MSG_CHECKING([whether $THIN_CHECK_CMD ($THIN_CHECK_VSN_MAJOR.$THIN_CHECK_VSN_MINOR) supports the needs-check flag])
AC_MSG_RESULT([$THIN_CHECK_NEEDS_CHECK])
AS_IF([test "$THIN_CHECK_NEEDS_CHECK" = "yes"], [
AC_DEFINE([THIN_CHECK_NEEDS_CHECK], 1, [Define to 1 if the external 'thin_check' tool requires the --clear-needs-check-flag option])
@@ -537,12 +538,13 @@ AS_CASE(["$CACHE"],
])
])
AS_IF([test "$CACHE_CHECK_NEEDS_CHECK" = "yes" && test "$CACHE_CONFIGURE_WARN" != "y"], [
- $CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
+ "$CACHE_CHECK_CMD" -V 2>/dev/null >conftest.tmp
read -r CACHE_CHECK_VSN < conftest.tmp
IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
rm -f conftest.tmp
# Require version >= 0.5.4 for --clear-needs-check-flag
+ CACHE_CHECK_VSN_MAJOR=${CACHE_CHECK_VSN_MAJOR##* }
AS_IF([test -z "$CACHE_CHECK_VSN_MAJOR" \
|| test -z "$CACHE_CHECK_VSN_MINOR" \
|| test -z "$CACHE_CHECK_VSN_PATCH"], [
@@ -590,7 +592,7 @@ AS_CASE(["$CACHE"],
])
])
- AC_MSG_CHECKING([whether cache_check supports the needs-check flag])
+ AC_MSG_CHECKING([whether $CACHE_CHECK_CMD ($CACHE_CHECK_VSN_MAJOR.$CACHE_CHECK_VSN_MINOR.$CACHE_CHECK_VSN_PATCH) supports the needs-check flag])
AC_MSG_RESULT([$CACHE_CHECK_NEEDS_CHECK])
AS_IF([test "$CACHE_CHECK_NEEDS_CHECK" = "yes"], [
AC_DEFINE([CACHE_CHECK_NEEDS_CHECK], 1, [Define to 1 if the external 'cache_check' tool requires the --clear-needs-check-flag option])
--
2.45.0

View File

@ -1,17 +0,0 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
pidfile="/run/lvmetad.pid"
command="/sbin/lvmetad"
command_args="${LVMETAD_OPTS:=-p ${pidfile}}"
start_stop_daemon_args="--pidfile ${pidfile}"
depend() {
:
}
start_pre()
{
checkpath --directory /run/lvm || return 1
}

View File

@ -1,311 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
TMPFILES_OPTIONAL=1
inherit autotools linux-info systemd toolchain-funcs tmpfiles udev flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="readline static static-libs systemd lvm2create_initrd sanlock selinux +udev +thin device-mapper-only"
REQUIRED_USE="device-mapper-only? ( !lvm2create_initrd !sanlock !thin )
static? ( !systemd !udev )
static-libs? ( !udev )
systemd? ( udev )"
DEPEND_COMMON="
dev-libs/libaio[static-libs?]
static? ( dev-libs/libaio[static-libs] )
!static? ( dev-libs/libaio[static-libs?] )
readline? ( sys-libs/readline:0= )
sanlock? ( sys-cluster/sanlock )
systemd? ( >=sys-apps/systemd-205:0= )
udev? ( >=virtual/libudev-208:= )"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
!<sys-apps/openrc-0.11
!<sys-fs/cryptsetup-1.1.2
!!sys-fs/lvm-user
>=sys-apps/util-linux-2.16
lvm2create_initrd? ( sys-apps/makedev )
!device-mapper-only? ( virtual/tmpfiles )
thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
DEPEND="${DEPEND_COMMON}
static? (
selinux? ( sys-libs/libselinux[static-libs] )
>=sys-apps/util-linux-2.16[static-libs]
)"
BDEPEND="
dev-build/autoconf-archive
virtual/pkgconfig
"
S="${WORKDIR}/${PN/lvm/LVM}.${PV}"
PATCHES=(
# Gentoo specific modification(s):
"${FILESDIR}"/${PN}-2.02.178-example.conf.in.patch
# For upstream -- review and forward:
"${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
"${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
"${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
"${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
"${FILESDIR}"/${PN}-2.02.178-asneeded.patch # -Wl,--as-needed
"${FILESDIR}"/${PN}-2.02.178-dynamic-static-ldflags.patch #332905
"${FILESDIR}"/${PN}-2.02.178-static-pkgconfig-libs.patch #370217, #439414 + blkid
"${FILESDIR}"/${PN}-2.02.176-pthread-pkgconfig.patch #492450
"${FILESDIR}"/${PN}-2.02.171-static-libm.patch #617756
"${FILESDIR}"/${PN}-2.02.166-HPPA-no-O_DIRECT.patch #657446
#"${FILESDIR}"/${PN}-2.02.145-mkdev.patch #580062 # Merged upstream
"${FILESDIR}"/${PN}-2.02.184-dmeventd-no-idle-exit.patch
#"${FILESDIR}"/${PN}-2.02.184-allow-reading-metadata-with-invalid-creation_time.patch #682380 # merged upstream
"${FILESDIR}"/${PN}-2.02.184-mksh_build.patch #686652
"${FILESDIR}"/${PN}-2.02.186-udev_remove_unsupported_option.patch #700160
"${FILESDIR}"/${PN}-2.02.145-oneshot.patch
)
pkg_setup() {
local CONFIG_CHECK="~SYSVIPC"
if use udev; then
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
if linux_config_exists; then
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
if [[ -n "${uevent_helper_path}" ]] && [[ "${uevent_helper_path}" != '""' ]]; then
ewarn "It's recommended to set an empty value to the following kernel config option:"
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
fi
fi
fi
check_extra_config
# 1. Genkernel no longer copies /sbin/lvm blindly.
if use static; then
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
elog "their static versions. If you need the static binaries,"
elog "you must append .static to the filename!"
fi
}
src_prepare() {
default
sed -i \
-e "1iAR = $(tc-getAR)" \
-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
make.tmpl.in || die #444082
sed -i -e '/FLAG/s:-O2::' configure{.ac,} || die #480212
if use udev && ! use device-mapper-only; then
sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
elog "if it was previously disabled."
fi
sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
# Don't install thin man page when not requested
if ! use thin ; then
sed -i -e 's/^\(MAN7+=.*\) $(LVMTHINMAN) \(.*\)$/\1 \2/' man/Makefile.in || die
fi
# Flatcar: The configure script tries to detect the systemd
# util dir without providing a way for us to override it, so
# modify the script.
sed -i \
-e "s#^\(systemdutildir=\).*#\1$(systemd_get_utildir)#" \
configure{.ac,} || die
eautoreconf
}
src_configure() {
filter-flags -flto
local myeconfargs=()
# Most of this package does weird stuff.
# The build options are tristate, and --without is NOT supported
# options: 'none', 'internal', 'shared'
myeconfargs+=(
$(use_enable !device-mapper-only dmfilemapd)
$(use_enable !device-mapper-only dmeventd)
$(use_enable !device-mapper-only cmdlib)
$(use_enable !device-mapper-only applib)
$(use_enable !device-mapper-only fsadm)
$(use_enable !device-mapper-only lvmetad)
$(use_enable !device-mapper-only lvmpolld)
$(usex device-mapper-only --disable-udev-systemd-background-jobs '')
# This only causes the .static versions to become available
$(usex static --enable-static_link '')
# dmeventd requires mirrors to be internal, and snapshot available
# so we cannot disable them
--with-mirrors="$(usex device-mapper-only none internal)"
--with-snapshots="$(usex device-mapper-only none internal)"
# disable O_DIRECT support on hppa, breaks pv detection (#99532)
$(usex hppa --disable-o_direct '')
)
if use thin; then
myeconfargs+=( --with-thin=internal --with-cache=internal )
local texec
for texec in check dump repair restore; do
myeconfargs+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
myeconfargs+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
done
else
myeconfargs+=( --with-thin=none --with-cache=none )
fi
myeconfargs+=( --with-clvmd=none --with-cluster=none )
myeconfargs+=(
$(use_enable readline)
$(use_enable selinux)
--enable-pkgconfig
--with-confdir="${EPREFIX}"/etc
--exec-prefix="${EPREFIX}"
--sbindir="${EPREFIX}/sbin"
--with-staticdir="${EPREFIX}"/sbin
--libdir="${EPREFIX}/$(get_libdir)"
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)"
--with-default-dm-run-dir=/run
--with-default-run-dir=/run/lvm
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
$(use_enable udev udev_rules)
$(use_enable udev udev_sync)
$(use_with udev udevdir "$(get_udevdir)"/rules.d)
$(use_enable sanlock lvmlockd-sanlock)
$(use_enable systemd udev-systemd-background-jobs)
$(use_enable systemd notify-dbus)
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
CLDFLAGS="${LDFLAGS}"
)
# Hard-wire this to bash as some shells (dash) don't know
# "-o pipefail" #682404
CONFIG_SHELL="/bin/bash" \
econf "${myeconfargs[@]}"
}
src_compile() {
pushd include >/dev/null
emake V=1
popd >/dev/null
if use device-mapper-only ; then
emake V=1 device-mapper
else
emake V=1
emake V=1 CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
fi
}
src_install() {
local inst INSTALL_TARGETS
INSTALL_TARGETS=( install install_tmpfiles_configuration )
# install systemd related files only when requested, bug #522430
use systemd && INSTALL_TARGETS+=( install_systemd_units install_systemd_generators )
use device-mapper-only && INSTALL_TARGETS=( install_device-mapper )
for inst in ${INSTALL_TARGETS[@]}; do
emake V=1 DESTDIR="${D}" ${inst}
done
newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
if use !device-mapper-only ; then
newinitd "${FILESDIR}"/dmeventd.initd-2.02.184-r2 dmeventd
newinitd "${FILESDIR}"/lvm.rc-2.02.187 lvm
newconfd "${FILESDIR}"/lvm.confd-2.02.184-r3 lvm
if ! use udev ; then
# We keep the variable but remove udev from it.
sed -r -i \
-e '/^rc_need=/s/\<udev\>//g' \
"${ED}/etc/conf.d/lvm" || die "Could not drop udev from rc_need"
fi
newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
newinitd "${FILESDIR}"/lvmpolld.initd-2.02.183 lvmpolld
fi
if use sanlock; then
newinitd "${FILESDIR}"/lvmlockd.initd-2.02.166-r1 lvmlockd
fi
if use static-libs; then
dolib.a libdm/ioctl/libdevmapper.a
if use !device-mapper-only; then
# depends on lvmetad
dolib.a libdaemon/client/libdaemonclient.a #462908
# depends on dmeventd
dolib.a daemons/dmeventd/libdevmapper-event.a
fi
else
rm -f "${ED}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
fi
if use lvm2create_initrd; then
dosbin scripts/lvm2create_initrd/lvm2create_initrd
doman scripts/lvm2create_initrd/lvm2create_initrd.8
newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
fi
insinto /etc
doins "${FILESDIR}"/dmtab
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
}
pkg_postinst() {
if ! use device-mapper-only; then
tmpfiles_process lvm2.conf
fi
if [[ -z "${REPLACING_VERSIONS}" ]]; then
# This is a new installation
ewarn "Make sure the \"lvm\" init script is in the runlevels:"
ewarn "# rc-update add lvm boot"
ewarn
ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
ewarn "to enable lvm autoactivation and metadata caching."
fi
if use udev && [[ -d /run ]] ; then
local permission_run_expected="drwxr-xr-x"
local permission_run=$(stat -c "%A" /run)
if [[ "${permission_run}" != "${permission_run_expected}" ]] ; then
ewarn "Found the following problematic permissions:"
ewarn ""
ewarn " ${permission_run} /run"
ewarn ""
ewarn "Expected:"
ewarn ""
ewarn " ${permission_run_expected} /run"
ewarn ""
ewarn "This is known to be causing problems for UDEV-enabled LVM services."
fi
fi
}
src_test() {
einfo "Tests are disabled because of device-node mucking, if you want to"
einfo "run tests, compile the package and see ${S}/tests"
}

View File

@ -0,0 +1,303 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
TMPFILES_OPTIONAL=1
inherit autotools linux-info systemd toolchain-funcs tmpfiles udev flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="https://sourceware.org/ftp/lvm2/${PN^^}.${PV}.tgz"
S="${WORKDIR}/${PN^^}.${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="lvm readline sanlock selinux static static-libs systemd thin +udev valgrind"
REQUIRED_USE="
static? ( !systemd !udev )
static-libs? ( static !udev )
systemd? ( udev )
thin? ( lvm )
"
DEPEND_COMMON="
udev? ( virtual/libudev:= )
lvm? (
dev-libs/libaio
sys-apps/util-linux
readline? ( sys-libs/readline:= )
sanlock? ( sys-cluster/sanlock )
systemd? ( sys-apps/systemd:= )
)
"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="
${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
lvm? (
virtual/tmpfiles
thin? ( <sys-block/thin-provisioning-tools-1.0.0 )
)
"
# note: thin-0.3.0 is required to avoid --disable-thin_check_needs_check
DEPEND="
${DEPEND_COMMON}
static? (
lvm? (
dev-libs/libaio[static-libs]
sys-apps/util-linux[static-libs]
readline? ( sys-libs/readline[static-libs] )
)
selinux? ( sys-libs/libselinux[static-libs] )
)
valgrind? ( >=dev-debug/valgrind-3.6 )
"
BDEPEND="
dev-build/autoconf-archive
virtual/pkgconfig
"
PATCHES=(
# Gentoo specific modification(s):
"${FILESDIR}"/${PN}-2.03.20-example.conf.in.patch
# For upstream -- review and forward:
"${FILESDIR}"/${PN}-2.03.20-dmeventd-no-idle-exit.patch
"${FILESDIR}"/${PN}-2.03.20-freopen-musl.patch
)
pkg_setup() {
local CONFIG_CHECK="~SYSVIPC"
if use udev; then
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
if linux_config_exists; then
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
if [[ -n "${uevent_helper_path}" ]] && [[ "${uevent_helper_path}" != '""' ]]; then
ewarn "It's recommended to set an empty value to the following kernel config option:"
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
fi
fi
fi
check_extra_config
# 1. Genkernel no longer copies /sbin/lvm blindly.
if use static; then
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
elog "their static versions. If you need the static binaries,"
elog "you must append .static to the filename!"
fi
}
src_prepare() {
default
# Users without systemd get no auto-activation of any logical volume
if ! use systemd ; then
eapply "${FILESDIR}"/${PN}-2.03.20-dm_lvm_rules_no_systemd.patch
fi
eautoreconf
}
src_configure() {
filter-lto
# Workaround for bug #822210
tc-ld-disable-gold
# Most of this package does weird stuff.
# The build options are tristate, and --without is NOT supported
# options: 'none', 'internal', 'shared'
local myeconfargs=(
$(use_enable lvm dmfilemapd)
$(use_enable lvm dmeventd)
$(use_enable lvm cmdlib)
$(use_enable lvm fsadm)
$(use_enable lvm lvmpolld)
# This only causes the .static versions to become available
$(usev static --enable-static_link)
# dmeventd requires mirrors to be internal, and snapshot available
# so we cannot disable them
--with-mirrors="$(usex lvm internal none)"
--with-snapshots="$(usex lvm internal none)"
)
if use lvm && use thin; then
myeconfargs+=( --with-thin=internal --with-cache=internal )
local texec
for texec in check dump repair restore; do
myeconfargs+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
myeconfargs+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
done
else
myeconfargs+=( --with-thin=none --with-cache=none )
fi
myeconfargs+=(
# musl doesn't do symbol versioning so can end up with
# runtime breakage.
--with-symvers=$(usex elibc_glibc 'gnu' 'no')
$(use_enable readline)
$(use_enable selinux)
--enable-pkgconfig
--with-confdir="${EPREFIX}"/etc
--exec-prefix="${EPREFIX}"
--sbindir="${EPREFIX}/sbin"
--with-staticdir="${EPREFIX}"/sbin
--libdir="${EPREFIX}/$(get_libdir)"
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)"
--with-default-dm-run-dir=/run
--with-default-run-dir=/run/lvm
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
$(use_enable udev udev_rules)
$(use_enable udev udev_sync)
$(use_with udev udevdir "${EPREFIX}$(get_udevdir)"/rules.d)
# USE=sanlock requires USE=lvm
$(use_enable $(usex lvm sanlock lvm) lvmlockd-sanlock)
$(use_enable systemd notify-dbus)
$(use_enable systemd app-machineid)
$(use_enable systemd systemd-journal)
$(use_with systemd systemd-run "/usr/bin/systemd-run")
$(use_enable valgrind valgrind-pool)
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
CLDFLAGS="${LDFLAGS}"
)
econf "${myeconfargs[@]}"
}
src_compile() {
emake V=1 -C include
if use lvm ; then
emake V=1
emake V=1 CC="$(tc-getCC)" -C scripts
else
emake V=1 device-mapper
# https://bugs.gentoo.org/878131
emake V=1 -C libdm/dm-tools device-mapper
fi
}
src_test() {
einfo "Tests are disabled because of device-node mucking, if you want to"
einfo "run tests, compile the package and see ${S}/tests"
}
src_install() {
local INSTALL_TARGETS=(
# full LVM2
$(usev lvm "install install_tmpfiles_configuration")
# install systemd related files only when requested, bug #522430
$(usev $(usex lvm systemd lvm) "SYSTEMD_GENERATOR_DIR=$(systemd_get_systemgeneratordir) \
install_systemd_units install_systemd_generators")
# install dm unconditionally
install_device-mapper
)
emake V=1 DESTDIR="${D}" "${INSTALL_TARGETS[@]}"
newinitd "${FILESDIR}"/device-mapper.rc-r3 device-mapper
newconfd "${FILESDIR}"/device-mapper.conf-r4 device-mapper
if use lvm ; then
newinitd "${FILESDIR}"/dmeventd.initd-r3 dmeventd
newinitd "${FILESDIR}"/lvm.rc-r1 lvm
newconfd "${FILESDIR}"/lvm.confd-r4 lvm
if ! use udev ; then
# We keep the variable but remove udev from it.
sed -r -i \
-e '/^rc_need=/s/\<udev\>//g' \
"${ED}"/etc/conf.d/lvm || die "Could not drop udev from rc_need"
fi
newinitd "${FILESDIR}"/lvm-monitoring.initd-r3 lvm-monitoring
newinitd "${FILESDIR}"/lvmpolld.initd-r1 lvmpolld
if use sanlock; then
newinitd "${FILESDIR}"/lvmlockd.initd-r2 lvmlockd
fi
fi
if use static-libs; then
dolib.a libdm/ioctl/libdevmapper.a
if use lvm; then
# depends on lvmetad
dolib.a libdaemon/client/libdaemonclient.a #462908
# depends on dmeventd
dolib.a daemons/dmeventd/libdevmapper-event.a
fi
else
rm -f "${ED}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a || die
fi
insinto /etc
doins "${FILESDIR}"/dmtab
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
}
pkg_preinst() {
HAD_LVM=0
if has_version 'sys-fs/lvm2[lvm(+)]' ; then
HAD_LVM=1
fi
}
pkg_postinst() {
use lvm && tmpfiles_process lvm2.conf
use udev && udev_reload
# This is a new installation
if [[ -z "${REPLACING_VERSIONS}" ]]; then
if use lvm ; then
ewarn "Make sure the \"lvm\" init script is in the runlevels:"
ewarn "# rc-update add lvm boot"
ewarn
ewarn "Make sure to enable lvmetad in ${EROOT}/etc/lvm/lvm.conf if you want"
ewarn "to enable lvm autoactivation and metadata caching."
else
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
fi
else
if ! use lvm && [[ ${HAD_LVM} -eq 1 ]] ; then
ewarn "LVM was previously enabled but is now disabled."
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
ewarn "See the 2022-11-19-lvm2-default-USE-flags news item for more details."
fi
fi
if use udev && [[ -d /run ]] ; then
local permission_run_expected="drwxr-xr-x"
local permission_run=$(stat -c "%A" /run)
if [[ "${permission_run}" != "${permission_run_expected}" ]] ; then
ewarn "Found the following problematic permissions:"
ewarn ""
ewarn " ${permission_run} /run"
ewarn ""
ewarn "Expected:"
ewarn ""
ewarn " ${permission_run_expected} /run"
ewarn ""
ewarn "This is known to cause problems for udev-enabled LVM services."
fi
fi
}
pkg_postrm() {
if use udev && [[ -z ${REPLACED_BY_VERSION} ]]; then
udev_reload
fi
}

View File

@ -0,0 +1,304 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
TMPFILES_OPTIONAL=1
inherit autotools linux-info systemd toolchain-funcs tmpfiles udev flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="https://sourceware.org/ftp/lvm2/${PN^^}.${PV}.tgz"
S="${WORKDIR}/${PN^^}.${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="lvm readline sanlock selinux static static-libs systemd thin +udev valgrind"
REQUIRED_USE="
static? ( !systemd !udev )
static-libs? ( static !udev )
systemd? ( udev )
thin? ( lvm )
"
DEPEND_COMMON="
udev? ( virtual/libudev:= )
lvm? (
dev-libs/libaio
sys-apps/util-linux
readline? ( sys-libs/readline:= )
sanlock? ( sys-cluster/sanlock )
systemd? ( sys-apps/systemd:= )
)
"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="
${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
lvm? (
virtual/tmpfiles
thin? ( <sys-block/thin-provisioning-tools-1.0.0 )
)
"
# note: thin-0.3.0 is required to avoid --disable-thin_check_needs_check
DEPEND="
${DEPEND_COMMON}
static? (
lvm? (
dev-libs/libaio[static-libs]
sys-apps/util-linux[static-libs]
readline? ( sys-libs/readline[static-libs] )
)
selinux? ( sys-libs/libselinux[static-libs] )
)
valgrind? ( >=dev-debug/valgrind-3.6 )
"
BDEPEND="
dev-build/autoconf-archive
virtual/pkgconfig
"
PATCHES=(
# Gentoo specific modification(s):
"${FILESDIR}"/${PN}-2.03.20-example.conf.in.patch
# For upstream -- review and forward:
"${FILESDIR}"/${PN}-2.03.20-dmeventd-no-idle-exit.patch
"${FILESDIR}"/${PN}-2.03.20-freopen-musl.patch
"${FILESDIR}"/${PN}-2.03.22-autoconf-2.72-egrep.patch
)
pkg_setup() {
local CONFIG_CHECK="~SYSVIPC"
if use udev; then
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
if linux_config_exists; then
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
if [[ -n "${uevent_helper_path}" ]] && [[ "${uevent_helper_path}" != '""' ]]; then
ewarn "It's recommended to set an empty value to the following kernel config option:"
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
fi
fi
fi
check_extra_config
# 1. Genkernel no longer copies /sbin/lvm blindly.
if use static; then
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
elog "their static versions. If you need the static binaries,"
elog "you must append .static to the filename!"
fi
}
src_prepare() {
default
# Users without systemd get no auto-activation of any logical volume
if ! use systemd ; then
eapply "${FILESDIR}"/${PN}-2.03.20-dm_lvm_rules_no_systemd.patch
fi
eautoreconf
}
src_configure() {
filter-lto
# Workaround for bug #822210
tc-ld-disable-gold
# Most of this package does weird stuff.
# The build options are tristate, and --without is NOT supported
# options: 'none', 'internal', 'shared'
local myeconfargs=(
$(use_enable lvm dmfilemapd)
$(use_enable lvm dmeventd)
$(use_enable lvm cmdlib)
$(use_enable lvm fsadm)
$(use_enable lvm lvmpolld)
# This only causes the .static versions to become available
$(usev static --enable-static_link)
# dmeventd requires mirrors to be internal, and snapshot available
# so we cannot disable them
--with-mirrors="$(usex lvm internal none)"
--with-snapshots="$(usex lvm internal none)"
)
if use lvm && use thin; then
myeconfargs+=( --with-thin=internal --with-cache=internal )
local texec
for texec in check dump repair restore; do
myeconfargs+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
myeconfargs+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
done
else
myeconfargs+=( --with-thin=none --with-cache=none )
fi
myeconfargs+=(
# musl doesn't do symbol versioning so can end up with
# runtime breakage.
--with-symvers=$(usex elibc_glibc 'gnu' 'no')
$(use_enable readline)
$(use_enable selinux)
--enable-pkgconfig
--with-confdir="${EPREFIX}"/etc
--exec-prefix="${EPREFIX}"
--sbindir="${EPREFIX}/sbin"
--with-staticdir="${EPREFIX}"/sbin
--libdir="${EPREFIX}/$(get_libdir)"
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)"
--with-default-dm-run-dir=/run
--with-default-run-dir=/run/lvm
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
$(use_enable udev udev_rules)
$(use_enable udev udev_sync)
$(use_with udev udevdir "${EPREFIX}$(get_udevdir)"/rules.d)
# USE=sanlock requires USE=lvm
$(use_enable $(usex lvm sanlock lvm) lvmlockd-sanlock)
$(use_enable systemd notify-dbus)
$(use_enable systemd app-machineid)
$(use_enable systemd systemd-journal)
$(use_with systemd systemd-run "/usr/bin/systemd-run")
$(use_enable valgrind valgrind-pool)
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
CLDFLAGS="${LDFLAGS}"
)
econf "${myeconfargs[@]}"
}
src_compile() {
emake V=1 -C include
if use lvm ; then
emake V=1
emake V=1 CC="$(tc-getCC)" -C scripts
else
emake V=1 device-mapper
# https://bugs.gentoo.org/878131
emake V=1 -C libdm/dm-tools device-mapper
fi
}
src_test() {
einfo "Tests are disabled because of device-node mucking, if you want to"
einfo "run tests, compile the package and see ${S}/tests"
}
src_install() {
local targets=()
if use lvm; then
targets+=( install install_tmpfiles_configuration )
if use systemd; then
# install systemd related files only when requested, bug #522430
targets+=( install_systemd_units )
fi
else
targets+=( install_device-mapper )
fi
emake V=1 DESTDIR="${D}" "${targets[@]}"
newinitd "${FILESDIR}"/device-mapper.rc-r3 device-mapper
newconfd "${FILESDIR}"/device-mapper.conf-r4 device-mapper
if use lvm ; then
newinitd "${FILESDIR}"/dmeventd.initd-r3 dmeventd
newinitd "${FILESDIR}"/lvm.rc-r1 lvm
newconfd "${FILESDIR}"/lvm.confd-r4 lvm
if ! use udev ; then
# We keep the variable but remove udev from it.
sed -r -i \
-e '/^rc_need=/s/\<udev\>//g' \
"${ED}"/etc/conf.d/lvm || die "Could not drop udev from rc_need"
fi
newinitd "${FILESDIR}"/lvm-monitoring.initd-r3 lvm-monitoring
newinitd "${FILESDIR}"/lvmpolld.initd-r1 lvmpolld
if use sanlock; then
newinitd "${FILESDIR}"/lvmlockd.initd-r2 lvmlockd
fi
fi
if use static-libs; then
dolib.a libdm/ioctl/libdevmapper.a
if use lvm; then
# depends on lvmetad
dolib.a libdaemon/client/libdaemonclient.a #462908
# depends on dmeventd
dolib.a daemons/dmeventd/libdevmapper-event.a
fi
else
rm -f "${ED}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a || die
fi
insinto /etc
doins "${FILESDIR}"/dmtab
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
}
pkg_preinst() {
HAD_LVM=0
if has_version 'sys-fs/lvm2[lvm(+)]' ; then
HAD_LVM=1
fi
}
pkg_postinst() {
use lvm && tmpfiles_process lvm2.conf
use udev && udev_reload
# This is a new installation
if [[ -z "${REPLACING_VERSIONS}" ]]; then
if use lvm ; then
ewarn "Make sure the \"lvm\" init script is in the runlevels:"
ewarn "# rc-update add lvm boot"
ewarn
ewarn "Make sure to enable lvmetad in ${EROOT}/etc/lvm/lvm.conf if you want"
ewarn "to enable lvm autoactivation and metadata caching."
else
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
fi
else
if ! use lvm && [[ ${HAD_LVM} -eq 1 ]] ; then
ewarn "LVM was previously enabled but is now disabled."
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
ewarn "See the 2022-11-19-lvm2-default-USE-flags news item for more details."
fi
fi
if use udev && [[ -d /run ]] ; then
local permission_run_expected="drwxr-xr-x"
local permission_run=$(stat -c "%A" /run)
if [[ "${permission_run}" != "${permission_run_expected}" ]] ; then
ewarn "Found the following problematic permissions:"
ewarn ""
ewarn " ${permission_run} /run"
ewarn ""
ewarn "Expected:"
ewarn ""
ewarn " ${permission_run_expected} /run"
ewarn ""
ewarn "This is known to cause problems for udev-enabled LVM services."
fi
fi
}
pkg_postrm() {
if use udev && [[ -z ${REPLACED_BY_VERSION} ]]; then
udev_reload
fi
}

View File

@ -0,0 +1,317 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
TMPFILES_OPTIONAL=1
inherit autotools linux-info systemd toolchain-funcs tmpfiles udev flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="https://sourceware.org/ftp/lvm2/${PN^^}.${PV}.tgz"
S="${WORKDIR}/${PN^^}.${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="lvm readline sanlock selinux static static-libs systemd thin +udev valgrind"
REQUIRED_USE="
static? ( !systemd !udev )
static-libs? ( static !udev )
systemd? ( udev )
thin? ( lvm )
"
DEPEND_COMMON="
udev? ( virtual/libudev:= )
lvm? (
dev-libs/libaio
sys-apps/util-linux
readline? ( sys-libs/readline:= )
sanlock? ( sys-cluster/sanlock )
systemd? ( sys-apps/systemd:= )
)
"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="
${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
lvm? ( virtual/tmpfiles )
"
PDEPEND="
lvm? (
thin? ( >=sys-block/thin-provisioning-tools-1.0.6 )
)
"
# note: thin-0.3.0 is required to avoid --disable-thin_check_needs_check
DEPEND="
${DEPEND_COMMON}
static? (
sys-apps/util-linux[static-libs]
lvm? (
dev-libs/libaio[static-libs]
readline? ( sys-libs/readline[static-libs] )
)
selinux? ( sys-libs/libselinux[static-libs] )
)
valgrind? ( >=dev-debug/valgrind-3.6 )
"
BDEPEND="
dev-build/autoconf-archive
virtual/pkgconfig
"
PATCHES=(
# Gentoo specific modification(s):
"${FILESDIR}"/${PN}-2.03.20-example.conf.in.patch
# For upstream -- review and forward:
"${FILESDIR}"/${PN}-2.03.20-dmeventd-no-idle-exit.patch
"${FILESDIR}"/${PN}-2.03.20-freopen-musl.patch
"${FILESDIR}"/${PN}-2.03.22-autoconf-2.72-egrep.patch
"${FILESDIR}"/${PN}-2.03.22-thin-version-checking.patch
"${FILESDIR}"/${PN}-2.03.22-thin-autodetect.patch
"${FILESDIR}"/${PN}-2.03.22-basename-musl.patch
)
pkg_setup() {
local CONFIG_CHECK="~SYSVIPC"
if use udev; then
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
if linux_config_exists; then
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
if [[ -n "${uevent_helper_path}" ]] && [[ "${uevent_helper_path}" != '""' ]]; then
ewarn "It's recommended to set an empty value to the following kernel config option:"
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
fi
fi
fi
check_extra_config
# 1. Genkernel no longer copies /sbin/lvm blindly.
if use static; then
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
elog "their static versions. If you need the static binaries,"
elog "you must append .static to the filename!"
fi
}
src_prepare() {
default
# Users without systemd get no auto-activation of any logical volume
if ! use systemd ; then
eapply "${FILESDIR}"/${PN}-2.03.20-dm_lvm_rules_no_systemd.patch
fi
eautoreconf
}
src_configure() {
filter-lto
# Workaround for bug #822210
tc-ld-disable-gold
# Most of this package does weird stuff.
# The build options are tristate, and --without is NOT supported
# options: 'none', 'internal', 'shared'
local myeconfargs=(
$(use_enable lvm dmfilemapd)
$(use_enable lvm dmeventd)
$(use_enable lvm cmdlib)
$(use_enable lvm fsadm)
$(use_enable lvm lvmpolld)
# This only causes the .static versions to become available
$(usev static --enable-static_link)
# dmeventd requires mirrors to be internal, and snapshot available
# so we cannot disable them
--with-mirrors="$(usex lvm internal none)"
--with-snapshots="$(usex lvm internal none)"
)
if use lvm && use thin; then
myeconfargs+=(
--with-thin=internal
--enable-thin_check_needs_check
--with-cache=internal
--enable-cache_check_needs_check
)
local texec
for texec in check dump repair restore; do
myeconfargs+=( --with-thin-${texec}="${EPREFIX}"/usr/sbin/thin_${texec} )
myeconfargs+=( --with-cache-${texec}="${EPREFIX}"/usr/sbin/cache_${texec} )
done
else
myeconfargs+=( --with-thin=none --with-cache=none )
fi
myeconfargs+=(
# musl doesn't do symbol versioning so can end up with
# runtime breakage.
--with-symvers=$(usex elibc_glibc 'gnu' 'no')
$(use_enable readline)
$(use_enable selinux)
--enable-pkgconfig
--with-confdir="${EPREFIX}"/etc
--exec-prefix="${EPREFIX}"
--sbindir="${EPREFIX}/sbin"
--with-staticdir="${EPREFIX}"/sbin
--libdir="${EPREFIX}/$(get_libdir)"
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)"
--with-default-dm-run-dir=/run
--with-default-run-dir=/run/lvm
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
$(use_enable udev udev_rules)
$(use_enable udev udev_sync)
$(use_with udev udevdir "${EPREFIX}$(get_udevdir)"/rules.d)
# USE=sanlock requires USE=lvm
$(use_enable $(usex lvm sanlock lvm) lvmlockd-sanlock)
$(use_enable systemd notify-dbus)
$(use_enable systemd app-machineid)
$(use_enable systemd systemd-journal)
$(use_with systemd systemd-run "/usr/bin/systemd-run")
$(use_enable valgrind valgrind-pool)
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
CLDFLAGS="${LDFLAGS}"
)
econf "${myeconfargs[@]}"
}
src_compile() {
emake V=1 -C include
if use lvm ; then
emake V=1
emake V=1 CC="$(tc-getCC)" -C scripts
else
emake V=1 device-mapper
# https://bugs.gentoo.org/878131
emake V=1 -C libdm/dm-tools device-mapper
fi
}
src_test() {
einfo "Tests are disabled because of device-node mucking, if you want to"
einfo "run tests, compile the package and see ${S}/tests"
}
src_install() {
local targets=()
if use lvm; then
targets+=( install install_tmpfiles_configuration )
if use systemd; then
# install systemd related files only when requested, bug #522430
targets+=( install_systemd_units )
fi
else
targets+=( install_device-mapper )
fi
# -j1 for bug #918125
emake -j1 V=1 DESTDIR="${D}" "${targets[@]}"
newinitd "${FILESDIR}"/device-mapper.rc-r3 device-mapper
newconfd "${FILESDIR}"/device-mapper.conf-r4 device-mapper
if use lvm ; then
newinitd "${FILESDIR}"/dmeventd.initd-r3 dmeventd
newinitd "${FILESDIR}"/lvm.rc-r1 lvm
newconfd "${FILESDIR}"/lvm.confd-r4 lvm
if ! use udev ; then
# We keep the variable but remove udev from it.
sed -r -i \
-e '/^rc_need=/s/\<udev\>//g' \
"${ED}"/etc/conf.d/lvm || die "Could not drop udev from rc_need"
fi
newinitd "${FILESDIR}"/lvm-monitoring.initd-r3 lvm-monitoring
newinitd "${FILESDIR}"/lvmpolld.initd-r1 lvmpolld
if use sanlock; then
newinitd "${FILESDIR}"/lvmlockd.initd-r2 lvmlockd
fi
fi
if use static-libs; then
dolib.a libdm/ioctl/libdevmapper.a
if use lvm; then
# depends on lvmetad
dolib.a libdaemon/client/libdaemonclient.a #462908
# depends on dmeventd
dolib.a daemons/dmeventd/libdevmapper-event.a
fi
else
rm -f "${ED}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a || die
fi
insinto /etc
doins "${FILESDIR}"/dmtab
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
}
pkg_preinst() {
HAD_LVM=0
if has_version 'sys-fs/lvm2[lvm(+)]' ; then
HAD_LVM=1
fi
}
pkg_postinst() {
use lvm && tmpfiles_process lvm2.conf
use udev && udev_reload
# This is a new installation
if [[ -z "${REPLACING_VERSIONS}" ]]; then
if use lvm ; then
ewarn "Make sure the \"lvm\" init script is in the runlevels:"
ewarn "# rc-update add lvm boot"
ewarn
ewarn "Make sure to enable lvmetad in ${EROOT}/etc/lvm/lvm.conf if you want"
ewarn "to enable lvm autoactivation and metadata caching."
else
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
fi
else
if ! use lvm && [[ ${HAD_LVM} -eq 1 ]] ; then
ewarn "LVM was previously enabled but is now disabled."
ewarn "Please enable USE=lvm if you need the LVM daemon and"
ewarn "tools like 'lvchange', 'vgchange', etc!"
ewarn "See the 2022-11-19-lvm2-default-USE-flags news item for more details."
fi
fi
if use udev && [[ -d /run ]] ; then
local permission_run_expected="drwxr-xr-x"
local permission_run=$(stat -c "%A" /run)
if [[ "${permission_run}" != "${permission_run_expected}" ]] ; then
ewarn "Found the following problematic permissions:"
ewarn ""
ewarn " ${permission_run} /run"
ewarn ""
ewarn "Expected:"
ewarn ""
ewarn " ${permission_run_expected} /run"
ewarn ""
ewarn "This is known to cause problems for udev-enabled LVM services."
fi
fi
}
pkg_postrm() {
if use udev && [[ -z ${REPLACED_BY_VERSION} ]]; then
udev_reload
fi
}

View File

@ -5,22 +5,18 @@
<email>base-system@gentoo.org</email> <email>base-system@gentoo.org</email>
<name>Gentoo Base System</name> <name>Gentoo Base System</name>
</maintainer> </maintainer>
<maintainer type="person">
<email>robbat2@gentoo.org</email>
<name>Robin H. Johnson</name>
</maintainer>
<maintainer type="person" proxied="yes">
<email>agk@redhat.com</email>
<name>Alasdair Kergon</name>
<description>Upstream Maintainer (please CC on bugs)</description>
</maintainer>
<use> <use>
<flag name="lvm2create_initrd">Install lvm2create_initrd script and pull in <pkg>sys-apps/makedev</pkg> for the /sbin/MAKEDEV command</flag>
<flag name="thin">Support for thin volumes</flag> <flag name="thin">Support for thin volumes</flag>
<flag name="device-mapper-only">Build only device-mapper and not the rest of LVM2 (UNSUPPORTED)</flag> <flag name="lvm">
Build all of LVM2 including daemons and tools like lvchange, not just the device-mapper library (for other packages to use).
If your system uses LVM2 for managing disks and partitions, enable this flag.
</flag>
<flag name="sanlock">Enable lvmlockd with support for sanlock</flag> <flag name="sanlock">Enable lvmlockd with support for sanlock</flag>
</use> </use>
<upstream> <upstream>
<remote-id type="cpe">cpe:/a:heinz_mauelshagen:lvm2</remote-id> <remote-id type="cpe">cpe:/a:heinz_mauelshagen:lvm2</remote-id>
<remote-id type="github">lvmteam/lvm2</remote-id>
<remote-id type="gitlab">lvmteam/lvm2</remote-id>
</upstream> </upstream>
</pkgmetadata> </pkgmetadata>