From a44fa55f2b53569423484e4a1a342d6c67b1678a Mon Sep 17 00:00:00 2001 From: illiliti Date: Wed, 15 Apr 2020 23:03:07 +0300 Subject: [PATCH] improve lvm --- tinyramfs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tinyramfs b/tinyramfs index 352c8be..26ccd76 100755 --- a/tinyramfs +++ b/tinyramfs @@ -223,7 +223,17 @@ install_lvm() lvm_opts="$lvm_opts" \ >> "${workdir}/etc/config" - mkdir -p "${workdir}/etc/lvm" + lvm_config=" + devices { + write_cache_state = 0 + } + backup { + backup = 0 + archive = 0 + } + global { + use_lvmetad = 0 + }" # word splitting is safe by design # shellcheck disable=2086 @@ -231,22 +241,13 @@ install_lvm() for opt; do case "$opt" in config | config=1) - lvmconfig > "${workdir}/etc/lvm/lvm.conf" - return + embed_lvm_config=1 ;; esac; done - printf "%s\n" \ - 'devices {' \ - 'write_cache_state = 0' \ - '}' \ - 'backup {' \ - 'backup = 0' \ - 'archive = 0' \ - '}' \ - 'global {' \ - 'use_lvmetad = 0' \ - '}' \ + mkdir -p "${workdir}/etc/lvm"; lvmconfig \ + --config "$lvm_config" \ + ${embed_lvm_config:+--mergedconfig} \ > "${workdir}/etc/lvm/lvm.conf" }