Skip to content

Commit

Permalink
Some minor fixes to the initramfs script.
Browse files Browse the repository at this point in the history
* Apparently "var > 0" doesn't work. Use 'var -gt 0' instead. But that
  means that 'var' needs to be set, so set this to '0' if it's not already
  set at the beginning of the initrd script.
* Fixing return variable from a bunch of assist functions.
  Returned false when they should have returned true!
  Thanx to markdesouza @ GitHub for help findind this.
  Closes: openzfs#3869
  • Loading branch information
FransUrbo committed Oct 2, 2015
1 parent a7940e1 commit 57debc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
8 changes: 6 additions & 2 deletions contrib/initramfs/scripts/zfs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ ZPOOL="/sbin/zpool"
ZPOOL_CACHE="/etc/zfs/zpool.cache"
export ZFS ZPOOL ZPOOL_CACHE

# Needs to be set for rest of the code to work.
[ -z "${ZFS_INITRD_PRE_MOUNTROOT_SLEEP}" ] && ZFS_INITRD_PRE_MOUNTROOT_SLEEP=0
[ -z "${ZFS_INITRD_POST_MODPROBE_SLEEP}" ] && ZFS_INITRD_POST_MODPROBE_SLEEP=0

# This runs any scripts that should run before we start importing
# pools and mounting any filesystems.
pre_mountroot()
Expand Down Expand Up @@ -44,7 +48,7 @@ pre_mountroot()
# with more logging etc.
load_module_initrd()
{
if [ "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP" > 0 ]
if [ "$ZFS_INITRD_PRE_MOUNTROOT_SLEEP" -gt 0 ]
then
check_boolean "$quiet" || \
zfs_log_begin_msg "Sleeping for" \
Expand All @@ -67,7 +71,7 @@ load_module_initrd()
# Load the module
load_module "zfs" || return 1

if [ "$ZFS_INITRD_POST_MODPROBE_SLEEP" > 0 ]
if [ "$ZFS_INITRD_POST_MODPROBE_SLEEP" -gt 0 ]
then
check_boolean "$quiet" || \
zfs_log_begin_msg "Sleeping for" \
Expand Down
14 changes: 0 additions & 14 deletions contrib/shell-common/zfs-functions.in
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,6 @@ import_pool()
else
return 1
fi
else
return 1
fi
fi

Expand Down Expand Up @@ -801,8 +799,6 @@ mount_fs()
else
return 1
fi
else
return 1
fi

return 0
Expand Down Expand Up @@ -844,8 +840,6 @@ decrypt_fs()
else
return 1
fi
else
return 1
fi
done

Expand All @@ -868,8 +862,6 @@ decrypt_fs()
else
return 1
fi
else
return 1
fi

return 0
Expand Down Expand Up @@ -897,8 +889,6 @@ destroy_fs()
else
return 1
fi
else
return 1
fi

return 0
Expand Down Expand Up @@ -939,8 +929,6 @@ clone_snap()
else
return 1
fi
else
return 1
fi

return 0
Expand All @@ -966,8 +954,6 @@ rollback_snap()
else
return 1
fi
else
return 1
fi

return 0
Expand Down

0 comments on commit 57debc5

Please sign in to comment.