summaryrefslogtreecommitdiffstats
path: root/etc/init.d/zfs-functions.in
diff options
context:
space:
mode:
authorTurbo Fredriksson <[email protected]>2015-06-19 16:22:14 +0200
committerBrian Behlendorf <[email protected]>2015-06-25 11:56:47 -0700
commit16421a1dc837eae4cc0b353e7f6616bc6202c013 (patch)
tree22711b41ec44d18954d6ca47bf8b2b634ec6edb1 /etc/init.d/zfs-functions.in
parent216f9d04a651a6b692de9933cc37ee238267a617 (diff)
Additional SYSV init script fixes (3).
* In read_mtab(), fix problems (!?) in the mounts file. It will record 'rpool 1' as 'rpool\0401' instead of 'rpool\00401' which seems to be the correct (at least as far as 'printf' is concerned). Use this using the external 'echo' command (and not the one built in to the shell) because the internal one would interpret the backslash code (incorrectly), giving us a  instead. * Remove reregister_mounts() - no longer needed. * For Gentoo, the zfs_log_failure_msg() should use eend(), not eerror() (which requires an error message, which we don't have). Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3488 Closes #3509 Closes #3514
Diffstat (limited to 'etc/init.d/zfs-functions.in')
-rw-r--r--etc/init.d/zfs-functions.in56
1 files changed, 17 insertions, 39 deletions
diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in
index 372bae803..a2204c157 100644
--- a/etc/init.d/zfs-functions.in
+++ b/etc/init.d/zfs-functions.in
@@ -68,7 +68,7 @@ elif type einfo > /dev/null 2>&1 ; then
# Gentoo functions
zfs_log_begin_msg() { ebegin "$1"; }
zfs_log_end_msg() { eend "$1"; }
- zfs_log_failure_msg() { eerror "$1"; }
+ zfs_log_failure_msg() { eend "$1"; }
# zfs_log_progress_msg() { echo -n "$1"; }
zfs_log_progress_msg() { echo -n; }
else
@@ -304,42 +304,6 @@ checksystem()
return 0
}
-reregister_mounts()
-{
- local fs mntpnt fstype opts rest tmpdir
- tmpdir=removethismountpointhoweverpossible
-
- while read -r fs mntpnt fstype opts rest ; do
- fs=$(printf '%b\n' "$fs")
- mntpnt=$(printf '%b\n' "$mntpnt")
- if [ "$fstype" = "zfs" ] ; then
- if [ "$mntpnt" = "/" ] ; then
- mount -f -o zfsutil -t zfs --move / /$tmpdir
- umount --fake /$tmpdir
- else
- umount --fake "$mntpnt"
- fi
- elif echo "$fs" | grep -qE "^/dev/(zd|zvol)" ; then
- if [ "$mntpnt" = "/" ] ; then
- mount -f -t "$fstype" --move / /$tmpdir
- umount --fake /$tmpdir
- else
- umount --fake "$mntpnt"
- fi
- fi
- done < /proc/mounts
-
- while read -r fs mntpnt fstype opts rest ; do
- fs=$(printf '%b\n' "$fs")
- mntpnt=$(printf '%b\n' "$mntpnt")
- if [ "$fstype" = "zfs" ] ; then
- mount -f -t zfs -o zfsutil "$fs" "$mntpnt"
- elif echo "$fs" | grep -q "^/dev/zd" ; then
- mount -f -t "$fstype" -o "$opts" "$fs" "$mntpnt"
- fi
- done < /proc/mounts
-}
-
get_root_pool()
{
set -- $(mount | grep ' on / ')
@@ -373,9 +337,23 @@ read_mtab()
while read -r fs mntpnt fstype opts rest; do
if echo "$fs $mntpnt $fstype $opts" | grep -qE "$match"; then
+ # * Fix problems (!?) in the mounts file. It will record
+ # 'rpool 1' as 'rpool\0401' instead of 'rpool\00401'
+ # which seems to be the correct (at least as far as
+ # 'printf' is concerned).
+ # * We need to use the external echo, because the
+ # internal one would interpret the backslash code
+ # (incorrectly), giving us a  instead.
+ mntpnt=$(/bin/echo "$mntpnt" | sed "s,\\\0,\\\00,")
+ fs=$(/bin/echo "$fs" | sed "s,\\\0,\\\00,")
+
+ # Replace 'unwanted' characters with underscore.
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,_,g' \
- -e 's,-,_,g' -e 's,\.,_,g')
- eval export MTAB_$mntpnt="$fs"
+ -e 's,-,_,g' -e 's,\.,_,g' -e 's, ,_,g')
+ fs=$(printf '%b\n' "$fs")
+
+ # Set the variable.
+ eval export MTAB_$mntpnt=\"$fs\"
fi
done < /proc/mounts
}