Seems some dead codes are left here for historical reason, just remove them, read the config and strip comments only for once.
This improve the speed by a lot (2.6s -> 0.498s for reading a simple config in my test case, on HDD) and make the code cleaner. --- mkdumprd | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 6fc68fe..a99d5f1 100644 --- a/mkdumprd +++ b/mkdumprd @@ -444,13 +444,9 @@ do add_dracut_arg $config_val ;; *) - if [ -n $(echo $config_opt | grep "^#.*$") ] - then - continue - fi ;; esac -done < $conf_file +done <<< "$(grep -v -e "^#" -e "^$" $conf_file)"
handle_default_dump_target