Skip to content

Commit

Permalink
fix(base): remove grep dependency
Browse files Browse the repository at this point in the history
The base module requires grep with the `rd.memdebug=1` command line parameter.
As this code is broken if grep is not added by other means and grep is only
required for this, rewriting this code to avoid the dependency.
  • Loading branch information
aafeijoo-suse authored and johannbg committed Dec 3, 2022
1 parent 4a9b165 commit 240a1d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules.d/99base/dracut-lib.sh
Expand Up @@ -1104,7 +1104,13 @@ make_trace_mem() {
show_memstats() {
case $1 in
shortmem)
grep -e "^MemFree" -e "^Cached" -e "^Slab" /proc/meminfo
while read -r line || [ -n "$line" ]; do
str_starts "$line" "MemFree" \
|| str_starts "$line" "Cached" \
|| str_starts "$line" "Slab" \
|| continue
echo "$line"
done < /proc/meminfo
;;
mem)
cat /proc/meminfo
Expand Down

0 comments on commit 240a1d3

Please sign in to comment.