comparison sbin/ftjail @ 537:62cd970aea9c

Replace the use of "deprecated" egrep calls with "grep -E"
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 09 Sep 2024 14:28:55 +0200
parents c615279bb797
children 566ecdd9e73b
comparison
equal deleted inserted replaced
536:b0148ccbc459 537:62cd970aea9c
536 # Just determine whether the given dataset name exists 536 # Just determine whether the given dataset name exists
537 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \ 537 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \
538 { echo "ERROR: dataset not found" >&2; return 1; } 538 { echo "ERROR: dataset not found" >&2; return 1; }
539 539
540 /sbin/mount -t zfs -p \ 540 /sbin/mount -t zfs -p \
541 | grep -E "^${_dsname}(/|\s)" \ 541 | /usr/bin/grep -E "^${_dsname}(/|\s)" \
542 | sort -n -r \ 542 | sort -n -r \
543 | { 543 | {
544 while IFS=' '$'\t' read -r _name _mp _rest ; do 544 while IFS=' '$'\t' read -r _name _mp _rest ; do
545 echo "Umounting ${_name} on ${_mp}" 545 echo "Umounting ${_name} on ${_mp}"
546 /sbin/umount "${_mp}" || return 1 546 /sbin/umount "${_mp}" || return 1
938 # file types. 938 # file types.
939 # 939 #
940 # Note that procstat places extra whitespace at the end of lines sometimes. 940 # Note that procstat places extra whitespace at the end of lines sometimes.
941 # 941 #
942 # 942 #
943 if procstat -a file | egrep '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then 943 if procstat -a file | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
944 echo "ERROR: There are open files within the jail" >&2 944 echo "ERROR: There are open files within the jail" >&2
945 return 1 945 return 1
946 fi 946 fi
947 # The same for memory mappings 947 # The same for memory mappings
948 if procstat -a vm | egrep '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then 948 if procstat -a vm | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
949 echo "ERROR: There are open memory mappings within the jail" >&2 949 echo "ERROR: There are open memory mappings within the jail" >&2
950 return 1 950 return 1
951 fi 951 fi
952 952
953 _dir_mounts="$(_get_mounts_at_directory "${_directory}")" 953 _dir_mounts="$(_get_mounts_at_directory "${_directory}")"