diff options
Diffstat (limited to 'sys-fs/lvm2/files')
38 files changed, 1683 insertions, 0 deletions
diff --git a/sys-fs/lvm2/files/1.02.22-dmeventd.initd b/sys-fs/lvm2/files/1.02.22-dmeventd.initd new file mode 100644 index 00000000..f29da2e3 --- /dev/null +++ b/sys-fs/lvm2/files/1.02.22-dmeventd.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/1.02.22-dmeventd.initd,v 1.1 2009/04/09 23:00:10 caleb Exp $ + +depend() { + before device-mapper +} + +start() { + ebegin "Starting dmeventd" + start-stop-daemon --start --exec /sbin/dmeventd --pidfile /var/run/dmeventd.pid + eend $? +} + +stop() { + ebegin "Stopping dmeventd" + start-stop-daemon --stop --exec /sbin/dmeventd --pidfile /var/run/dmeventd.pid + eend $? +} + diff --git a/sys-fs/lvm2/files/clvmd.confd-2.02.39 b/sys-fs/lvm2/files/clvmd.confd-2.02.39 new file mode 100644 index 00000000..57821709 --- /dev/null +++ b/sys-fs/lvm2/files/clvmd.confd-2.02.39 @@ -0,0 +1,9 @@ +# CLVMD_CLUSTER_TIMEOUT -- amount of time to wait for cluster quorum. + +CLVMD_CLUSTER_TIMEOUT=30 + + +# CLVMD_NODES_TIMEOUT -- amount of time to wait for the other nodes to +# join the cluster. + +CLVMD_NODES_TIMEOUT=60 diff --git a/sys-fs/lvm2/files/clvmd.rc-2.02.39 b/sys-fs/lvm2/files/clvmd.rc-2.02.39 new file mode 100755 index 00000000..764aeabc --- /dev/null +++ b/sys-fs/lvm2/files/clvmd.rc-2.02.39 @@ -0,0 +1,146 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/clvmd.rc-2.02.39,v 1.2 2010/05/01 21:26:32 robbat2 Exp $ + +[ -x /usr/sbin/clvmd ] && CLVMD_BIN="/usr/sbin/clvmd" || CLVMD_BIN="/sbin/clvmd" + +[ -z "$CLVMD_CLUSTER_TIMEOUT" ] && CLVMD_CLUSTER_TIMEOUT=30 +[ -n "$CLVMD_NODES_TIMEOUT" ] || CLVMD_NODES_TIMEOUT=60 + +VGCHANGE="/sbin/vgchange" +VGSCAN="/sbin/vgscan" +VGDISPLAY="/sbin/vgdisplay" +CLVMD_PIDFILE="/var/run/clvmd.pid" + +depend() { + use net dns logger dmeventd + need cman +} + +load_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Loading ${module} kernel module" + modprobe ${module} + eend $? "Failed to load ${module} kernel module" + done +} + +unload_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Unloading ${module} kernel module" + modprobe -r ${module} + eend $? "Failed to unload ${module} kernel module" + done +} + +umount_gfs_filesystems() { + local sig retry + local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)" + + if [ -n "${remaining}" ] + then + sig= + retry=3 + while [ -n "${remaining}" -a "${retry}" -gt 0 ] + do + if [ "${retry}" -lt 3 ] + then + ebegin "Unmounting GFS filesystems (retry)" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems this retry" + else + ebegin "Unmounting GFS filesystems" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems" + fi + remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)" + [ -z "${remaining}" ] && break + /bin/fuser -k -m ${sig} ${remaining} &>/dev/null + sleep 5 + retry=$((${retry} -1)) + sig=-9 + done + fi +} + + +start_volumes() { + ebegin "Scanning LVM volumes" + $VGSCAN > /dev/null 2>&1 + eend $? + + ret=$? + if [ "$ret" -eq 5 ] + then + einfo " Waiting for other nodes to join the cluster ($CLVMD_NODES_TIMEOUT seconds)" + fi + + clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'` + for vg in $clustervgs; do + ebegin " Activating Clustered VG: ${vg} " + + wait=0 + while [ -n "$($VGCHANGE -a y ${vg} 2>&1 |grep "clvmd not running")" ]; do + if [ $wait -lt $CLVMD_NODES_TIMEOUT ]; then + sleep 3 + wait=$(($wait + 3)) + else + eend 1 + fi + done + eend 0 + done +} + +stop_volumes() { + # Deactivate only clustered volumes + clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'` + for vg in $clustervgs; do + ebegin " Shutting Down Clustered VG: ${vg} " + $VGCHANGE -anl ${vg} >/dev/null + eend $? + done +} + + +start() { + local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/{modules,devices}) + + if [ -z "${module}" ]; then + load_modules "dm-mod" + sleep 1s + fi + + ebegin "Starting clvmd ($CLVMD_CLUSTER_TIMEOUT seconds)" + + start-stop-daemon --start --quiet --exec ${CLVMD_BIN} -- -T ${CLVMD_CLUSTER_TIMEOUT} + eend $? + + start_volumes +} + +stop() { + + # umount GFS filesystems + umount_gfs_filesystems + + #stop_volumes + + ebegin "Stopping clvmd" + #start-stop-daemon --stop -s TERM --quiet --exec ${CLVMD_BIN} --name clvmd + killall -TERM ${CLVMD_BIN} >/dev/null + eend $? + + #local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/modules) + + #if [[ "$?" -eq 0 && ! -z "${module}" ]]; then + # unload_modules "dm-mod" + #fi +} diff --git a/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3 b/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3 new file mode 100644 index 00000000..bc7a2515 --- /dev/null +++ b/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3 @@ -0,0 +1 @@ +RC_AFTER="lvm" diff --git a/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2 b/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2 new file mode 100644 index 00000000..9eb3d3cc --- /dev/null +++ b/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2 @@ -0,0 +1,28 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2,v 1.2 2010/05/01 21:26:33 robbat2 Exp $ + +depend() { + # necessary for services when using baselayout-2 + # but conflict for baselayout-1 + if [ -e /etc/init.d/root ] ; then + before checkfs fsck + after modules + fi + after dmeventd +} + +start() { + if [ ! -e /etc/init.d/root ] ; then + eerror "The ${SVCNAME} init script is written for baselayout-2" + eerror "Please do not use it with baselayout-1" + return 1 + fi + + local f=/lib/rcscripts/addons/dm-start.sh + if [ -r "$f" ]; then + ( . "$f" ) + fi +} + diff --git a/sys-fs/lvm2/files/device-mapper.rc-2.02.67-r1 b/sys-fs/lvm2/files/device-mapper.rc-2.02.67-r1 new file mode 100644 index 00000000..1cb0f4da --- /dev/null +++ b/sys-fs/lvm2/files/device-mapper.rc-2.02.67-r1 @@ -0,0 +1,30 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/device-mapper.rc-2.02.67-r1,v 1.1 2010/06/09 22:41:45 robbat2 Exp $ + +depend() { + # necessary for services when using baselayout-2 + # but conflict for baselayout-1 + if [ -e /etc/init.d/root ] ; then + before checkfs fsck + after modules + fi + # 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 + before dmeventd +} + +start() { + if [ ! -e /etc/init.d/root ] ; then + eerror "The ${SVCNAME} init script is written for baselayout-2" + eerror "Please do not use it with baselayout-1" + return 1 + fi + + local f=/lib/rcscripts/addons/dm-start.sh + if [ -r "$f" ]; then + ( . "$f" ) + fi +} + diff --git a/sys-fs/lvm2/files/device-mapper.rc-2.02.95-r2 b/sys-fs/lvm2/files/device-mapper.rc-2.02.95-r2 new file mode 100644 index 00000000..404c269b --- /dev/null +++ b/sys-fs/lvm2/files/device-mapper.rc-2.02.95-r2 @@ -0,0 +1,111 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/device-mapper.rc-2.02.95-r2,v 1.1 2012/05/27 07:05:22 robbat2 Exp $ + +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 + before dmeventd checkfs fsck + after modules +} + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# char **get_new_dm_volumes(void) +# +# Return dmsetup commands to setup volumes +get_new_dm_volumes() { + local volume params + + # Filter comments and blank lines + grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + while read volume params ; do + # If it exists, skip it + dmvolume_exists "${volume%:}" && continue + # Assemble the command to run to create volume + echo "echo ${params} | /sbin/dmsetup create ${volume%:}" + done + + return 0 +} + +# int dmvolume_exists(volume) +# +# Return true if volume exists in DM table +dmvolume_exists() { + local x line volume=$1 + + [ -z "${volume}" ] && return 1 + + /sbin/dmsetup ls 2>/dev/null | \ + while read line ; do + for x in ${line} ; do + # the following conditonal return only breaks out + # of the while loop, as it is running in a pipe. + [ "${x}" = "${volume}" ] && return 1 + # We only want to check the volume name + break + done + done + + # if 1 was returned from the above loop, then indicate that + # volume exists + [ $? = 1 ] && return 0 + + # otherwise the loop exited normally and the volume does not + # exist + return 1 +} + +# int is_empty_dm_volume(volume) +# +# Return true if the volume exists in DM table, but is empty/non-valid +is_empty_dm_volume() { + local table volume=$1 + + set -- $(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:") + [ "${volume}" = "$1" -a -z "$2" ] +} + + +start() { + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + # Ensure the dirs exist for locking and running + checkpath -q -d -m 0700 -o root:root /run/lvm /run/lock/lvm + + local x volume + + if [ -x /sbin/dmsetup -a -c /dev/mapper/control -a -f /etc/dmtab ] ; then + [ -n "$(get_new_dm_volumes)" ] && \ + einfo " Setting up device-mapper volumes:" + + get_new_dm_volumes | \ + while read x ; do + [ -n "${x}" ] || continue + + volume="${x##* }" + + ebegin " Creating volume: ${volume}" + if ! eval "${x}" >/dev/null 2>/dev/null ; then + eend 1 " Error creating volume: ${volume}" + # dmsetup still adds an empty volume in some cases, + # so lets remove it + is_empty_dm_volume "${volume}" && \ + /sbin/dmsetup remove "${volume}" 2>/dev/null + else + eend 0 + fi + done + fi +} + diff --git a/sys-fs/lvm2/files/dm-start.sh b/sys-fs/lvm2/files/dm-start.sh new file mode 100644 index 00000000..84acfa4a --- /dev/null +++ b/sys-fs/lvm2/files/dm-start.sh @@ -0,0 +1,86 @@ +# /lib/rcscripts/addons/dm-start.sh: Setup DM volumes at boot +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dm-start.sh,v 1.1 2009/04/09 23:00:10 caleb Exp $ + +# char **get_new_dm_volumes(void) +# +# Return dmsetup commands to setup volumes +get_new_dm_volumes() { + local volume params + + # Filter comments and blank lines + grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + while read volume params ; do + # If it exists, skip it + dmvolume_exists "${volume%:}" && continue + # Assemble the command to run to create volume + echo "echo ${params} | /sbin/dmsetup create ${volume%:}" + done + + return 0 +} + +# int dmvolume_exists(volume) +# +# Return true if volume exists in DM table +dmvolume_exists() { + local x line volume=$1 + + [ -z "${volume}" ] && return 1 + + /sbin/dmsetup ls 2>/dev/null | \ + while read line ; do + for x in ${line} ; do + # the following conditonal return only breaks out + # of the while loop, as it is running in a pipe. + [ "${x}" = "${volume}" ] && return 1 + # We only want to check the volume name + break + done + done + + # if 1 was returned from the above loop, then indicate that + # volume exists + [ $? = 1 ] && return 0 + + # otherwise the loop exited normally and the volume does not + # exist + return 1 +} + +# int is_empty_dm_volume(volume) +# +# Return true if the volume exists in DM table, but is empty/non-valid +is_empty_dm_volume() { + local table volume=$1 + + set -- $(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:") + [ "${volume}" = "$1" -a -z "$2" ] +} + +local x volume + +if [ -x /sbin/dmsetup -a -c /dev/mapper/control -a -f /etc/dmtab ] ; then + [ -n "$(get_new_dm_volumes)" ] && \ + einfo " Setting up device-mapper volumes:" + + get_new_dm_volumes | \ + while read x ; do + [ -n "${x}" ] || continue + + volume="${x##* }" + + ebegin " Creating volume: ${volume}" + if ! eval "${x}" >/dev/null 2>/dev/null ; then + eend 1 " Error creating volume: ${volume}" + # dmsetup still adds an empty volume in some cases, + # so lets remove it + is_empty_dm_volume "${volume}" && \ + /sbin/dmsetup remove "${volume}" 2>/dev/null + else + eend 0 + fi + done +fi + + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1 b/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1 new file mode 100644 index 00000000..1b8ebe60 --- /dev/null +++ b/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1 @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2007 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.1 2010/06/09 22:41:45 robbat2 Exp $ + +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 /sbin/dmeventd --pidfile /var/run/dmeventd.pid + eend $? +} + +stop() { + ebegin "Stopping dmeventd" + start-stop-daemon --stop --exec /sbin/dmeventd --pidfile /var/run/dmeventd.pid + eend $? +} + diff --git a/sys-fs/lvm2/files/dmtab b/sys-fs/lvm2/files/dmtab new file mode 100644 index 00000000..5fc1d793 --- /dev/null +++ b/sys-fs/lvm2/files/dmtab @@ -0,0 +1,12 @@ +#/etc/dmraid: config file for adding device-mapper volumes at boot +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dmtab,v 1.1 2009/04/09 23:00:10 caleb Exp $ + +# Format: <volume name>: <table> +# Example: isw0: 0 312602976 striped 2 128 /dev/sda 0 /dev/sdb 0 +# +# Alternatively you can create all your volumes the first time, and just run: +# +# dmsetup table >> /etc/dmtab +# +# and verify that they are correct. + diff --git a/sys-fs/lvm2/files/lvm-monitoring.initd-2.02.67-r2 b/sys-fs/lvm2/files/lvm-monitoring.initd-2.02.67-r2 new file mode 100644 index 00000000..0b67f331 --- /dev/null +++ b/sys-fs/lvm2/files/lvm-monitoring.initd-2.02.67-r2 @@ -0,0 +1,46 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm-monitoring.initd-2.02.67-r2,v 1.3 2010/08/20 19:18:29 robbat2 Exp $ + +# This script is based on upstream file +# LVM2.2.02.67/scripts/lvm2_monitoring_init_red_hat.in + +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 + need lvm dmeventd +} + +VGCHANGE=/sbin/vgchange +VGS=/sbin/vgs + +start() { + ret=0 + # TODO do we want to separate out already active groups only? + VGSLIST=`$VGS --noheadings -o name 2> /dev/null` + for vg in $VGSLIST + do + ebegin "Starting LVM monitoring for VG $vg:" + $VGCHANGE --monitor y --poll y $vg + ret2=$? + eend $ret2 + [ $ret2 -ne 0 ] && ret=$ret2 + done + return $ret +} + +stop() { + ret=0 + # TODO do we want to separate out already active groups only? + VGSLIST=`$VGS --noheadings -o name 2> /dev/null` + for vg in $VGSLIST + do + ebegin "Stopping LVM monitoring for VG $vg:" + $VGCHANGE --monitor n $vg + ret2=$? + eend $ret2 + [ $ret2 -ne 0 ] && ret=$ret2 + done + return $ret +} diff --git a/sys-fs/lvm2/files/lvm.conf-2.02.67.patch b/sys-fs/lvm2/files/lvm.conf-2.02.67.patch new file mode 100644 index 00000000..547963c7 --- /dev/null +++ b/sys-fs/lvm2/files/lvm.conf-2.02.67.patch @@ -0,0 +1,48 @@ +diff -Nuar LVM2.2.02.67.orig//doc/example.conf.in LVM2.2.02.67//doc/example.conf.in +--- LVM2.2.02.67.orig//doc/example.conf.in 2010-05-20 13:47:21.000000000 +0000 ++++ LVM2.2.02.67//doc/example.conf.in 2010-06-07 18:43:34.099693472 +0000 +@@ -50,7 +50,9 @@ + + + # By default we accept every block device: +- filter = [ "a/.*/" ] ++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel ++ # noise when you probed while not available. ++ filter = [ "r|/dev/nbd.*|", "a/.*/" ] + + # Exclude the cdrom drive + # filter = [ "r|/dev/cdrom|" ] +@@ -259,6 +261,8 @@ + # the new lvm2 on-disk metadata format. + # The default value is set when the tools are built. + # fallback_to_lvm1 = 0 ++ # Gentoo: the LVM tools are a seperate package. ++ fallback_to_lvm1 = 0 + + # The default metadata format that commands should use - "lvm1" or "lvm2". + # The command line override is -M1 or -M2. +@@ -449,12 +453,12 @@ + + # Metadata settings + # +-# metadata { ++metadata { + # Default number of copies of metadata to hold on each PV. 0, 1 or 2. + # You might want to override it from the command line with 0 + # when running pvcreate on new PVs which are to be added to large VGs. +- +- # pvmetadatacopies = 1 ++ # Gentoo: enable for data safety, but PV resize is then disabled. ++ #pvmetadatacopies = 2 + + # Approximate default size of on-disk metadata areas in sectors. + # You should increase this if you have large volume groups or +@@ -476,7 +480,7 @@ + # the supplied toolset to make changes (e.g. vgcfgrestore). + + # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ] +-#} ++} + + # Event daemon + # diff --git a/sys-fs/lvm2/files/lvm.confd-2.02.28-r2 b/sys-fs/lvm2/files/lvm.confd-2.02.28-r2 new file mode 100644 index 00000000..2fbd8668 --- /dev/null +++ b/sys-fs/lvm2/files/lvm.confd-2.02.28-r2 @@ -0,0 +1,5 @@ +# LVM should normally only be started after mdraid is available +# this is because LVM physical volumes are very often MD devices. +RC_AFTER="mdraid" + +# vim: ft=gentoo-conf-d diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.51-r2 b/sys-fs/lvm2/files/lvm.rc-2.02.51-r2 new file mode 100644 index 00000000..ca2084ee --- /dev/null +++ b/sys-fs/lvm2/files/lvm.rc-2.02.51-r2 @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm.rc-2.02.51-r2,v 1.2 2010/05/01 21:26:33 robbat2 Exp $ + +depend() { + if [ -f /etc/init.d/sysfs ]; then + # on baselayout-1 this causes + # dependency-cycles with checkroot (before *) + before checkfs fsck + after modules device-mapper + fi + use dmeventd + after dmeventd +} + +run_addon() { + local f=/lib/rcscripts/addons/$1.sh + if [ -r "$f" ]; then + ( . "$f" ) + fi +} + +start() { + if [ ! -f /etc/init.d/sysfs ]; then + eerror "The $SVCNAME init-script is written for baselayout-2!" + eerror "Please do not use it with baselayout-1!". + return 1 + fi + + run_addon lvm-start +} + +stop() { + run_addon lvm-stop +} + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.67-r1 b/sys-fs/lvm2/files/lvm.rc-2.02.67-r1 new file mode 100644 index 00000000..d4eafc18 --- /dev/null +++ b/sys-fs/lvm2/files/lvm.rc-2.02.67-r1 @@ -0,0 +1,39 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm.rc-2.02.67-r1,v 1.1 2010/06/09 22:41:45 robbat2 Exp $ + +depend() { + if [ -f /etc/init.d/sysfs ]; then + # on baselayout-1 this causes + # dependency-cycles with checkroot (before *) + before checkfs fsck + after modules device-mapper + fi + # 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 + before dmeventd +} + +run_addon() { + local f=/lib/rcscripts/addons/$1.sh + if [ -r "$f" ]; then + ( . "$f" ) + fi +} + +start() { + if [ ! -f /etc/init.d/sysfs ]; then + eerror "The $SVCNAME init-script is written for baselayout-2!" + eerror "Please do not use it with baselayout-1!". + return 1 + fi + + run_addon lvm-start +} + +stop() { + run_addon lvm-stop +} + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.95-r2 b/sys-fs/lvm2/files/lvm.rc-2.02.95-r2 new file mode 100644 index 00000000..a06aa0bb --- /dev/null +++ b/sys-fs/lvm2/files/lvm.rc-2.02.95-r2 @@ -0,0 +1,96 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm.rc-2.02.95-r2,v 1.1 2012/05/27 07:05:22 robbat2 Exp $ + +depend() { + use dmeventd + before checkfs fsck + after dmeventd modules device-mapper +} + +config='global { locking_dir = "/run/lock/lvm" }' + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +start() { + # LVM support for /usr, /home, /opt .... + # This should be done *before* checking local + # volumes, or they never get checked. + + # NOTE: Add needed modules for LVM or RAID, etc + # to /etc/modules.autoload if needed + for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break + done + if [ ! -x "$lvm_path" ]; then + eerror "Cannot find lvm binary in /sbin or /bin!" + return 1 + fi + if [ -z "${CDBOOT}" ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + lvm_commands="#! ${lvm_path} --config '${config}'\n" + # Extra PV find pass because some devices might not have been available until very recently + lvm_commands="${lvm_commands}pvscan\n" + # Now make the nodes + lvm_commands="${lvm_commands}vgscan --mknodes\n" + # And turn them on! + lvm_commands="${lvm_commands}vgchange --sysinit -a ly\n" + # Order of this is important, have to work around dash and LVM readline + printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null + eend $? "Failed to setup the LVM" + fi + fi +} + +stop() { + for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break + done + if [ ! -x "$lvm_path" ]; then + eerror "Cannot find lvm binary in /sbin or /bin!" + return 1 + fi +# Stop LVM2 +if [ -x /sbin/vgs ] && \ + [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + + + VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix 2> /dev/null) + + if [ "$VGS" ] + then + ebegin " Shutting Down LVs & VGs" + #still echo stderr for debugging + lvm_commands="#! ${lvm_path} --config '${config}'\n" + # Extra PV find pass because some devices might not have been available until very recently + lvm_commands="${lvm_commands}lvchange --sysinit -a ln ${VGS}\n" + # Now make the nodes + lvm_commands="${lvm_commands}vgchange --sysinit -a ln\n" + # Order of this is important, have to work around dash and LVM readline + printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null + eend $? "Failed" + fi + + einfo "Finished Shutting down the Logical Volume Manager" +fi +} + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-2.02.56-lvm2create_initrd.patch b/sys-fs/lvm2/files/lvm2-2.02.56-lvm2create_initrd.patch new file mode 100644 index 00000000..59aaa9b3 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.56-lvm2create_initrd.patch @@ -0,0 +1,72 @@ +--- 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 +- diff --git a/sys-fs/lvm2/files/lvm2-2.02.63-always-make-static-libdm.patch b/sys-fs/lvm2/files/lvm2-2.02.63-always-make-static-libdm.patch new file mode 100644 index 00000000..5ddcb4e5 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.63-always-make-static-libdm.patch @@ -0,0 +1,42 @@ +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") diff --git a/sys-fs/lvm2/files/lvm2-2.02.64-dmeventd-libs.patch b/sys-fs/lvm2/files/lvm2-2.02.64-dmeventd-libs.patch new file mode 100644 index 00000000..3a536399 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.64-dmeventd-libs.patch @@ -0,0 +1,15 @@ +X-Gentoo-Bug: 318513 +X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=318513 + +diff -ur LVM2.2.02.64/daemons/dmeventd/plugins/lvm2/Makefile.in LVM2.2.02.64.new/daemons/dmeventd/plugins/lvm2/Makefile.in +--- LVM2.2.02.64/daemons/dmeventd/plugins/lvm2/Makefile.in 2010-04-09 23:42:49.000000000 +0200 ++++ LVM2.2.02.64.new/daemons/dmeventd/plugins/lvm2/Makefile.in 2010-05-04 13:18:07.886389742 +0200 +@@ -24,7 +24,7 @@ + + include $(top_builddir)/make.tmpl + +-LIBS += @LVM2CMD_LIB@ -ldevmapper $(PTHREAD_LIBS) ++LIBS += @LVM2CMD_LIB@ -ldevmapper -ldevmapper-event $(PTHREAD_LIBS) + + install_lvm2: install_lib_shared + diff --git a/sys-fs/lvm2/files/lvm2-2.02.67-createinitrd.patch b/sys-fs/lvm2/files/lvm2-2.02.67-createinitrd.patch new file mode 100644 index 00000000..7f0bfb89 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.67-createinitrd.patch @@ -0,0 +1,18 @@ +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 + diff --git a/sys-fs/lvm2/files/lvm2-2.02.70-asneeded.patch b/sys-fs/lvm2/files/lvm2-2.02.70-asneeded.patch new file mode 100644 index 00000000..7576e192 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.70-asneeded.patch @@ -0,0 +1,15 @@ +http://bugs.gentoo.org/330255 + +liblvm2app.so: undefined reference to `floor' + +--- liblvm/Makefile.in ++++ liblvm/Makefile.in +@@ -39,7 +39,7 @@ + + include $(top_builddir)/make.tmpl + +-LIBS += $(LVMINTERNAL_LIBS) -ldevmapper ++LIBS += $(LVMINTERNAL_LIBS) -ldevmapper -lm + + ifeq ("@DMEVENTD@", "yes") + LIBS += -ldevmapper-event diff --git a/sys-fs/lvm2/files/lvm2-2.02.70-locale-muck.patch b/sys-fs/lvm2/files/lvm2-2.02.70-locale-muck.patch new file mode 100644 index 00000000..fcde672c --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.70-locale-muck.patch @@ -0,0 +1,11 @@ +--- make.tmpl.in.orig 2010-08-04 10:10:17.000000000 +0300 ++++ make.tmpl.in 2010-08-04 10:10:33.000000000 +0300 +@@ -360,7 +360,7 @@ + ( cat $(srcdir)/.exported_symbols; \ + if test x$(EXPORTED_HEADER) != x; then \ + $(CC) -E -P $(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 \ + ) > $@ + diff --git a/sys-fs/lvm2/files/lvm2-2.02.72-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.72-dynamic-static-ldflags.patch new file mode 100644 index 00000000..f1824b1a --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.72-dynamic-static-ldflags.patch @@ -0,0 +1,67 @@ +X-Gentoo-Bug: 332905 +X-Patch-URL: https://bugs.gentoo.org/attachment.cgi?id=243283&action=view +X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=332905 + +diff -ur LVM2.2.02.72.orig/configure.in LVM2.2.02.72/configure.in +--- LVM2.2.02.72.orig/configure.in 2010-07-28 16:55:42.000000000 +0300 ++++ LVM2.2.02.72/configure.in 2010-08-17 03:00:24.000000000 +0300 +@@ -35,6 +35,7 @@ + CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive" + LDDEPS="$LDDEPS .export.sym" + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" ++ STATIC_LDFLAGS="-Wl,--no-export-dynamic" + LIB_SUFFIX=so + DEVMAPPER=yes + ODIRECT=yes +@@ -1282,6 +1283,7 @@ + AC_SUBST(SELINUX_PC) + AC_SUBST(SNAPSHOTS) + AC_SUBST(STATICDIR) ++AC_SUBST(STATIC_LDFLAGS) + AC_SUBST(STATIC_LINK) + AC_SUBST(TESTING) + AC_SUBST(UDEV_LIBS) +diff -ur LVM2.2.02.72.orig/daemons/dmeventd/Makefile.in LVM2.2.02.72/daemons/dmeventd/Makefile.in +--- LVM2.2.02.72.orig/daemons/dmeventd/Makefile.in 2010-05-14 16:36:56.000000000 +0300 ++++ LVM2.2.02.72/daemons/dmeventd/Makefile.in 2010-08-17 03:00:24.000000000 +0300 +@@ -61,7 +61,7 @@ + $(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic + + dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \ ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \ + dmeventd.o $(DL_LIBS) $(LVMLIBS) $(LIBS) $(STATIC_LIBS) + + ifeq ("@PKGCONFIG@", "yes") +diff -ur LVM2.2.02.72.orig/make.tmpl.in LVM2.2.02.72/make.tmpl.in +--- LVM2.2.02.72.orig/make.tmpl.in 2010-07-20 17:38:44.000000000 +0300 ++++ LVM2.2.02.72/make.tmpl.in 2010-08-17 03:00:24.000000000 +0300 +@@ -38,6 +38,7 @@ + CLDFLAGS += @CLDFLAGS@ + LDDEPS += @LDDEPS@ + LDFLAGS += @LDFLAGS@ ++STATIC_LDFLAGS += @STATIC_LDFLAGS@ + LIB_SUFFIX = @LIB_SUFFIX@ + LVMINTERNAL_LIBS = -llvm-internal $(DL_LIBS) + DL_LIBS = @DL_LIBS@ +diff -ur LVM2.2.02.72.orig/tools/Makefile.in LVM2.2.02.72/tools/Makefile.in +--- LVM2.2.02.72.orig/tools/Makefile.in 2010-06-25 21:23:10.000000000 +0300 ++++ LVM2.2.02.72/tools/Makefile.in 2010-08-17 03:01:07.000000000 +0300 +@@ -126,7 +126,7 @@ + -o $@ dmsetup.o -ldevmapper $(LIBS) + + dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \ ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \ + -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS) + + all: device-mapper +@@ -136,7 +136,7 @@ + $(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic + + lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \ ++ $(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 diff --git a/sys-fs/lvm2/files/lvm2-2.02.73-asneeded.patch b/sys-fs/lvm2/files/lvm2-2.02.73-asneeded.patch new file mode 100644 index 00000000..ec0f7f6c --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.73-asneeded.patch @@ -0,0 +1,15 @@ +Index: LVM2.2.02.73/tools/Makefile.in +=================================================================== +--- LVM2.2.02.73.orig/tools/Makefile.in ++++ LVM2.2.02.73/tools/Makefile.in +@@ -149,8 +149,8 @@ liblvm2cmd-static.a: $(top_builddir)/lib + + liblvm2cmd.$(LIB_SUFFIX): liblvm2cmd.a $(LDDEPS) + $(CC) -shared -Wl,-soname,$@.$(LIB_VERSION) \ +- $(CFLAGS) $(CLDFLAGS) -o $@ $(LVMLIBS) $(LIBS) \ +- @CLDWHOLEARCHIVE@ liblvm2cmd.a @CLDNOWHOLEARCHIVE@ ++ $(CFLAGS) $(CLDFLAGS) -o $@ \ ++ @CLDWHOLEARCHIVE@ liblvm2cmd.a @CLDNOWHOLEARCHIVE@ $(LVMLIBS) $(LIBS) + + liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX) + $(LN_S) -f $< $@ diff --git a/sys-fs/lvm2/files/lvm2-2.02.73-locale-muck.patch b/sys-fs/lvm2/files/lvm2-2.02.73-locale-muck.patch new file mode 100644 index 00000000..f34c412f --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.73-locale-muck.patch @@ -0,0 +1,12 @@ +diff -Nuar LVM2.2.02.73.orig//make.tmpl.in LVM2.2.02.73//make.tmpl.in +--- LVM2.2.02.73.orig//make.tmpl.in 2010-08-16 17:49:26.000000000 +0000 ++++ LVM2.2.02.73//make.tmpl.in 2010-08-20 19:20:43.237413988 +0000 +@@ -362,7 +362,7 @@ + ( cat $(srcdir)/.exported_symbols; \ + if test x$(EXPORTED_HEADER) != x; then \ + $(CC) -E -P $(INCLUDES) $(DEFS) $(CFLAGS) $(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 \ + ) > $@ + diff --git a/sys-fs/lvm2/files/lvm2-2.02.84-udev-pkgconfig.patch b/sys-fs/lvm2/files/lvm2-2.02.84-udev-pkgconfig.patch new file mode 100644 index 00000000..d371ddd3 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.84-udev-pkgconfig.patch @@ -0,0 +1,25 @@ +diff -Nuar LVM2.2.02.84.orig/configure.in LVM2.2.02.84/configure.in +--- LVM2.2.02.84.orig/configure.in 2011-02-04 22:17:54.000000000 +0000 ++++ LVM2.2.02.84/configure.in 2011-04-09 23:42:27.134617541 +0000 +@@ -803,9 +803,18 @@ + AC_MSG_RESULT($UDEV_SYNC) + + if test x$UDEV_SYNC = xyes; then +- AC_CHECK_LIB(udev, udev_queue_get_udev_is_active, +- [UDEV_PC="libudev"; UDEV_LIBS="-ludev"], +- [AC_MSG_ERROR([bailing out... libudev library is required])]) ++ if test x$PKGCONFIG_INIT != x1; then ++ pkg_config_init ++ fi ++ PKG_CHECK_MODULES(UDEV, libudev, [UDEV_PC="libudev" HAVE_UDEV=yes], ++ [NOTFOUND=0 ++ AC_CHECK_HEADERS(libudev.h,,$bailout) ++ check_lib_no_libs udev udev_queue_get_udev_is_active ++ if test $NOTFOUND = 0; then ++ AC_CHECK_LIB(udev, udev_queue_get_udev_is_active, ++ [UDEV_PC="libudev"; UDEV_LIBS="-ludev"], ++ [AC_MSG_ERROR([bailing out... libudev library is required])]) ++ fi]) + AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.]) + fi + diff --git a/sys-fs/lvm2/files/lvm2-2.02.88-respect-cc.patch b/sys-fs/lvm2/files/lvm2-2.02.88-respect-cc.patch new file mode 100644 index 00000000..13d99ade --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.88-respect-cc.patch @@ -0,0 +1,17 @@ +GNU make always defaults CC to "cc", so using "?=" with the CC variable +will never override the internal make value. since @CC@ comes from the +configure script, and that respects the $CC env var, don't bother trying +to handle it in make too. it's not like we do this with any other build +variable after all. + +--- a/make.tmpl.in ++++ b/make.tmpl.in +@@ -17,7 +17,7 @@ + + @SET_MAKE@ + +-CC ?= @CC@ ++CC = @CC@ + RANLIB = @RANLIB@ + INSTALL = @INSTALL@ + MKDIR_P = @MKDIR_P@ diff --git a/sys-fs/lvm2/files/lvm2-2.02.92-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.92-dynamic-static-ldflags.patch new file mode 100644 index 00000000..de2b294e --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.92-dynamic-static-ldflags.patch @@ -0,0 +1,63 @@ +diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.92.orig/configure.in LVM2.2.02.92/configure.in +--- LVM2.2.02.92.orig/configure.in 2012-02-20 11:36:27.000000000 -0800 ++++ LVM2.2.02.92/configure.in 2012-02-20 15:53:40.700124222 -0800 +@@ -32,6 +32,7 @@ + COPTIMISE_FLAG="-O2" + CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym" + 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" +@@ -1458,6 +1459,7 @@ + AC_SUBST(SELINUX_PC) + AC_SUBST(SNAPSHOTS) + AC_SUBST(STATICDIR) ++AC_SUBST(STATIC_LDFLAGS) + AC_SUBST(STATIC_LINK) + AC_SUBST(TESTING) + AC_SUBST(THIN) +diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.92.orig/daemons/dmeventd/Makefile.in LVM2.2.02.92/daemons/dmeventd/Makefile.in +--- LVM2.2.02.92.orig/daemons/dmeventd/Makefile.in 2012-02-20 15:48:04.861683196 -0800 ++++ LVM2.2.02.92/daemons/dmeventd/Makefile.in 2012-02-20 15:52:50.732314588 -0800 +@@ -65,7 +65,7 @@ + $(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic + + dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \ ++ $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \ + dmeventd.o $(DL_LIBS) $(LVMLIBS) $(LIBS) $(STATIC_LIBS) + + ifeq ("@PKGCONFIG@", "yes") +diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.92.orig/make.tmpl.in LVM2.2.02.92/make.tmpl.in +--- LVM2.2.02.92.orig/make.tmpl.in 2012-02-20 15:48:05.034685963 -0800 ++++ LVM2.2.02.92/make.tmpl.in 2012-02-20 15:48:58.622550855 -0800 +@@ -38,6 +38,7 @@ + ELDFLAGS += @ELDFLAGS@ + LDDEPS += @LDDEPS@ + LDFLAGS += @LDFLAGS@ ++STATIC_LDFLAGS += @STATIC_LDFLAGS@ + LIB_SUFFIX = @LIB_SUFFIX@ + LVMINTERNAL_LIBS = -llvm-internal $(UDEV_LIBS) $(DL_LIBS) + DL_LIBS = @DL_LIBS@ +diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.92.orig/tools/Makefile.in LVM2.2.02.92/tools/Makefile.in +--- LVM2.2.02.92.orig/tools/Makefile.in 2011-11-14 13:30:36.000000000 -0800 ++++ LVM2.2.02.92/tools/Makefile.in 2012-02-20 15:52:25.242901501 -0800 +@@ -126,7 +126,7 @@ + -o $@ dmsetup.o -ldevmapper $(LIBS) + + dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \ ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \ + -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS) + + all: device-mapper +@@ -136,7 +136,7 @@ + $(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic + + lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \ ++ $(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 diff --git a/sys-fs/lvm2/files/lvm2-2.02.92-locale-muck.patch b/sys-fs/lvm2/files/lvm2-2.02.92-locale-muck.patch new file mode 100644 index 00000000..be9e66d0 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.92-locale-muck.patch @@ -0,0 +1,12 @@ +diff -Nuar LVM2.2.02.92.orig/make.tmpl.in LVM2.2.02.92/make.tmpl.in +--- LVM2.2.02.92.orig/make.tmpl.in 2012-02-20 15:46:46.008422005 -0800 ++++ LVM2.2.02.92/make.tmpl.in 2012-02-20 15:47:19.639959941 -0800 +@@ -382,7 +382,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 \ + ) > $@ + diff --git a/sys-fs/lvm2/files/lvm2-2.02.95-lvmpath.patch b/sys-fs/lvm2/files/lvm2-2.02.95-lvmpath.patch new file mode 100644 index 00000000..7ed9794e --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.95-lvmpath.patch @@ -0,0 +1,26 @@ +http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/udev/69-dm-lvm-metad.rules.diff?r1=1.3&r2=1.4&cvsroot=lvm2 + +X-Gentoo-Bug: 409921 +X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=409921 + +=================================================================== +RCS file: /cvs/lvm2/LVM2/udev/69-dm-lvm-metad.rules,v +retrieving revision 1.3 +retrieving revision 1.4 +diff -u -r1.3 -r1.4 +--- LVM2/udev/69-dm-lvm-metad.rules 2012/03/06 02:30:50 1.3 ++++ LVM2/udev/69-dm-lvm-metad.rules 2012/03/12 08:59:55 1.4 +@@ -19,7 +19,12 @@ + # Device-mapper devices are processed only on change event or on supported synthesized event. + KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end" + ++# Set proper sbin path, /sbin has higher priority than /usr/sbin. ++ENV{LVM_SBIN_PATH}="/sbin" ++TEST!="$env{LVM_SBIN_PATH}/lvm", ENV{LVM_SBIN_PATH}="/usr/sbin" ++TEST!="$env{LVM_SBIN_PATH}/lvm", GOTO="lvm_end" ++ + # Only process devices already marked as a PV - this requires blkid to be called before. +-ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{DM_SBIN_PATH}/pvscan --cache --major $major --minor $minor" ++ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{LVM_SBIN_PATH}/lvm pvscan --cache --major $major --minor $minor" + + LABEL="lvm_end" diff --git a/sys-fs/lvm2/files/lvm2-2.02.95-udev185.patch b/sys-fs/lvm2/files/lvm2-2.02.95-udev185.patch new file mode 100644 index 00000000..ba7e40de --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.95-udev185.patch @@ -0,0 +1,208 @@ +From 06738cac051b671ed26bd137676713eab457b37f Mon Sep 17 00:00:00 2001 +From: Peter Rajnoha <prajnoha@redhat.com> +Date: Tue, 29 May 2012 08:09:10 +0000 +Subject: [PATCH] Remove unsupported udev_get_dev_path libudev call used for checking udev dir. + +With latest changes in the udev, some deprecated functions were removed +from libudev amongst which there was the "udev_get_dev_path" function +we used to compare a device directory used in udev and directore set in +libdevmapper. The "/dev" is hardcoded in udev now (udev version >= 183). + +Amongst other changes and from packager's point of view, it's also +important to note that the libudev development library ("libudev-devel") +could now be a part of the systemd development library ("systemd-devel") +because of the udev + systemd merge. +--- + WHATS_NEW_DM | 1 + + lib/commands/toolcontext.c | 28 ++++++++++++++++------------ + lib/misc/lvm-wrappers.c | 14 -------------- + lib/misc/lvm-wrappers.h | 1 - + libdm/libdevmapper.h | 3 +++ + tools/dmsetup.c | 30 ++++++++++++------------------ + 6 files changed, 32 insertions(+), 45 deletions(-) + +diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c +index 78f0801..cc23163 100644 +--- a/lib/commands/toolcontext.c ++++ b/lib/commands/toolcontext.c +@@ -650,9 +650,9 @@ static int _init_dev_cache(struct cmd_context *cmd) + { + const struct dm_config_node *cn; + const struct dm_config_value *cv; +- size_t uninitialized_var(udev_dir_len), len; ++ size_t len, udev_dir_len = strlen(DM_UDEV_DEV_DIR); ++ int len_diff; + int device_list_from_udev; +- const char *uninitialized_var(udev_dir); + + init_dev_disable_after_error_count( + find_config_tree_int(cmd, "devices/disable_after_error_count", +@@ -661,13 +661,9 @@ static int _init_dev_cache(struct cmd_context *cmd) + if (!dev_cache_init(cmd)) + return_0; + +- if ((device_list_from_udev = udev_is_running() ? ++ device_list_from_udev = udev_is_running() ? + find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev", +- DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0)) { +- if (!(udev_dir = udev_get_dev_dir())) +- stack; +- udev_dir_len = (udev_dir) ? strlen(udev_dir) : 0; +- } ++ DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0; + init_obtain_device_list_from_udev(device_list_from_udev); + + if (!(cn = find_config_tree_node(cmd, "devices/scan"))) { +@@ -688,11 +684,19 @@ static int _init_dev_cache(struct cmd_context *cmd) + return 0; + } + +- if (device_list_from_udev && udev_dir) { ++ if (device_list_from_udev) { + len = strlen(cv->v.str); +- len = udev_dir_len > len ? len : udev_dir_len; +- if (strncmp(udev_dir, cv->v.str, len) || +- udev_dir[len] != cv->v.str[len]) { ++ ++ /* ++ * DM_UDEV_DEV_DIR always has '/' at its end. ++ * If the item in the conf does not have it, be sure ++ * to make the right comparison without the '/' char! ++ */ ++ len_diff = len && cv->v.str[len - 1] != '/' ? ++ udev_dir_len - 1 != len : ++ udev_dir_len != len; ++ ++ if (len_diff || strncmp(DM_UDEV_DEV_DIR, cv->v.str, len)) { + device_list_from_udev = 0; + init_obtain_device_list_from_udev(0); + } +diff --git a/lib/misc/lvm-wrappers.c b/lib/misc/lvm-wrappers.c +index 84f61a6..6cffae3 100644 +--- a/lib/misc/lvm-wrappers.c ++++ b/lib/misc/lvm-wrappers.c +@@ -65,16 +65,6 @@ bad: + return 0; + } + +-const char *udev_get_dev_dir(void) +-{ +- if (!_udev) { +- log_debug(_no_context_msg); +- return NULL; +- } +- +- return udev_get_dev_path(_udev); +-} +- + struct udev* udev_get_library_context(void) + { + return _udev; +@@ -96,10 +86,6 @@ int udev_is_running(void) + return 0; + } + +-const char *udev_get_dev_dir(void) +-{ +- return NULL; +-} + #endif + + int lvm_getpagesize(void) +diff --git a/lib/misc/lvm-wrappers.h b/lib/misc/lvm-wrappers.h +index f5b381c..e43f831 100644 +--- a/lib/misc/lvm-wrappers.h ++++ b/lib/misc/lvm-wrappers.h +@@ -24,7 +24,6 @@ struct udev *udev_get_library_context(void); + int udev_init_library_context(void); + void udev_fin_library_context(void); + int udev_is_running(void); +-const char *udev_get_dev_dir(void); + + int lvm_getpagesize(void); + +diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h +index 7df4db8..1f780a3 100644 +--- a/libdm/libdevmapper.h ++++ b/libdm/libdevmapper.h +@@ -1500,6 +1500,9 @@ struct dm_config_node *dm_config_clone_node(struct dm_config_tree *cft, const st + + struct dm_pool *dm_config_memory(struct dm_config_tree *cft); + ++/* Udev device directory. */ ++#define DM_UDEV_DEV_DIR "/dev/" ++ + /* Cookie prefixes. + * + * The cookie value consists of a prefix (16 bits) and a base (16 bits). +diff --git a/tools/dmsetup.c b/tools/dmsetup.c +index 6934de8..2787b76 100644 +--- a/tools/dmsetup.c ++++ b/tools/dmsetup.c +@@ -1008,11 +1008,9 @@ static int _udevcookies(CMD_ARGS) + #else /* UDEV_SYNC_SUPPORT */ + static int _set_up_udev_support(const char *dev_dir) + { +- struct udev *udev; +- const char *udev_dev_dir; +- size_t udev_dev_dir_len; + int dirs_diff; + const char *env; ++ size_t len = strlen(dev_dir), udev_dir_len = strlen(DM_UDEV_DEV_DIR); + + if (_switches[NOUDEVSYNC_ARG]) + dm_udev_set_sync_support(0); +@@ -1030,14 +1028,6 @@ static int _set_up_udev_support(const char *dev_dir) + " defined by --udevcookie option.", + _udev_cookie); + +- if (!(udev = udev_new()) || +- !(udev_dev_dir = udev_get_dev_path(udev)) || +- !*udev_dev_dir) { +- log_error("Could not get udev dev path."); +- return 0; +- } +- udev_dev_dir_len = strlen(udev_dev_dir); +- + /* + * Normally, there's always a fallback action by libdevmapper if udev + * has not done its job correctly, e.g. the nodes were not created. +@@ -1049,12 +1039,17 @@ static int _set_up_udev_support(const char *dev_dir) + * is the same as "dev path" used by libdevmapper. + */ + +- /* There's always a slash at the end of dev_dir. But check udev_dev_dir! */ +- if (udev_dev_dir[udev_dev_dir_len - 1] != '/') +- dirs_diff = strncmp(dev_dir, udev_dev_dir, udev_dev_dir_len); +- else +- dirs_diff = strcmp(dev_dir, udev_dev_dir); + ++ /* ++ * DM_UDEV_DEV_DIR always has '/' at its end. ++ * If the dev_dir does not have it, be sure ++ * to make the right comparison without the '/' char! ++ */ ++ if (dev_dir[len - 1] != '/') ++ udev_dir_len--; ++ ++ dirs_diff = udev_dir_len != len || ++ strncmp(DM_UDEV_DEV_DIR, dev_dir, len); + _udev_only = !dirs_diff && (_udev_cookie || !_switches[VERIFYUDEV_ARG]); + + if (dirs_diff) { +@@ -1064,11 +1059,10 @@ static int _set_up_udev_support(const char *dev_dir) + "about udev not working correctly while processing " + "particular nodes will be suppressed. These nodes " + "and symlinks will be managed in each directory " +- "separately.", dev_dir, udev_dev_dir); ++ "separately.", dev_dir, DM_UDEV_DEV_DIR); + dm_udev_set_checking(0); + } + +- udev_unref(udev); + return 1; + } + +-- +1.7.2.1 + diff --git a/sys-fs/lvm2/files/lvm2-start.sh b/sys-fs/lvm2/files/lvm2-start.sh new file mode 100755 index 00000000..ccb5e951 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-start.sh @@ -0,0 +1,37 @@ +# /lib/rcscripts/addons/lvm-start.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh,v 1.7 2007/10/04 16:06:22 cardoe Exp $ + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + /sbin/vgscan --mknodes --ignorelockingfailure >/dev/null + if [ -x /sbin/vgchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] + then + /sbin/vgchange --ignorelockingfailure -a y >/dev/null + fi + eend $? "Failed to setup the LVM" + fi +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3 new file mode 100755 index 00000000..ae3ab052 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3 @@ -0,0 +1,42 @@ +# /lib/rcscripts/addons/lvm-start.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3,v 1.1 2009/08/07 21:02:28 robbat2 Exp $ + +config='global { locking_dir = "/dev/.lvm" }' + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + # Extra PV find pass because some devices might not have been available until very recently + /sbin/pvscan --config "${config}" >/dev/null + # Now make the nodes + /sbin/vgscan --mknodes --config "${config}" >/dev/null + if [ -x /sbin/vgchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] + then + /sbin/vgchange --config "${config}" -a y >/dev/null + fi + eend $? "Failed to setup the LVM" + fi +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.67-r1 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.67-r1 new file mode 100644 index 00000000..7cded061 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.67-r1 @@ -0,0 +1,42 @@ +# /lib/rcscripts/addons/lvm-start.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.67-r1,v 1.2 2012/03/27 03:20:56 robbat2 Exp $ + +config='global { locking_dir = "/dev/.lvm" }' + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + # Extra PV find pass because some devices might not have been available until very recently + /sbin/pvscan --config "${config}" >/dev/null + # Now make the nodes + /sbin/vgscan --mknodes --config "${config}" >/dev/null + if [ -x /sbin/vgchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] + then + /sbin/vgchange --sysinit --config "${config}" -a ly >/dev/null + fi + eend $? "Failed to setup the LVM" + fi +fi + +# vim:ts=4 ft=sh noet: diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.95 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.95 new file mode 100644 index 00000000..979ea474 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.95 @@ -0,0 +1,46 @@ +# /lib/rcscripts/addons/lvm-start.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.95,v 1.1 2012/03/27 03:20:56 robbat2 Exp $ + +config='global { locking_dir = "/dev/.lvm" }' + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break +done +if [ -z "${CDBOOT}" -a -x "$lvm_path" ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + lvm_commands="#! ${lvm_path} --config '${config}'\n" + # Extra PV find pass because some devices might not have been available until very recently + lvm_commands="${lvm_commands}pvscan\n" + # Now make the nodes + lvm_commands="${lvm_commands}vgscan --mknodes\n" + # And turn them on! + lvm_commands="${lvm_commands}vgchange --sysinit -a ly\n" + # Order of this is important, have to work around dash and LVM readline + printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null + eend $? "Failed to setup the LVM" + fi +else + eerror "Cannot find lvm binary in /sbin or /bin!" +fi + +# vim:ts=4 ft=sh noet: diff --git a/sys-fs/lvm2/files/lvm2-stop.sh b/sys-fs/lvm2/files/lvm2-stop.sh new file mode 100755 index 00000000..c1380fe5 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-stop.sh @@ -0,0 +1,61 @@ +# /lib/rcscripts/addons/lvm-stop.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh,v 1.6 2007/10/04 16:06:22 cardoe Exp $ + +# Stop LVM2 +if [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvdisplay ] && \ + [ -x /sbin/vgdisplay ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + # If these commands fail it is not currently an issue + # as the system is going down anyway based on the current LVM + # functionality as described in this forum thread + #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html + + LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort` + VOLUME_GROUPS=`vgdisplay |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort` + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'` + if [ "${LV_IS_ACTIVE}" = 0 ] + then + ebegin " Shutting Down logical volume: ${x} " + lvchange -an --ignorelockingfailure -P ${x} >/dev/null + eend $? + fi + done + + for x in ${VOLUME_GROUPS} + do + VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'` + if [ "${VG_HAS_ACTIVE_LV}" = 0 ] + then + ebegin " Shutting Down volume group: ${x} " + vgchange -an --ignorelockingfailure -P ${x} >/dev/null + eend + fi + done + + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'` + if [ "${LV_IS_ACTIVE}" = 1 ] + then + + ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'` + MOUNTED_DEVICE=${x} + [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`" + [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`" + if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ] + then + ewarn " Unable to shutdown: ${x} " + fi + fi + done + einfo "Finished Shutting down the Logical Volume Manager" +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3 new file mode 100755 index 00000000..83f1884e --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3 @@ -0,0 +1,67 @@ +# /lib/rcscripts/addons/lvm-stop.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3,v 1.1 2009/08/07 21:02:28 robbat2 Exp $ + +config='global { locking_dir = "/dev/.lvm" }' + +# Stop LVM2 +if [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvdisplay ] && \ + [ -x /sbin/vgdisplay ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + # If these commands fail it is not currently an issue + # as the system is going down anyway based on the current LVM + # functionality as described in this forum thread + #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html + + LOGICAL_VOLUMES=`/sbin/lvdisplay --config "${config}" |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort` + VOLUME_GROUPS=`/sbin/vgdisplay --config "${config}" |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort` + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`/sbin/lvdisplay --config "${config}" ${x}|grep "# open"|awk '{print $3}'` + if [ "${LV_IS_ACTIVE}" = 0 ] + then + ebegin " Shutting Down logical volume: ${x} " + /sbin/lvchange -an --config "${config}" -P ${x} >/dev/null + eend $? + fi + done + + for x in ${VOLUME_GROUPS} + do + VG_HAS_ACTIVE_LV=`/sbin/vgdisplay --config "${config}" ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'` + if [ "${VG_HAS_ACTIVE_LV}" = 0 ] + then + ebegin " Shutting Down volume group: ${x} " + /sbin/vgchange -an --config "${config}" -P ${x} >/dev/null + eend + fi + done + + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`/sbin/lvdisplay --config "${config}" ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'` + if [ "${LV_IS_ACTIVE}" = 1 ] + then + if type mountinfo >/dev/null 2>&1; then + ROOT_DEVICE=`mountinfo -t /` + else + ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'` + fi + + MOUNTED_DEVICE=${x} + [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`" + [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`" + if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ] + then + ewarn " Unable to shutdown: ${x} " + fi + fi + done + einfo "Finished Shutting down the Logical Volume Manager" +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.67-r1 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.67-r1 new file mode 100644 index 00000000..a03823ea --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.67-r1 @@ -0,0 +1,31 @@ +# /lib/rcscripts/addons/lvm-stop.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh-2.02.67-r1,v 1.1 2010/06/09 22:41:45 robbat2 Exp $ + +config='global { locking_dir = "/dev/.lvm" }' + +# Stop LVM2 +if [ -x /sbin/vgs ] && \ + [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + + VGS=$(/sbin/vgs --config "${config}" -o vg_name --noheadings --nosuffix 2> /dev/null) + + if [ "$VGS" ] + then + ebegin " Shutting Down logical volumes " + /sbin/lvchange --config "${config}" --sysinit -a ln ${VGS} + eend $? + + ebegin " Shutting Down volume groups " + /sbin/vgchange --config "${config}" --sysinit -a ln + eend $? + fi + + einfo "Finished Shutting down the Logical Volume Manager" +fi + +# vim:ts=4 |