From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9E8171388C1 for ; Mon, 28 Dec 2015 00:30:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A53CAE07A5; Mon, 28 Dec 2015 00:30:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 35587E07A5 for ; Mon, 28 Dec 2015 00:30:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DE43033FDBF for ; Mon, 28 Dec 2015 00:30:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6020ECEE for ; Mon, 28 Dec 2015 00:30:14 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1451262541.ef66b97c3c1778c3c8e9f96d80057ad7a1a3e2f4.robbat2@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/files/, sys-fs/lvm2/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-fs/lvm2/files/lvm.rc-2.02.116-r3 sys-fs/lvm2/lvm2-2.02.116-r3.ebuild X-VCS-Directories: sys-fs/lvm2/ sys-fs/lvm2/files/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: ef66b97c3c1778c3c8e9f96d80057ad7a1a3e2f4 X-VCS-Branch: master Date: Mon, 28 Dec 2015 00:30:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6cdb3e8b-9cbf-455e-b185-9947c1bf6a96 X-Archives-Hash: a593b8e8fe0f2c7a9130470cf4a49bbe commit: ef66b97c3c1778c3c8e9f96d80057ad7a1a3e2f4 Author: Doug Goldstein gentoo org> AuthorDate: Thu Dec 24 23:28:35 2015 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Mon Dec 28 00:29:01 2015 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef66b97c sys-fs/lvm2: conditionally depend on lvmetad If the user has configured their system to be dependent on lvmetad in /etc/lvm/lvm.conf then we need to depend on lvmetad starting up. Otherwise it shouldn't be necessary and won't be started. Gentoo-Bug: 503016 Gentoo-Bug: 525614 Gentoo-Bug: 554918 Gentoo-Bug: 565154 Signed-off-by: Doug Goldstein gentoo.org> Signed-off-by: Robin H. Johnson gentoo.org> sys-fs/lvm2/files/lvm.rc-2.02.116-r3 | 134 +++++++++++++++++++++++++++++++++++ sys-fs/lvm2/lvm2-2.02.116-r3.ebuild | 2 +- 2 files changed, 135 insertions(+), 1 deletion(-) diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.116-r3 b/sys-fs/lvm2/files/lvm.rc-2.02.116-r3 new file mode 100644 index 0000000..059e880 --- /dev/null +++ b/sys-fs/lvm2/files/lvm.rc-2.02.116-r3 @@ -0,0 +1,134 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +_get_lvm_path() { + local lvm_path= + for lvm_path in /bin/lvm /sbin/lvm ; do + [ -x "$lvm_path" ] && break + done + echo "${lvm_path}" +} + +_need_lvmetad() +{ + local lvm_path="$(_get_lvm_path)" + [ ! -x "${lvm_path}" ] && return 1 + ${lvm_path} dumpconfig global | grep -q 'use_lvmetad=1' +} + +depend() { + before checkfs fsck + after modules device-mapper + need lvmetad sysfs + # We may use lvmetad based on the configuration. If we added lvmetad + # support while lvm2 is running then we aren't dependent on it. For the + # more common case, if its disabled in the config we aren't dependent + # on it. + config /etc/lvm/lvm.conf + local _need= + if service_started; then + _need=$(service_get_value need) + else + if _need_lvmetad; then + _need="${_need} lvmetad" + fi + fi + need ${_need} +} + +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 + lvm_path="$(_get_lvm_path)" + 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 +} + +start_post() +{ + # Save if we needed lvmetad + if _need_lvmetad; then + service_set_value need lvmetad + 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 --rows 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 ${VGS}\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 (possibly some LVs still needed for /usr or root)" + fi + + einfo "Finished shutting down the Logical Volume Manager" + return 0 +fi +} + +# vim:ts=4 diff --git a/sys-fs/lvm2/lvm2-2.02.116-r3.ebuild b/sys-fs/lvm2/lvm2-2.02.116-r3.ebuild index 3146e3c..e62a3b6 100644 --- a/sys-fs/lvm2/lvm2-2.02.116-r3.ebuild +++ b/sys-fs/lvm2/lvm2-2.02.116-r3.ebuild @@ -227,7 +227,7 @@ src_install() { if use !device-mapper-only ; then newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd - newinitd "${FILESDIR}"/lvm.rc-2.02.105-r2 lvm + newinitd "${FILESDIR}"/lvm.rc-2.02.116-r3 lvm newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring