mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Original-patch-by: @jgoerzen Signed-off-by: Benjamin Albrecht <git@albrecht.io> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes zfsonlinux/pkg-zfs#102 Closes #4029
		
			
				
	
	
		
			61 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1014 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
PREREQ="mdadm mdrun multipath"
 | 
						|
 | 
						|
prereqs()
 | 
						|
{
 | 
						|
        echo "$PREREQ"
 | 
						|
}
 | 
						|
 | 
						|
case $1 in
 | 
						|
# get pre-requisites
 | 
						|
prereqs)
 | 
						|
        prereqs
 | 
						|
        exit 0
 | 
						|
        ;;
 | 
						|
esac
 | 
						|
 | 
						|
 | 
						|
#
 | 
						|
# Helper functions
 | 
						|
#
 | 
						|
message()
 | 
						|
{
 | 
						|
        if [ -x /bin/plymouth ] && plymouth --ping; then
 | 
						|
                plymouth message --text="$@"
 | 
						|
        else
 | 
						|
                echo "$@" >&2
 | 
						|
        fi
 | 
						|
        return 0
 | 
						|
}
 | 
						|
 | 
						|
udev_settle()
 | 
						|
{
 | 
						|
        # Wait for udev to be ready, see https://launchpad.net/bugs/85640
 | 
						|
        if [ -x /sbin/udevadm ]; then
 | 
						|
                /sbin/udevadm settle --timeout=30
 | 
						|
        elif [ -x /sbin/udevsettle ]; then
 | 
						|
                /sbin/udevsettle --timeout=30
 | 
						|
        fi
 | 
						|
        return 0
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
activate_vg()
 | 
						|
{
 | 
						|
        # Sanity checks
 | 
						|
        if [ ! -x /sbin/lvm ]; then
 | 
						|
                message "lvm is not available"
 | 
						|
                return 1
 | 
						|
        fi
 | 
						|
 | 
						|
        # Detect and activate available volume groups
 | 
						|
        /sbin/lvm vgscan
 | 
						|
        /sbin/lvm vgchange -a y --sysinit
 | 
						|
        return $?
 | 
						|
}
 | 
						|
 | 
						|
udev_settle
 | 
						|
activate_vg
 | 
						|
 | 
						|
exit 0
 |