summaryrefslogtreecommitdiff
path: root/repo/lvm2
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-15 20:02:02 +0100
committerdavidovski <david@davidovski.xyz>2022-06-15 20:02:02 +0100
commitd2567bfbdf0e9fa6db0a6ed1534831ec859a3e03 (patch)
tree684a17eebf446aa1adab1097616f1882c8d51568 /repo/lvm2
parentd1fc3393cca72e8e432f827f7624e38734fad6dc (diff)
added deps for qemu
Diffstat (limited to 'repo/lvm2')
-rw-r--r--repo/lvm2/device-mapper-udev.post-install6
-rw-r--r--repo/lvm2/device-mapper-udev.post-upgrade6
-rw-r--r--repo/lvm2/device-mapper.xibuild17
-rw-r--r--repo/lvm2/dmeventd.initd26
-rw-r--r--repo/lvm2/fix-stdio-usage.patch49
-rw-r--r--repo/lvm2/library_dir-default-config.patch10
-rw-r--r--repo/lvm2/lvm.confd5
-rw-r--r--repo/lvm2/lvm.initd38
-rw-r--r--repo/lvm2/lvm2.xibuild65
-rw-r--r--repo/lvm2/mallinfo.patch11
-rw-r--r--repo/lvm2/mlockall-default-config.patch22
11 files changed, 255 insertions, 0 deletions
diff --git a/repo/lvm2/device-mapper-udev.post-install b/repo/lvm2/device-mapper-udev.post-install
new file mode 100644
index 0000000..95a3590
--- /dev/null
+++ b/repo/lvm2/device-mapper-udev.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+udevadm control --reload-rules
+udevadm trigger
+
+exit 0
diff --git a/repo/lvm2/device-mapper-udev.post-upgrade b/repo/lvm2/device-mapper-udev.post-upgrade
new file mode 100644
index 0000000..95a3590
--- /dev/null
+++ b/repo/lvm2/device-mapper-udev.post-upgrade
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+udevadm control --reload-rules
+udevadm trigger
+
+exit 0
diff --git a/repo/lvm2/device-mapper.xibuild b/repo/lvm2/device-mapper.xibuild
new file mode 100644
index 0000000..ed259e6
--- /dev/null
+++ b/repo/lvm2/device-mapper.xibuild
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+DESC="Device mapper userspace library and tools from LVM2"
+DEPS="lvm2"
+
+package () {
+ install -Dm755 "$BUILD_ROOT"/dmeventd.initd "$PKG_DEST"/etc/init.d/dmeventd
+
+ add_from_main sbin/dmeventd
+ add_from_main "usr/lib/libdevmapper.a"
+ add_from_main "lib/libdevmapper-event.so.*"
+ add_from_main "sbin/dm*"
+ add_from_main "usr/sbin/dm*"
+ add_from_main "lib/libdevmapper.so.*"
+ rm -f "$PKG_DEST"/usr/sbin/dmstats
+
+}
diff --git a/repo/lvm2/dmeventd.initd b/repo/lvm2/dmeventd.initd
new file mode 100644
index 0000000..c46f8ba
--- /dev/null
+++ b/repo/lvm2/dmeventd.initd
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1,v 1.3 2014/02/08 21:17:46 robbat2 Exp $
+
+PIDFILE=/run/dmeventd.pid
+BIN=/sbin/dmeventd
+
+depend() {
+ # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
+ # means dmeventd is NOT notified, as it cannot be safely running
+ after lvm device-mapper
+}
+
+start() {
+ ebegin "Starting dmeventd"
+ start-stop-daemon --start --exec $BIN --pidfile $PIDFILE
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping dmeventd"
+ start-stop-daemon --stop --exec $BIN --pidfile $PIDFILE
+ eend $?
+}
+
diff --git a/repo/lvm2/fix-stdio-usage.patch b/repo/lvm2/fix-stdio-usage.patch
new file mode 100644
index 0000000..5ac99fd
--- /dev/null
+++ b/repo/lvm2/fix-stdio-usage.patch
@@ -0,0 +1,49 @@
+--- ./tools/lvmcmdline.c
++++ ./tools/lvmcmdline.c
+@@ -1252,7 +1252,7 @@
+ 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
+@@ -1262,7 +1262,7 @@
+ }
+
+ 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 */
+@@ -1270,7 +1270,7 @@
+ }
+
+ 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;
+--- ./lib/commands/toolcontext.c
++++ ./lib/commands/toolcontext.c
+@@ -1869,7 +1869,7 @@
+ /* FIXME Make this configurable? */
+ reset_lvm_errno(1);
+
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ /* Set in/out stream buffering before glibc */
+ if (set_buffering
+ #ifdef SYS_gettid
+@@ -2274,7 +2274,7 @@
+
+ if (cmd->pending_delete_mem)
+ dm_pool_destroy(cmd->pending_delete_mem);
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ if (cmd->linebuffer) {
+ /* Reset stream buffering to defaults */
+ if (is_valid_fd(STDIN_FILENO) &&
diff --git a/repo/lvm2/library_dir-default-config.patch b/repo/lvm2/library_dir-default-config.patch
new file mode 100644
index 0000000..6e3b958
--- /dev/null
+++ b/repo/lvm2/library_dir-default-config.patch
@@ -0,0 +1,10 @@
+--- ./conf/example.conf.in.orig
++++ ./conf/example.conf.in
+@@ -694,6 +694,7 @@
+ # Configuration option global/library_dir.
+ # Search this directory first for shared libraries.
+ # This configuration option does not have a default value defined.
++ library_dir="/lib/device-mapper"
+
+ # Configuration option global/locking_library.
+ # The external locking library to use for locking_type 2.
diff --git a/repo/lvm2/lvm.confd b/repo/lvm2/lvm.confd
new file mode 100644
index 0000000..9d150f6
--- /dev/null
+++ b/repo/lvm2/lvm.confd
@@ -0,0 +1,5 @@
+# LVM should normally only be started after mdadm-raid is available
+# this is because LVM physical volumes are very often MD devices.
+
+rc_after="mdadm-raid"
+
diff --git a/repo/lvm2/lvm.initd b/repo/lvm2/lvm.initd
new file mode 100644
index 0000000..db6adbe
--- /dev/null
+++ b/repo/lvm2/lvm.initd
@@ -0,0 +1,38 @@
+#!/sbin/openrc-run
+
+depend() {
+ before checkfs fsck swap
+ after hwdrivers modules device-mapper
+}
+
+dm_in_proc() {
+ local rc=0 i=
+ for i in devices misc; do
+ grep -qs 'device-mapper' /proc/$i
+ rc=$(($rc + $?))
+ done
+ return $rc
+}
+
+start() {
+ local rc=0 msg=
+ ebegin "Setting up the Logical Volume Manager"
+ if [ -e /proc/modules ] && ! dm_in_proc; then
+ modprobe dm-mod 2>/dev/null
+ fi
+ if [ -d /proc/lvm ] || dm_in_proc; then
+ vgscan --mknodes --ignorelockingfailure >/dev/null 2>&1
+ vgchange --sysinit --activate y >/dev/null 2>&1
+ rc=$?
+ else
+ rc=1
+ fi
+ eend $rc
+}
+
+stop() {
+ ebegin "Shutting down the Logical Volume Manager"
+ vgchange --ignorelockingfailure -a n >/dev/null 2>&1
+ eend $?
+}
+
diff --git a/repo/lvm2/lvm2.xibuild b/repo/lvm2/lvm2.xibuild
new file mode 100644
index 0000000..1d7f0bd
--- /dev/null
+++ b/repo/lvm2/lvm2.xibuild
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+NAME="lvm2"
+DESC="Logical Volume Manager 2 utilities"
+
+MAKEDEPS="linux-headers libaio util-linux"
+
+PKG_VER=2.02.187
+SOURCE="https://mirrors.kernel.org/sourceware/lvm2/LVM2.$PKG_VER.tgz"
+
+ADDITIONAL="
+dmeventd.initd
+fix-stdio-usage.patch
+library_dir-default-config.patch
+lvm.confd
+lvm.initd
+mallinfo.patch
+mlockall-default-config.patch
+"
+
+prepare() {
+ apply_patches
+ sed -i "s/fmt -1/fmt/" make.tmpl.in
+ sed -i "s/@MKDIR_P@/mkdir -p/" make.tmpl.in
+ sed -i "s/@INSTALL@/install/" make.tmpl.in
+ sed -i "s/\$(INSTALL) -p/\$(INSTALL)/" make.tmpl.in
+ autoreconf -vif
+}
+
+build() {
+ # during cross-compilation malloc test goes wrong
+ export ac_cv_func_malloc_0_nonnull=yes
+ export ac_cv_func_realloc_0_nonnull=yes
+
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --libdir=/lib \
+ --sbindir=/sbin \
+ --localstatedir=/var \
+ --disable-nls \
+ --disable-readline \
+ --enable-pkgconfig \
+ --enable-applib \
+ --with-thin=internal \
+ --enable-dmeventd \
+ --enable-cmdlib \
+ --with-thin-check=/sbin/thin_check \
+ --with-thin-dump=/sbin/thin_dump \
+ --with-thin-repair=/sbin/thin_repair \
+ --with-dmeventd-path=/sbin/dmeventd \
+ --enable-udev_rules \
+ CLDFLAGS="$LDFLAGS" \
+ SHELL="/bin/bash"
+ make
+}
+
+package() {
+ make DESTDIR="$PKG_DEST" install || return 1
+ install -d "$PKG_DEST"/etc/lvm/archive "$PKG_DEST"/etc/lvm/backup
+ install -Dm755 "$BUILD_ROOT"/lvm.initd "$PKG_DEST"/etc/init.d/lvm
+ install -Dm644 "$BUILD_ROOT"/lvm.confd "$PKG_DEST"/etc/conf.d/lvm
+ install -Dm644 "$BUILD_ROOT"/lvm.confd "$PKG_DEST"/etc/conf.d/lvm
+ ln -s libdevmapper.so.1.02 "$PKG_DEST"/lib/libdevmapper.so
+}
diff --git a/repo/lvm2/mallinfo.patch b/repo/lvm2/mallinfo.patch
new file mode 100644
index 0000000..471a6b2
--- /dev/null
+++ b/repo/lvm2/mallinfo.patch
@@ -0,0 +1,11 @@
+--- ./lib/mm/memlock.c.orig 2015-03-09 11:18:41.560028850 -0100
++++ ./lib/mm/memlock.c 2015-03-09 11:19:54.504373309 -0100
+@@ -137,7 +137,7 @@
+
+ static void _allocate_memory(void)
+ {
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ void *stack_mem;
+ struct rlimit limit;
+ int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
diff --git a/repo/lvm2/mlockall-default-config.patch b/repo/lvm2/mlockall-default-config.patch
new file mode 100644
index 0000000..305ddee
--- /dev/null
+++ b/repo/lvm2/mlockall-default-config.patch
@@ -0,0 +1,22 @@
+--- ./conf/example.conf.in.orig
++++ ./conf/example.conf.in
+@@ -1352,7 +1352,7 @@
+ # Use the old behavior of mlockall to pin all memory.
+ # Prior to version 2.02.62, LVM used mlockall() to pin the whole
+ # process's memory while activating devices.
+- use_mlockall = 0
++ use_mlockall = 1
+
+ # Configuration option activation/monitoring.
+ # Monitor LVs that are activated.
+--- ./lib/config/defaults.h.orig
++++ ./lib/config/defaults.h
+@@ -55,7 +55,7 @@
+ #define DEFAULT_LVMLOCKD_LOCK_RETRIES 3
+ #define DEFAULT_LVMETAD_UPDATE_WAIT_TIME 10
+ #define DEFAULT_PRIORITISE_WRITE_LOCKS 1
+-#define DEFAULT_USE_MLOCKALL 0
++#define DEFAULT_USE_MLOCKALL 1
+ #define DEFAULT_METADATA_READ_ONLY 0
+ #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
+ #define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]"