Quoting the rationale of SC2129,
Rather than adding >> something after every single line, you
can
simply group the relevant commands and redirect the group. So the file
has to be opened and closed only once and it means a performance gain.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 21c0e70..b478e22 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1008,10 +1008,12 @@ kdump_install_systemd_conf() {
# unneccessary memory consumption and make console output more useful.
# Only do so for non fadump image.
mkdir -p "${initdir}/etc/systemd/journald.conf.d"
- echo "[Journal]" >
"${initdir}/etc/systemd/journald.conf.d/kdump.conf"
- echo "Storage=volatile" >>
"${initdir}/etc/systemd/journald.conf.d/kdump.conf"
- echo "ReadKMsg=no" >>
"${initdir}/etc/systemd/journald.conf.d/kdump.conf"
- echo "ForwardToConsole=yes" >>
"${initdir}/etc/systemd/journald.conf.d/kdump.conf"
+ {
+ echo "[Journal]"
+ echo "Storage=volatile"
+ echo "ReadKMsg=no"
+ echo "ForwardToConsole=yes"
+ } > "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
}
remove_cpu_online_rule() {
--
2.37.1