if [ "${USE_ZFS}" = '1' ]
then
- if [ -z "${ZFS_POOL}" ];
+ if [ -z "${ZFS_POOL}" ]
then
good_msg "Importing ZFS pools"
bad_msg "Imported ZFS pools failed"
fi
else
- good_msg "Importing ZFS pool ${ZFS_POOL}"
- /sbin/zpool import -N "${ZPOOL_FORCE}" "${ZFS_POOL}"
-
- if [ "$?" = '0' ]
+ if [ "$(zpool list -H -o name ${ZFS_POOL} 2>&1)" = "$ZFS_POOL" ]
then
- good_msg "Importing ${ZFS_POOL} succeeded"
+ good_msg "ZFS pool ${ZFS_POOL} already imported"
else
- bad_msg "Importing ${ZFS_POOL} failed"
+ 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