diff options
Diffstat (limited to 'sbin/functions.sh')
-rwxr-xr-x | sbin/functions.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sbin/functions.sh b/sbin/functions.sh index c6ac5d6..1cb1c08 100755 --- a/sbin/functions.sh +++ b/sbin/functions.sh @@ -515,6 +515,25 @@ get_base_ver() { echo ${ver##* } } +# Network filesystems list for common use in rc-scripts. +# This variable is used in is_net_fs and other places such as +# localmount. +NET_FS_LIST="afs cifs coda davfs gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" + +# bool is_net_fs(path) +# +# return 0 if path is the mountpoint of a networked filesystem +# +# EXAMPLE: if is_net_fs / ; then ... +# +is_net_fs() { + local fstype + # /proc/mounts is always accurate + fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts ) + [[ " ${NET_FS_LIST} " == *" ${fstype} "* ]] + return $? +} + # bool is_uml_sys() # # return 0 if the currently running system is User Mode Linux |