Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of common code between the SYSV init and initramfs scripts.
* Move code from the SYSV init and initramfs scripts that is better served in a common code base library (zfs-functions). * Dracut have the func emergency_shell() which does a little more. For those that don't have it, just run '/bin/sh -i -l'. * zfs_set_ifs() needs to be a global func. Use this in zfs_run_cmd() before we run the actual command. Fixing some issues disovered. * Use "${VAR}" instead of "$VAR". * Add some comments to functions that didn't have any. * Create zfs_run_cmd() which records stderr, exit code etc. * Create check_boolean() to check if a user config option is set ('yes', 'Yes', 'YES' or any combination there of) OR '1'. Anything else is considered 'unset'. * Put the check for zfs debugging in check_zfs_debug(). Use this in zfs_action() to check if we should output the message we're called with. * Move code snippet that fetches and mounts recursive filesystems into the new recursive_mount_filesystems() function. * Minor fix/change to read_mtab(): * Strip control characters (space - \040) from /proc/mounts GLOBALY, not just first occurrence. * Don't replace unprintable characters ([/-. ]) for use in the variable name with underscore. No need, just remove them all together. * Instead of using ZFS_CMD+zfs_action()+zfs_log_failure_msg() etc each and every time, use the more generic zfs_action() that does most of this for us. * Downside: Won't accept pools with spaces in them any more :(. Need to find a way to solve this (can't use arrays, because we're not running under bash!). * Apparently "var > 0" doesn't work. Use 'var -gt 0' instead. But that means that 'var' needs to be set. * (Re)set IFS in zfs_action() as first step so that command line options doesn't get clobbered. * Fix checking if pool is imported in import_pool(). * Remove "sort". Sometimes not available, and not really nessesary. Signed-off-by: Turbo Fredriksson <[email protected]> Closes openzfs#3782 Closes pkg-zfs/openzfs#166
- Loading branch information