vp-build/templates/lvm2/files/lvm2.initramfs-local-top
Juan RP 64aea1c5b8 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
2009-10-03 10:58:22 +02:00

67 lines
1011 B
Bash

#!/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