From 35c2b49c2c196fd84ce01528209f89fdecdd079b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 16 Oct 2019 10:24:39 +0200 Subject: consider network shares in fs_path_isvolatile --- modules/fs/path.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/fs/path.inc b/modules/fs/path.inc index c067049..fd035b5 100644 --- a/modules/fs/path.inc +++ b/modules/fs/path.inc @@ -46,7 +46,15 @@ fs_path_isvolatile() { [ -z "$1" ] && return 2 local _dev _mp _dev="$(fs_path_getdev "$1")" - [ -z "$_dev" ] && return 0 # No result, assume tmpfs + if [ -z "$_dev" ]; then + # not backed by a device in /dev, check for network shares + local _mtype="$(fs_path_gettype "$1")" + if [ -n "$_mtype" ] && regex_imatch "$_mtype" '^(nfs.?|cifs)$'; then + return 1 + fi + # Neither backed by a device nor a cifs/nfs share, assume tmpfs + return 0 + fi [ "$_dev" = "${_dev#/dev/zram}" ] || return 0 # zram is in RAM, like tmpfs [ "$_dev" != "${_dev#/dev/mapper/}" ] || return 1 # Doesn't start with /dev/mapper, assume some kind of storage [ -s "$DM_STATE_FILE" ] || return 2 # No point in continuing -- cgit v1.2.3-55-g7522