summaryrefslogtreecommitdiffstats
path: root/slx-tools
diff options
context:
space:
mode:
Diffstat (limited to 'slx-tools')
-rw-r--r--slx-tools6
1 files changed, 3 insertions, 3 deletions
diff --git a/slx-tools b/slx-tools
index 5fc1303..972975c 100644
--- a/slx-tools
+++ b/slx-tools
@@ -29,8 +29,8 @@ is_volatile() {
[ -z "$1" ] && return 2
local _dev="$(get_backing_dev "$1")"
[ -z "$_dev" ] && return 0 # No result, assume tmpfs
- [ "$_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
+ [ "$_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
local _mp="$(get_backing_dev_mp "$1")"
[ -z "$_mp" ] && return 2
# it is a device mapper device, check if it was setup in dracut's initramfs.
@@ -44,7 +44,7 @@ is_volatile() {
get_dm_backing_size() {
[ -z "$1" ] && return 1
local _dev="$(get_backing_dev $1)"
- [ "$_dev" = "${_dev#/dev/mapper/}" ] && return 1
+ [ "$_dev" != "${_dev#/dev/mapper/}" ] || return 1 # doesn't start with /dev/mapper, assume not device mapped
local _dm_line="$(grep -m1 -E "^${_dev}\s+/\s+type=[^0]" "$dmstate")"
[ -z "$_dm_line" ] && return 1
local _dm_dev_size="$(echo "$_dm_line" | grep -Po '(?<=physical_size=|virtual_size=)\w*' )"