aboutsummaryrefslogtreecommitdiffstats
path: root/etc
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
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')
-rw-r--r--etc/init.d/zfs-functions.in56
-rwxr-xr-xetc/init.d/zfs-mount.in20
2 files changed, 22 insertions, 54 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
}
diff --git a/etc/init.d/zfs-mount.in b/etc/init.d/zfs-mount.in
index 50a0aef04..e26813d90 100755
--- a/etc/init.d/zfs-mount.in
+++ b/etc/init.d/zfs-mount.in
@@ -165,15 +165,11 @@ do_start()
{
check_module_loaded || exit 0
- # fix mtab to include already-mounted fs filesystems, in case there are any
- # we ONLY do this if mtab does not point to /proc/mounts
- # which is the case in some systems (systemd may bring that soon)
- if ! readlink /etc/mtab | grep -q /proc ; then
- if grep -qE "(^/dev/zd|^/dev/zvol| zfs )" /proc/mounts ; then
- zfs_action "Registering already-mounted ZFS filesystems and volumes" \
- reregister_mounts
- fi
- fi
+ case "$ZFS_MOUNT" in
+ [Oo][Ff][Ff]|[Nn][Oo]|''|0)
+ exit 3
+ ;;
+ esac
# Ensure / exists in /etc/mtab, if not update mtab accordingly.
# This should be handled by rc.sysinit but lets be paranoid.
@@ -182,12 +178,6 @@ do_start()
mount -f /
fi
- case "$ZFS_MOUNT" in
- [Oo][Ff][Ff]|[Nn][Oo]|''|0)
- exit 3
- ;;
- esac
-
do_mount
}