changeset 527:b7d60802b25f

Use absolute paths for "mount" (all occurrences) and grep (some)
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 04 Sep 2024 18:29:42 +0200
parents e50ea2fd4b66
children 93b98803219b
files sbin/fzfs share/local-bsdtools/common.subr
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/fzfs	Wed Sep 04 11:15:29 2024 +0200
+++ b/sbin/fzfs	Wed Sep 04 18:29:42 2024 +0200
@@ -209,7 +209,7 @@
                         mkdir -p "${_real_mp}" 1> /dev/null 2> /dev/null || \
                             { echo "ERROR: cannot create mountpoint ${_real_mp}" >&2; _umount_datasets _mounted_datasets || true; return 1; }
                         echo "Mounting ${_name} on ${_real_mp}"
-                        if mount -t zfs "${_name}" "${_real_mp}"; then
+                        if /sbin/mount -t zfs "${_name}" "${_real_mp}"; then
                             array_append _mounted_datasets "${_name}"
                         else
                             if ! checkyes _opt_keep; then
@@ -291,13 +291,13 @@
     # Just determine whether the given dataset name exists
     _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || { echo "ERROR: dataset not found" 1>&2; return 1; }
 
-    mount -t zfs -p \
-    | grep -E "^${_dsname}(/|\s)" \
-    | sort -n -r \
+    /sbin/mount -t zfs -p \
+    | LC_ALL=C GREP_OPTIONS="" /usr/bin/egrep "^${_dsname}(/|\s)" \
+    | /usr/bin/sort -n -r \
     | {
         while IFS=' '$'\t' read -r _name _mp _rest ; do
             echo "Umounting ${_name} on ${_mp}"
-            umount "${_mp}" || return 1
+            /sbin/umount "${_mp}" || return 1
         done
     }
     return 0
--- a/share/local-bsdtools/common.subr	Wed Sep 04 11:15:29 2024 +0200
+++ b/share/local-bsdtools/common.subr	Wed Sep 04 18:29:42 2024 +0200
@@ -216,7 +216,7 @@
 
     _mountpoint="$1"
 
-    mount -t zfs -p \
+    /sbin/mount -t zfs -p \
     | {
         while IFS=' '$'\t' read -r _ds _mount _rest ; do
             if [ "$_mount" = "$_mountpoint" ]; then
@@ -347,7 +347,7 @@
             exit 1;
             ;;
     esac
-    _fstab="$(mount -p | awk -v pa1="^${_directory}\$" -v pa2="^${_directory}/" '($2 ~ pa1) || ($2 ~ pa2 ) { print; }' | sort -k3)"
+    _fstab="$(/sbin/mount -p | awk -v pa1="^${_directory}\$" -v pa2="^${_directory}/" '($2 ~ pa1) || ($2 ~ pa2 ) { print; }' | sort -k3)"
     echo "${_fstab}"
 }