summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-02-27 11:19:13 +0100
committerJonathan Bauer2019-02-27 11:19:13 +0100
commit3f85f714002635255ce21fce20fe5ba469061f95 (patch)
treec02cd794968578f07db6ca2f5fa7555aed27b0e8
parentimprovements & bug fixes (diff)
downloadslx-tools-3f85f714002635255ce21fce20fe5ba469061f95.tar.gz
slx-tools-3f85f714002635255ce21fce20fe5ba469061f95.tar.xz
slx-tools-3f85f714002635255ce21fce20fe5ba469061f95.zip
fix search/replace for ash
-rw-r--r--slx-tools8
1 files changed, 5 insertions, 3 deletions
diff --git a/slx-tools b/slx-tools
index 02703de..ed6a8ed 100644
--- a/slx-tools
+++ b/slx-tools
@@ -29,7 +29,8 @@ is_volatile() {
[ -z "$1" ] && return 2
local _dev="$(get_backing_dev "$1")"
[ -z "$_dev" ] && return 0
- [ "$_dev" = "${_dev//\/dev\/mapper/}" ] && return 1
+ # NOTE: ash does not search/replace when the expression is surrounded by quotes
+ [ "x$_dev" = "x"${_dev//\/dev\/mapper/} ] && return 1
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.
@@ -42,8 +43,9 @@ is_volatile() {
get_dm_backing_size() {
[ -z "$1" ] && return 1
- local _dev="$(get_backing_part $1)"
- [ "$_dev" = "${_dev//\/dev\/mapper/}" ] && return 1
+ local _dev="$(get_backing_dev $1)"
+ # NOTE: ash does not search/replace when the expression is surrounded by quotes
+ [ "x$_dev" = "x"${_dev//\/dev\/mapper/} ] && return 1
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*' )"