From ecdb16659bca4e1d802c886faecdd92d3d0583fa Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 27 Jul 2013 17:44:39 +0200 Subject: [PATCH] linuxrc: move zfs initialization code to zfs_init() in initrd.scripts --- defaults/initrd.scripts | 28 ++++++++++++++++++++++++++++ defaults/linuxrc | 27 ++------------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 19e3cc7..834eff9 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -836,6 +836,34 @@ wait_for_zfs() { while [ ! -c /dev/zfs ]; do modprobe zfs 2> /dev/null; done; } +zfs_init() { + # Set variables based on the value of REAL_ROOT + case "${REAL_ROOT}" in + ZFS=*) + ZFS_POOL=${REAL_ROOT#*=} + ZFS_POOL=${ZFS_POOL%%/*} + USE_ZFS=1 + ;; + ZFS) + USE_ZFS=1 + ;; + esac + + # Verify that it is safe to use ZFS + if [ "USE_ZFS" = "1" ] + then + for i in /sbin/zfs /sbin/zpool + do + if [ ! -x ${i} ] + then + USE_ZFS=0 + bad_msg 'Aborting use of zfs because ${i} not found!' + break + fi + done + fi +} + start_volumes() { #good_msg 'Checking if volumes need to be started...' diff --git a/defaults/linuxrc b/defaults/linuxrc index 09047ba..998890f 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -275,31 +275,8 @@ then fi fi -# Set variables based on the value of REAL_ROOT -case "${REAL_ROOT}" in - ZFS=*) - ZFS_POOL=${REAL_ROOT#*=} - ZFS_POOL=${ZFS_POOL%%/*} - USE_ZFS=1 - ;; - ZFS) - USE_ZFS=1 - ;; -esac - -# Verify that it is safe to use ZFS -if [ "USE_ZFS" = "1" ] -then - for i in /sbin/zfs /sbin/zpool - do - if [ ! -x ${i} ] - then - USE_ZFS=0 - bad_msg 'Aborting use of zfs because ${i} not found!' - break - fi - done -fi +# initialize ZFS filesystems +zfs_init cmdline_hwopts