diff options
author | Jonathan Bauer | 2019-10-16 10:24:39 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-10-16 10:24:39 +0200 |
commit | 35c2b49c2c196fd84ce01528209f89fdecdd079b (patch) | |
tree | e0d46344aba831996c6468232a8083ce1ad4ad2b | |
parent | Add fs_path_ismountpoint (diff) | |
download | slx-tools-35c2b49c2c196fd84ce01528209f89fdecdd079b.tar.gz slx-tools-35c2b49c2c196fd84ce01528209f89fdecdd079b.tar.xz slx-tools-35c2b49c2c196fd84ce01528209f89fdecdd079b.zip |
consider network shares in fs_path_isvolatile
-rw-r--r-- | modules/fs/path.inc | 10 |
1 files changed, 9 insertions, 1 deletions
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 |