summaryrefslogtreecommitdiff
path: root/system/lvm2
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:19 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:56 -0500
commitb1eb50599e4db7eb4501af75cbbfa22007081ea5 (patch)
treec94a34c882cc17adedd781e8c5f34349b2a62416 /system/lvm2
parentb9e85bbdcf38547ef2ca4e5c2a6e6293bbcd2752 (diff)
downloadpackages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.gz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.bz2
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.xz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.zip
The New Plan
all pkgs needed to bootstrap -> system others -> user
Diffstat (limited to 'system/lvm2')
-rw-r--r--system/lvm2/APKBUILD133
-rw-r--r--system/lvm2/dmeventd.initd26
-rw-r--r--system/lvm2/fix-stdio-usage.patch49
-rw-r--r--system/lvm2/library_dir-default-config.patch10
-rw-r--r--system/lvm2/lvm.confd5
-rw-r--r--system/lvm2/lvm.initd38
-rw-r--r--system/lvm2/mallinfo.patch11
-rw-r--r--system/lvm2/mlockall-default-config.patch24
8 files changed, 296 insertions, 0 deletions
diff --git a/system/lvm2/APKBUILD b/system/lvm2/APKBUILD
new file mode 100644
index 000000000..862c9fa35
--- /dev/null
+++ b/system/lvm2/APKBUILD
@@ -0,0 +1,133 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=lvm2
+pkgver=2.02.175
+pkgrel=1
+pkgdesc="Logical Volume Manager 2 utilities"
+url="http://sourceware.org/lvm2/"
+arch="all"
+options="!check" # Test tries to use real /dev/mapper/control.
+license="GPL-2.0-only, LGPL-2.1-only"
+# lvm2 will dlopen libs so we need to add explicit depend
+depends="lvm2-libs=$pkgver-r$pkgrel"
+depends_dev="linux-headers"
+makedepends_build="coreutils"
+makedepends_host="$depends_dev util-linux-dev"
+makedepends="$makedepends_build $makedepends_host"
+source="https://mirrors.kernel.org/sourceware/$pkgname/releases/LVM2.$pkgver.tgz
+ fix-stdio-usage.patch
+ mallinfo.patch
+ library_dir-default-config.patch
+ mlockall-default-config.patch
+ lvm.initd
+ lvm.confd
+ dmeventd.initd
+ "
+subpackages="
+ $pkgname-dev
+ $pkgname-doc
+ $pkgname-dmeventd
+ $pkgname-openrc
+ device-mapper:dm
+ device-mapper-libs:dm_libs
+ device-mapper-event-libs:dm_event_libs
+ $pkgname-libs
+ $pkgname-extra
+ "
+
+builddir="$srcdir/LVM2.$pkgver"
+
+build () {
+ cd "$builddir"
+
+ # during cross-compilation malloc test goes wrong
+ export ac_cv_func_malloc_0_nonnull=yes
+ export ac_cv_func_realloc_0_nonnull=yes
+
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --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 \
+ CLDFLAGS="$LDFLAGS" \
+ || return 1
+
+ make || return 1
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install || return 1
+ install -d "$pkgdir"/etc/lvm/archive "$pkgdir"/etc/lvm/backup
+ install -Dm755 "$srcdir"/lvm.initd "$pkgdir"/etc/init.d/lvm
+ install -Dm644 "$srcdir"/lvm.confd "$pkgdir"/etc/conf.d/lvm
+ ln -s libdevmapper.so.1.02 "$pkgdir"/lib/libdevmapper.so || return 1
+}
+
+dmeventd() {
+ pkgdesc="Device-mapper event daemon"
+ mkdir -p "$subpkgdir"/sbin
+ mv "$pkgdir"/sbin/dmeventd "$subpkgdir"/sbin/
+ install -Dm755 "$srcdir"/dmeventd.initd "$subpkgdir"/etc/init.d/dmeventd
+}
+
+dm() {
+ pkgdesc="Device mapper userspace library and tools from LVM2"
+ mkdir -p "$subpkgdir"/sbin "$subpkgdir"/lib
+ mv "$pkgdir"/sbin/dm* "$subpkgdir"/sbin/
+}
+
+libs() {
+ pkgdesc="LVM2 shared libraries"
+ depends=
+ mkdir -p "$subpkgdir"/lib
+ mv "$pkgdir"/lib/liblvm2*.so.* "$subpkgdir"/lib/ || return 1
+ mv "$pkgdir"/lib/libdevmapper-event-lvm2*.so.* "$subpkgdir"/lib/ || return 1
+ mv "$pkgdir"/lib/device-mapper "$subpkgdir"/lib/ || return 1
+}
+
+dm_libs() {
+ pkgdesc="Device-mapper shared library"
+ depends=
+ mkdir -p "$subpkgdir"/lib
+ mv "$pkgdir"/lib/libdevmapper.so.* "$subpkgdir"/lib/
+}
+
+dm_event_libs() {
+ pkgdesc="Device-mapper event daemon shared library"
+ depends=
+ mkdir -p "$subpkgdir"/lib
+ mv "$pkgdir"/lib/libdevmapper-event.so.* "$subpkgdir"/lib/
+}
+
+extra() {
+ pkgdesc="LVM2 extra utilities"
+ depends="bash coreutils"
+ local util
+ for util in sbin/lvmdump sbin/lvmconf sbin/fsadm sbin/blkdeactivate; do
+ mkdir -p "$subpkgdir/${util%/*}"
+ mv $pkgdir/$util $subpkgdir/$util
+ done
+}
+
+sha512sums="73837edcad6c4165211be6a3528da62a189f1c97bcdd73a69746df9459d3716c0c44580a654b55e2bcafea48797ce4ecee0f1df22e32e599ddebf942807b2638 LVM2.2.02.175.tgz
+6ea4efad03f8632f2883f33f9d9f8ca295f7d8d2aa1bfbfa7738e7d711727a511758848dde5776b222bd74e6fb60bed8b56a3cd2f74ca448b8d86f50470a42b9 fix-stdio-usage.patch
+9272ec8c5184ef5dc776ead8f74132e072b7563b5119a3a38b712f00d92a1e3878c9b3a54eb2b01dcba038110c686b39d4c17ecd0eb258537e9217d7ed03c408 mallinfo.patch
+33004594a5cce7af1e493a2a66ce8ad2f864dde3b2ec0960d0fda9df9b7bcf65d9455f9eccf7860f48726c48f14111b843b0a0c9bd395ef2952b41aaab8092b2 library_dir-default-config.patch
+d190c40a137b006d7b63298069c93ff08d2804b990e85d44739cd7c48beec9a569903b98f0d940895fc7365723ba886acd7ef0e08f1f65a1a391d1c448ce080e mlockall-default-config.patch
+a853078660fd2fd943538924f56e81dc5793294e26b8f61d93e6188893f15f4a438d33792b341c1865d61e03f4a371b7c7ee0db5f4130ef7cb7aeaeb9290086a lvm.initd
+07caf8fa942290f3c953cc2463aaf55bac01d0bcb9351daf3880fa4d0eefb67fe00761c46a7a4da91cd2f8e492a12fed35853a15dc939cd80d19d3303bc3951d lvm.confd
+ca06220065525e93347efb7a5746a367cf55cb03574e50eed29bd7c4eae036bdd199b52c42d81811b6e742649e73ab8e66525f663bed66f9d1d82d0efde50332 dmeventd.initd"
diff --git a/system/lvm2/dmeventd.initd b/system/lvm2/dmeventd.initd
new file mode 100644
index 000000000..c46f8bab8
--- /dev/null
+++ b/system/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/system/lvm2/fix-stdio-usage.patch b/system/lvm2/fix-stdio-usage.patch
new file mode 100644
index 000000000..39ba2e1b4
--- /dev/null
+++ b/system/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.orig
++++ ./lib/commands/toolcontext.c
+@@ -1860,7 +1860,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) {
+ /* Allocate 2 buffers */
+@@ -2241,7 +2241,7 @@
+ if (cmd->libmem)
+ dm_pool_destroy(cmd->libmem);
+
+-#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/system/lvm2/library_dir-default-config.patch b/system/lvm2/library_dir-default-config.patch
new file mode 100644
index 000000000..6e3b95832
--- /dev/null
+++ b/system/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/system/lvm2/lvm.confd b/system/lvm2/lvm.confd
new file mode 100644
index 000000000..9d150f6ef
--- /dev/null
+++ b/system/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/system/lvm2/lvm.initd b/system/lvm2/lvm.initd
new file mode 100644
index 000000000..db6adbeed
--- /dev/null
+++ b/system/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/system/lvm2/mallinfo.patch b/system/lvm2/mallinfo.patch
new file mode 100644
index 000000000..471a6b255
--- /dev/null
+++ b/system/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/system/lvm2/mlockall-default-config.patch b/system/lvm2/mlockall-default-config.patch
new file mode 100644
index 000000000..1daadeff3
--- /dev/null
+++ b/system/lvm2/mlockall-default-config.patch
@@ -0,0 +1,24 @@
+--- ./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.
+diff --git a/lib/config/defaults.h b/lib/config/defaults.h
+index 8ab1fde..57b2443 100644
+--- a/lib/config/defaults.h
++++ b/lib/config/defaults.h
+@@ -53,7 +53,7 @@
+ #define DEFAULT_WAIT_FOR_LOCKS 1
+ #define DEFAULT_LVMLOCKD_LOCK_RETRIES 3
+ #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
+