summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Zoffoli <xmerlin@gentoo.org>2005-03-25 15:45:29 +0000
committerChristian Zoffoli <xmerlin@gentoo.org>2005-03-25 15:45:29 +0000
commit2a89d91af2ccab3087c4483173f8eb49059ec47d (patch)
treeec9e92d8c56611f9f5a52649170ef33b12ce29f6 /sys-fs/clvm
parentstable on amd64 (diff)
downloadhistorical-2a89d91af2ccab3087c4483173f8eb49059ec47d.tar.gz
historical-2a89d91af2ccab3087c4483173f8eb49059ec47d.tar.bz2
historical-2a89d91af2ccab3087c4483173f8eb49059ec47d.zip
improved init script (added dm-mod loading, merged lvm2-start/stop routines), removed old lvm2-start/stop scripts
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'sys-fs/clvm')
-rw-r--r--sys-fs/clvm/ChangeLog6
-rw-r--r--sys-fs/clvm/Manifest16
-rw-r--r--sys-fs/clvm/clvm-2.00.33.ebuild5
-rwxr-xr-xsys-fs/clvm/files/clvmd.rc116
-rwxr-xr-xsys-fs/clvm/files/lvm2-start.sh24
-rwxr-xr-xsys-fs/clvm/files/lvm2-stop.sh59
6 files changed, 111 insertions, 115 deletions
diff --git a/sys-fs/clvm/ChangeLog b/sys-fs/clvm/ChangeLog
index 9f67f9eeae69..1112b30b3cbd 100644
--- a/sys-fs/clvm/ChangeLog
+++ b/sys-fs/clvm/ChangeLog
@@ -1,11 +1,15 @@
# ChangeLog for sys-fs/clvm
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/ChangeLog,v 1.2 2005/03/25 11:51:20 swegener Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/ChangeLog,v 1.3 2005/03/25 15:45:29 xmerlin Exp $
25 Mar 2005; Sven Wegener <swegener@gentoo.org> clvm-2.00.33.ebuild:
Fixed invalid atoms in *DEPEND. Use MY_P. Install initscript in correct
location.
+ 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> :
+ improved init script (added dm-mod loading, merged lvm2-start/stop routines),
+ removed old lvm2-start/stop scripts
+
*clvm-2.00.33 (25 Mar 2005)
25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> +metadata.xml,
diff --git a/sys-fs/clvm/Manifest b/sys-fs/clvm/Manifest
index 1391bdd33b06..b57ef9a4d3a8 100644
--- a/sys-fs/clvm/Manifest
+++ b/sys-fs/clvm/Manifest
@@ -1,17 +1,15 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-MD5 ad3a872d9b7ab02046867de437c97f64 clvm-2.00.33.ebuild 1552
-MD5 aa493e75de6129f73b41a8e9d599f152 ChangeLog 557
+MD5 9605188341f3e00fe852582b2f42a8bf clvm-2.00.33.ebuild 1428
MD5 a64b9a1937a5cfc2fbaf373521f65d47 metadata.xml 223
-MD5 7bb09bc515a6c0f39294cd3aef39468b files/clvmd.rc 1814
-MD5 5799d210cc1e403a0d7693b8f75a3e91 files/lvm2-start.sh 778
+MD5 54bcd14dc1a60d18f3bd6ecaed81176f ChangeLog 731
+MD5 bf0fb4d67afee82ab80c68968c79009c files/clvmd.rc 3668
MD5 f8399f304f8ba8257277f8e57b0c4687 files/digest-clvm-2.00.33 61
-MD5 8206ba47bdd3c586096e8f316c503fb9 files/lvm2-stop.sh 1743
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.1 (GNU/Linux)
+Version: GnuPG v1.2.6 (GNU/Linux)
-iD8DBQFCQ/tOI1lqEGTUzyQRApZ3AJ4tiC69phYyO7OFGgElYgOxfRDudgCbBkZ0
-PPwGV1BkxxCeGOhxWKIM3Xo=
-=dQPF
+iD8DBQFCRDPggMUyd/cdjWsRAsOBAJ97Kt5VpOjSQHxm2o7y8L9vkADcAwCfZUq1
+Ur4eEIZotAo7rRhPHGTt8Zk=
+=Ucj9
-----END PGP SIGNATURE-----
diff --git a/sys-fs/clvm/clvm-2.00.33.ebuild b/sys-fs/clvm/clvm-2.00.33.ebuild
index c763cbe7e63c..3870323370ab 100644
--- a/sys-fs/clvm/clvm-2.00.33.ebuild
+++ b/sys-fs/clvm/clvm-2.00.33.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.00.33.ebuild,v 1.2 2005/03/25 11:51:20 swegener Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.00.33.ebuild,v 1.3 2005/03/25 15:45:29 xmerlin Exp $
MY_P="${PN/clvm/LVM2}.${PV}"
@@ -48,9 +48,6 @@ src_install() {
mv -f "${D}/sbin/lvm.static" "${D}/sbin/lvm"
dodoc COPYING* INSTALL README VERSION WHATS_NEW doc/*.{conf,c,txt}
- insinto /lib/rcscripts/addons
- newins ${FILESDIR}/lvm2-start.sh lvm-start.sh
- newins ${FILESDIR}/lvm2-stop.sh lvm-stop.sh
newinitd ${FILESDIR}/clvmd.rc clvmd || die
}
diff --git a/sys-fs/clvm/files/clvmd.rc b/sys-fs/clvm/files/clvmd.rc
index c2e640e30c7f..7f677e705573 100755
--- a/sys-fs/clvm/files/clvmd.rc
+++ b/sys-fs/clvm/files/clvmd.rc
@@ -1,29 +1,41 @@
#!/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/clvm/files/clvmd.rc,v 1.1 2005/03/25 02:32:08 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/clvmd.rc,v 1.2 2005/03/25 15:45:29 xmerlin Exp $
depend() {
use dns logger
use net
need cluster-manager cluster-locking-manager fenced
}
+
exefile=/sbin/clvmd
-start() {
- ebegin "Activating LVM volumes (locally)"
- /sbin/vgchange -aly
- eend $?
+load_modules() {
+ local module modules
+ modules=$1
- ebegin "Starting clvmd"
- start-stop-daemon --start --quiet \
- --exec ${exefile}
- eend $?
+ 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)"
+ local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
if [ -n "${remaining}" ]
then
@@ -41,7 +53,7 @@ umount_gfs_filesystems() {
umount ${remaining} &>/dev/null
eend $? "Failed to unmount GFS filesystems"
fi
- remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
+ remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
[ -z "${remaining}" ] && break
/bin/fuser -k -m ${sig} ${remaining} &>/dev/null
sleep 5
@@ -51,18 +63,86 @@ umount_gfs_filesystems() {
fi
}
+
+
+start() {
+
+ local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/modules)
+ if [ -z "${module}" ]; then
+ load_modules dm-mod
+ sleep 1s
+ fi
+
+ ebegin "Scanning LVM volumes"
+ /sbin/vgscan &>/dev/null
+ eend $?
+
+ if [ "$?" -eq 0 ] && [ -x /sbin/vgchange ] && [ -f /etc/lvmtab -o -d /etc/lvm ]
+ then
+ ebegin "Setting up the Logical Volume Manager"
+ /sbin/vgchange -aly >/dev/null
+ eend $? "Failed to setup the LVM"
+
+ if [ "$?" -eq 0 ]; then
+ ebegin "Starting clvmd"
+ start-stop-daemon --start --quiet --exec ${exefile}
+ eend $?
+ fi
+ fi
+
+}
+
stop() {
# umount GFS filesystems
umount_gfs_filesystems
- ebegin "Deactivating LVM volumes (locally)"
- /sbin/vgchange -aln
- eend $?
-
+ einfo "Shutting down the Logical Volume Manager"
+
+ LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|awk '{print $3}'|sort|xargs echo`
+ VOLUME_GROUPS=`vgdisplay |grep "VG Name"|awk '{print $3}'|sort|xargs echo`
+ 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"|awk '{print $3}'|xargs echo`
+ 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"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+
+ ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'`
+ if [ ! ${ROOT_DEVICE} = ${x} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+
ebegin "Stopping clvmd"
- start-stop-daemon --stop --quiet \
- --exec ${exefile}
-
+ start-stop-daemon --stop --quiet --exec ${exefile}
eend $?
+
+ if [ "$?" -eq 0 ]; then
+ unload_modules dm-mod
+ fi
}
diff --git a/sys-fs/clvm/files/lvm2-start.sh b/sys-fs/clvm/files/lvm2-start.sh
deleted file mode 100755
index 8d52509da475..000000000000
--- a/sys-fs/clvm/files/lvm2-start.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-# /lib/rcscripts/addons/lvm2-start.sh
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/lvm2-start.sh,v 1.1 2005/03/25 02:32:08 xmerlin Exp $
-
-# 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 ] && \
- [ -d /proc/lvm -o "$(grep device-mapper /proc/misc 2>/dev/null)" ]
-then
- ebegin "Setting up the Logical Volume Manager"
- #still echo stderr for debugging
- /sbin/vgscan >/dev/null
- if [ "$?" -eq 0 ] && [ -x /sbin/vgchange ] && \
- [ -f /etc/lvmtab -o -d /etc/lvm ]
- then
- /sbin/vgchange -a y >/dev/null
- fi
- eend $? "Failed to setup the LVM"
-fi
-
-# vim:ts=4
diff --git a/sys-fs/clvm/files/lvm2-stop.sh b/sys-fs/clvm/files/lvm2-stop.sh
deleted file mode 100755
index 7ffab6dc2a86..000000000000
--- a/sys-fs/clvm/files/lvm2-stop.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-# /lib/rcscripts/addons/lvm2-stop.sh
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/lvm2-stop.sh,v 1.1 2005/03/25 02:32:08 xmerlin 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"|awk '{print $3}'|sort|xargs echo`
- VOLUME_GROUPS=`vgdisplay |grep "VG Name"|awk '{print $3}'|sort|xargs echo`
- 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"|awk '{print $3}'|xargs echo`
- 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"|awk '{print $3}'`
- if [ "${LV_IS_ACTIVE}" = 1 ]
- then
-
- ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'`
- if [ ! ${ROOT_DEVICE} = ${x} ]
- then
- ewarn " Unable to shutdown: ${x} "
- fi
- fi
- done
- einfo "Finished Shutting down the Logical Volume Manager"
-fi
-
-# vim:ts=4