illiliti / tinyramfs

Tiny initramfs written in POSIX shell
GNU General Public License v3.0
103 stars 19 forks source link

Fix bug in lvm hook with lvm_discard unset #19

Closed ghost closed 3 years ago

ghost commented 3 years ago
$ unset lvm_discard
$ echo "${lvm_discard:+--config=devices{issue_discards=1}}"
}
$ echo "${lvm_discard:+--config=devices\{issue_discards=1\}}"

$ lvm_discard=1
$ echo "${lvm_discard:+--config=devices\{issue_discards=1\}}"
--config=devices{issue_discards=1}

You need to escape the braces or else when lvm_discard is unset the result is }. I was getting an error on boot that the volume group } was invalid due to this.