lvm2: update to 2.02.53, convert to subpkgs.

Add initramfs hook and the OpenRC service, seems to work fine so far.

--HG--
extra : convert_revision : bfedf452f27339d9e37ffb251800431a17dbef9b
This commit is contained in:
Juan RP 2009-10-03 10:58:22 +02:00
parent 6dab476f7b
commit 64aea1c5b8
6 changed files with 168 additions and 12 deletions

View file

@ -0,0 +1,34 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
if [ ! -x /sbin/lvm ]; then
exit 0
fi
. /usr/share/initramfs-tools/hook-functions
if [ -e /etc/lvm/lvm.conf ]; then
mkdir -p ${DESTDIR}/etc/lvm
cp /etc/lvm/lvm.conf ${DESTDIR}/etc/lvm/
fi
copy_exec /sbin/dmsetup
copy_exec /sbin/lvm
ln -s lvm ${DESTDIR}/sbin/vgchange
for x in dm_mod dm_snapshot dm_mirror; do
manual_add_modules ${x}
done

View file

@ -0,0 +1,66 @@
#!/bin/sh
PREREQ="mdadm mdrun multipath"
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
activate_vg()
{
local dev="$1"
# Make sure that we have a non-empty argument
if [ -z "$dev" ]; then
return 1
fi
# Take care of lilo boot arg, risky activating of all vg
case "$dev" in
fe[0-9]*)
lvm vgchange -aly --ignorelockingfailure
exit 0
;;
# FIXME: check major
/dev/root)
lvm vgchange -aly --ignorelockingfailure
exit 0
;;
esac
# Make sure that we have a d-m path
dev="${dev#/dev/mapper/}"
if [ "$dev" = "$1" ]; then
return 1
fi
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev")
if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ]; then
lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME"
rc=$?
if [ $rc = 5 ]; then
echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME"
fi
fi
}
if [ ! -e /sbin/lvm ]; then
exit 0
fi
modprobe -q dm-mod
activate_vg "$ROOT"
activate_vg "$resume"
exit 0

View file

@ -0,0 +1,27 @@
#!/sbin/runscript
#
# OpenRC service for LVM.
name="LVM service"
depend()
{
need devfs
before checkfs fsck
}
start()
{
ebegin "Activating LVM volumes"
modprobe -q dm-mod 2>/dev/null
lvm vgscan --ignorelockingfailure --mknodes && \
lvm vgchange --ignorelockingfailure -a y >/dev/null
eend $?
}
stop()
{
ebegin "Deactivating LVM volumes"
lvm vgchange --ignorelockingfailure -an 2>&1 >/dev/null
eend $?
}