anaconda/backport-Don-t-unnecessarily-use-cat-and-use-grep-E.patch
2024-06-19 17:27:18 +08:00

31 lines
911 B
Diff

From ab9b2f98134d99325ac468a7c01ed0e659464f3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= <oguz@ersen.moe>
Date: Sat, 26 Mar 2022 18:32:17 +0000
Subject: [PATCH] Don't unnecessarily use cat and use grep -E
---
scripts/anaconda-pre-log-gen | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/scripts/anaconda-pre-log-gen b/scripts/anaconda-pre-log-gen
index 30eacc8a3c..0012e076db 100755
--- a/scripts/anaconda-pre-log-gen
+++ b/scripts/anaconda-pre-log-gen
@@ -5,12 +5,8 @@
# where the resulting logs will be stored
TARGET_DIRECTORY=/tmp/pre-anaconda-logs
-BOOT_OPTIONS_FILE=/proc/cmdline
-
-DEBUG_ENABLED=`cat $BOOT_OPTIONS_FILE | egrep -c "\<debug\>|\<inst\.debug\>"`
-
# do not produce any logs unless debug is enabled
-[ $DEBUG_ENABLED == '0' ] && exit 0
+grep -E -q "\<debug\>|\<inst\.debug\>" /proc/cmdline || exit 0
mkdir ${TARGET_DIRECTORY}
--
2.33.0