Don't unnecessarily use cat and use grep -E

This commit is contained in:
yueyuankun 2024-06-19 17:27:18 +08:00
parent 0913963722
commit 6d976f1dd1
2 changed files with 39 additions and 1 deletions

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 36.16.5
Release: 34
Release: 35
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -52,6 +52,8 @@ Patch6008: backport-module-setup.sh-Don-t-ignore-errors-unbound-variable-and-
Patch6009: backport-Fix-the-systemd-generator-for-systemd-253-2165433.patch
# https://github.com/rhinstaller/anaconda/pull/5198
Patch6010: backport-a-riscv64-enablement-patch-from-upstream.patch
# https://github.com/rhinstaller/anaconda/pull/3984
Patch6011: backport-Don-t-unnecessarily-use-cat-and-use-grep-E.patch
Patch9023: bugfix-change-root-and-storage-interface-shows.patch
Patch9024: bugfix-revert-Set-default-entry-to-the-BLS-id-instead-of-the-entry-index.patch
@ -315,6 +317,12 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Wed Jun 19 2024 yueyuankun <yueyuankun@kylinos.cn> - 36.16.5-35
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix(anaconda-pre-log-gen): don't unnecessarily use cat and use grep -E
* Thu May 23 2024 yueyuankun <yueyuankun@kylinos.cn> - 36.16.5-34
- Type:bugfix
- ID:NA

View File

@ -0,0 +1,30 @@
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