summaryrefslogtreecommitdiffstats
path: root/etc/init.d/zfs-import.in
diff options
context:
space:
mode:
authorTurbo Fredriksson <[email protected]>2015-06-02 16:02:31 +0200
committerBrian Behlendorf <[email protected]>2015-06-05 12:35:39 -0700
commit4f38c25910b445277acb9513c36de8305f9457c6 (patch)
treea7ba7a493193341503b27d57cc36440f6e753645 /etc/init.d/zfs-import.in
parent2a34db1bdbcecf5019c4a59f2a44c92fe82010f2 (diff)
SYSV init script fixes.
* Change the order of the function library check/load. Redhat based system _can_ have a /lib/lsb/init-functions file (from the redhat-lsb-core package), but it's only partially what we can use. Instead, look for that file last, giving the script a chance to catch the 'real' distribution file. * Filter out dashes and dots in dataset name in read_mtab(). * Get rid of 'awk' entirely. This is usually in /usr, which might not be availible. * Get rid of the 'find /dev/disk/by-*' (find is on /usr, which might not be availible). Instead use echo in a for loop. * Rebuild scripts if any of the *.in files changed. * Move the sed part that filters out duplicates inside the check fo valid variable. Signed-off-by: Turbo Fredriksson [email protected] Signed-off-by: Brian Behlendorf <[email protected]> Closes #3463 Closes #3457
Diffstat (limited to 'etc/init.d/zfs-import.in')
-rwxr-xr-xetc/init.d/zfs-import.in24
1 files changed, 16 insertions, 8 deletions
diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in
index 1bc3ebe9a..dc674c49e 100755
--- a/etc/init.d/zfs-import.in
+++ b/etc/init.d/zfs-import.in
@@ -88,13 +88,13 @@ do_import()
# make sure we're able to actually import it/them later.
USE_DISK_BY_ID='yes'
- # Filter out duplicates (pools found with the simpl
- # "zpool import" but which is also found with the
- # "zpool import -d ...").
- npools=$(echo "$npools" | sed "s,$available_pools,,")
-
if [ -n "$available_pools" ]
then
+ # Filter out duplicates (pools found with the simpl
+ # "zpool import" but which is also found with the
+ # "zpool import -d ...").
+ npools=$(echo "$npools" | sed "s,$available_pools,,")
+
# Add the list to the existing list of
# available pools
available_pools="$available_pools;$npools"
@@ -141,14 +141,22 @@ do_import()
if [ -n "$USE_DISK_BY_ID" -a -z "$ZPOOL_IMPORT_PATH" ]
then
local dirs
- dirs="$(find /dev/disk/by-* -maxdepth 0 -type d | \
- grep -v by-vdev)"
- dirs="$(echo "$dirs" | sed 's, ,:,g')"
+ dirs="$(for dir in $(echo /dev/disk/by-*)
+ do
+ # Ignore by-vdev here - we wan't it first!
+ echo "$dir" | grep -q /by-vdev && continue
+ [ ! -d "$dir" ] && continue
+
+ echo -n "$dir:"
+ done | sed 's,:$,,g')"
+
if [ -d "/dev/disk/by-vdev" ]
then
# Add by-vdev at the beginning.
ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:"
fi
+
+ # ... and /dev at the very end, just for good measure.
ZPOOL_IMPORT_PATH="$ZPOOL_IMPORT_PATH$dirs:/dev"
fi