diff options
Diffstat (limited to 'skip/lvm2')
-rw-r--r-- | skip/lvm2/device-mapper.xibuild | 11 | ||||
-rw-r--r-- | skip/lvm2/dmeventd.initd | 26 | ||||
-rw-r--r-- | skip/lvm2/fix-stdio-usage.patch | 49 | ||||
-rw-r--r-- | skip/lvm2/lvm.confd | 5 | ||||
-rw-r--r-- | skip/lvm2/lvm.initd | 38 | ||||
-rw-r--r-- | skip/lvm2/lvm2.xibuild | 54 | ||||
-rw-r--r-- | skip/lvm2/mallinfo.patch | 11 | ||||
-rw-r--r-- | skip/lvm2/mlockall-default-config.patch | 22 |
8 files changed, 216 insertions, 0 deletions
diff --git a/skip/lvm2/device-mapper.xibuild b/skip/lvm2/device-mapper.xibuild new file mode 100644 index 0000000..8db667b --- /dev/null +++ b/skip/lvm2/device-mapper.xibuild @@ -0,0 +1,11 @@ +#!/bin/sh +DESC="Device-mapper event daemon" + +package() { + install -Dm755 dmeventd.initd "$PKG_DEST"/etc/init.d/dmeventd + + add_from_main sbin/dmeventd + add_from_main usr/lib/libdevmapper.a "sbin/dm*" + add_from_main lib/libdevmapper* +} + diff --git a/skip/lvm2/dmeventd.initd b/skip/lvm2/dmeventd.initd new file mode 100644 index 0000000..c46f8ba --- /dev/null +++ b/skip/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/skip/lvm2/fix-stdio-usage.patch b/skip/lvm2/fix-stdio-usage.patch new file mode 100644 index 0000000..5ac99fd --- /dev/null +++ b/skip/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/skip/lvm2/lvm.confd b/skip/lvm2/lvm.confd new file mode 100644 index 0000000..9d150f6 --- /dev/null +++ b/skip/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/skip/lvm2/lvm.initd b/skip/lvm2/lvm.initd new file mode 100644 index 0000000..db6adbe --- /dev/null +++ b/skip/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/skip/lvm2/lvm2.xibuild b/skip/lvm2/lvm2.xibuild new file mode 100644 index 0000000..ce24b17 --- /dev/null +++ b/skip/lvm2/lvm2.xibuild @@ -0,0 +1,54 @@ +#!/bin/sh + +NAME="lvm2" +DESC="Logical Volume Manager 2 utilities" + +MAKEDEPS="make eudev" +DEPS="libaio util-linux musl device-mapper" + +PKG_VER=2.03.16 +SOURCE="https://mirrors.kernel.org/sourceware/lvm2/LVM2.$PKG_VER.tgz" +ADDITIONAL="mlockall-default-config.patch mallinfo.patch lvm.initd lvm.confd fix-stdio-usage.patch dmeventd.initd " + +prepare () { + apply_patches + sed -i 's/fmt -1/fmt/g' make.tmpl.in + sed -i 's|@BLKID_LIBS@|-lblkid -luuid|g' make.tmpl.in + autoreconf -fi +} + +build () { + export ac_cv_func_malloc_0_nonnull=yes + export ac_cv_func_realloc_0_nonnull=yes + + ./configure \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sysconfdir=/etc \ + --disable-selinux \ + --enable-readline \ + --enable-pkgconfig \ + --enable-fsadm \ + --enable-applib \ + --enable-dmeventd \ + --enable-cmdlib \ + --enable-udev_sync \ + --enable-udev_rules \ + --enable-lvmetad + --with-udevdir=/usr/lib/udev/rules.d \ + --with-default-pid-dir=/run \ + --with-default-dm-run-dir=/run \ + --with-default-run-dir=/run/lvm \ + --with-default-locking-dir=/run/lock/lvm \ + --enable-udev_rules CLDFLAGS="$LDFLAGS" + make +} + +package () { + make DESTDIR="$PKG_DEST" install + install -d "$PKG_DEST"/etc/lvm/archive "$PKG_DEST"/etc/lvm/backup + install -Dm755 lvm.initd "$PKG_DEST"/etc/init.d/lvm + install -Dm644 lvm.confd "$PKG_DEST"/etc/conf.d/lvm + ln -s libdevmapper.so.1.02 "$PKG_DEST"/lib/libdevmapper.so + +} diff --git a/skip/lvm2/mallinfo.patch b/skip/lvm2/mallinfo.patch new file mode 100644 index 0000000..471a6b2 --- /dev/null +++ b/skip/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/skip/lvm2/mlockall-default-config.patch b/skip/lvm2/mlockall-default-config.patch new file mode 100644 index 0000000..305ddee --- /dev/null +++ b/skip/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]" |