#!/sbin/openrc-run depend() { before checkfs fsck swap after hwdrivers modules device-mapper } dm_in_proc() { local rc=0 i= for i in devices misc; do grep -qs 'device-mapper' /proc/$i rc=$(($rc + $?)) done return $rc } start() { local rc=0 msg= ebegin "Setting up the Logical Volume Manager" if [ -e /proc/modules ] && ! dm_in_proc; then modprobe dm-mod 2>/dev/null fi if [ -d /proc/lvm ] || dm_in_proc; then vgscan --mknodes --ignorelockingfailure vgchange --sysinit --activate y rc=$? else rc=1 fi eend $rc } stop() { ebegin "Shutting down the Logical Volume Manager" vgchange --ignorelockingfailure -a n >/dev/null 2>&1 # At this stage all filesystems except rootfs have been # unmounted. A "standard" error here is failure to deactivate # the VG containing the rootfs (as it is still obviously in use) # so why bother giving a non-zero error code? eend 0 }