diff options
author | наб <[email protected]> | 2021-05-16 16:18:30 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-05-20 08:55:47 -0700 |
commit | adc851d9f83579f31903007e3ce0af24faceb21b (patch) | |
tree | e28be1149e5e1ba076c52960c9c528b4de448db0 /etc/init.d/zfs-import.in | |
parent | 9627bdc6970558c9d59e0f9a0a2b4397cd6170e7 (diff) |
d/zfsutils.zfs.init derivatives: shellcheck, fix header
Reviewed-by: John Kennedy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12042
Diffstat (limited to 'etc/init.d/zfs-import.in')
-rwxr-xr-x | etc/init.d/zfs-import.in | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in index 714cc6c08..6b1b2f243 100755 --- a/etc/init.d/zfs-import.in +++ b/etc/init.d/zfs-import.in @@ -26,10 +26,8 @@ # # Released under the 2-clause BSD license. # -# The original script that acted as a template for this script came from -# the Debian GNU/Linux kFreeBSD ZFS packages (which did not include a -# licensing stansa) in the commit dated Mar 24, 2011: -# https://github.com/zfsonlinux/pkg-zfs/commit/80a3ae582b59c0250d7912ba794dca9e669e605a +# This script is based on debian/zfsutils.zfs.init from the +# Debian GNU/kFreeBSD zfsutils 8.1-3 package, written by Aurelien Jarno. # Source the common init script . @sysconfdir@/zfs/zfs-functions @@ -56,16 +54,13 @@ do_verbatim_import() # Support function to get a list of all pools, separated with ';' find_pools() { - local CMD="$*" local pools - pools=$($CMD 2> /dev/null | \ + pools=$("$@" 2> /dev/null | \ grep -E "pool:|^[a-zA-Z0-9]" | \ sed 's@.*: @@' | \ sort | \ - while read pool; do \ - echo -n "$pool;" - done) + tr '\n' ';') echo "${pools%%;}" # Return without the last ';'. } @@ -80,7 +75,7 @@ do_import_all_visible() [ -n "$init" ] && rm -f /etc/dfs/sharetab # Just simplify code later on. - if [ -n "$USE_DISK_BY_ID" -a "$USE_DISK_BY_ID" != 'yes' ] + if [ -n "$USE_DISK_BY_ID" ] && [ "$USE_DISK_BY_ID" != 'yes' ] then # It's something, but not 'yes' so it's no good to us. unset USE_DISK_BY_ID @@ -153,7 +148,7 @@ do_import_all_visible() # to something we can use later with the real import(s). We want to # make sure we find all by* dirs, BUT by-vdev should be first (if it # exists). - if [ -n "$USE_DISK_BY_ID" -a -z "$ZPOOL_IMPORT_PATH" ] + if [ -n "$USE_DISK_BY_ID" ] && [ -z "$ZPOOL_IMPORT_PATH" ] then local dirs dirs="$(for dir in $(echo /dev/disk/by-*) @@ -231,7 +226,7 @@ do_import_all_visible() # using the cache file soon and that might succeed. [ ! -f "$ZPOOL_CACHE" ] && zfs_log_end_msg "$RET" - if [ "$r" -gt 0 -a -f "$ZPOOL_CACHE" ] + if [ "$r" -gt 0 ] && [ -f "$ZPOOL_CACHE" ] then # Failed to import without a cache file. Try WITH... if [ -z "$init" ] && check_boolean "$VERBOSE_MOUNT" @@ -254,7 +249,7 @@ do_import_all_visible() [ -n "$init" ] && zfs_log_end_msg "$RET" IFS="$OLD_IFS" - [ -n "$already_imported" -a -z "$available_pools" ] && return 0 + [ -n "$already_imported" ] && [ -z "$available_pools" ] && return 0 return "$RET" } |