diff sbin/ftjail @ 448:1f03f76b6aa4

Move "_get_jail_from_path()" into common.subr
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 09 May 2024 08:44:24 +0200
parents f6f64fd6f17b
children 6127213b2c8f
line wrap: on
line diff
--- a/sbin/ftjail	Wed May 08 08:55:54 2024 +0200
+++ b/sbin/ftjail	Thu May 09 08:44:24 2024 +0200
@@ -66,48 +66,6 @@
 
 
 #:
-#: Search for a running jail where it's "path" points to a given location
-#:
-#: Args:
-#:   $1: the location to search for
-#:
-#: Output (stdout):
-#:   The name if the jail with a "path" that is equal to the input param.
-#:   Nothing if a jail is not found.
-#:
-#: Return:
-#:   0: if a running jail is found
-#:   1: error
-#:   2: no running jail found
-#:   3: jail found but currently dying
-#:
-_get_jail_from_path() {
-  local _location
-
-  local _name _path _dying
-
-  _location="${1-}"
-  [ -z "${_location}" ] && { echo "ERROR: no mountpoint given" 1>&2; return 1; }
-
-
-  jls -d name path dying \
-  | {
-      while IFS=' '$'\t' read -r _name _path _dying ; do
-        if [ "${_path}" = "${_location}" ]; then
-          if [ "${_dying}" != "false" ]; then
-            echo "Jail \`${_name}' is currently dying" 1>&2
-            return 3
-          fi
-          echo "${_name}"
-          return 0
-        fi
-      done
-      return 2
-  }
-}
-
-
-#:
 #: Search for mounts and sub-mounts at a given directory.
 #:
 #: The output is sorted by the mountpoint.