Restore previous handling of real_root due to report of regressions (bug #419965)
[genkernel.git] / defaults / initrd.scripts
index 5d523abda23b38655ff384526867d6500ce69862..258f2bd0ebe6e429f581f7eee531d2ac00980e15 100755 (executable)
@@ -404,13 +404,6 @@ prompt_user(){
        esac
 }
 
-setup_hotplug() {
-       if [ "${KV_2_6_OR_GREATER}" ]
-       then
-               echo /sbin/mdev > /proc/sys/kernel/hotplug
-       fi
-}
-
 setup_slowusb() {
        # This function removes unset DO_slowusb if there is no usb-storage attached.
        # If noslowusb is set, skip this function
@@ -606,7 +599,12 @@ startVolumes() {
        
        if [ "${USE_MDADM}" = '1' ]
        then
-               /sbin/mdadm --assemble --scan
+               if [ -e '/sbin/mdadm' ]
+               then
+                       /sbin/mdadm --assemble --scan
+               else
+                       bad_msg "mdadm not found: skipping mdadm raid assembly!"
+               fi
        fi
 
        if [ "${USE_DMRAID_NORMAL}" = '1' ]
@@ -656,7 +654,36 @@ startVolumes() {
        
        if [ "${USE_ZFS}" = '1' ]
        then
-               /sbin/zpool import -N -a ${ZPOOL_FORCE}
+               if [ -z "${ZFS_POOL}" ]
+               then
+                       good_msg "Importing ZFS pools"
+
+                       /sbin/zpool import -N -a "${ZPOOL_FORCE}"
+
+                       if [ "$?" = '0' ]
+                       then
+                               good_msg "Importing ZFS pools succeeded"
+                       else
+                               bad_msg "Imported ZFS pools failed"
+                       fi
+               else
+
+                       if [ "$(zpool list -H -o name ${ZFS_POOL} 2>&1)" = "$ZFS_POOL" ]
+                       then
+                               good_msg "ZFS pool ${ZFS_POOL} already imported"
+                       else
+                               good_msg "Importing ZFS pool ${ZFS_POOL}"
+
+                               /sbin/zpool import -N "${ZPOOL_FORCE}" "${ZFS_POOL}"
+
+                               if [ "$?" = '0' ]
+                               then
+                                       good_msg "Importing ${ZFS_POOL} succeeded"
+                               else
+                                       bad_msg "Importing ${ZFS_POOL} failed"
+                               fi
+                       fi
+               fi
        fi
 }
 
@@ -774,7 +801,7 @@ openLUKS() {
                                        fi
 
                                        if [ "${retval}" -ne 0 ]; then
-                                               REAL_LUKS=`blkid -l -t "${LUKS_DEVICE}" | cut -d ":" -f 1 2>/dev/null`
+                                               REAL_LUKS=`blkid -o device -l -t "${LUKS_DEVICE}"`
                                                retval=$?
                                        fi