#!/bin/sh

PREREQ="vdev"

prereqs()
{
   echo "$PREREQ"
}

case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac

. /scripts/functions

# This was necessary because LVM autodetect is completely broken.
if [ -x /sbin/vgchange ]; then
   log_begin_msg "Activanting LVM with sysinit (vdev environment)..."
   
   # Force LVM to scan the blocks using sysinit to populate its internal cache
   /sbin/vgscan --sysinit --mknodes --config "activation { udev_sync=0 udev_rules=0 }" >/dev/null 2>&1
   
   # The status change will now work because the internal cache already recognises the drives
   /sbin/vgchange --sysinit -ay --config "activation { udev_sync=0 udev_rules=0 }" >/dev/null 2>&1
   
   log_end_msg
fi
