dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
594167
From b13ef318b4f02ad21f0235d22da4e22cb9745cc3 Mon Sep 17 00:00:00 2001
594167
From: David Tardon <dtardon@redhat.com>
594167
Date: Sun, 17 Jul 2022 15:41:38 +0200
594167
Subject: [PATCH] test: merge grep | awk calls
594167
594167
(cherry picked from commit 283db37a20900b549508b2bf6d9db898c9a0ca67)
594167
594167
Related: #2100464
594167
---
594167
 test/units/testsuite-35.sh | 6 +++---
594167
 1 file changed, 3 insertions(+), 3 deletions(-)
594167
594167
diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh
594167
index 28022b03cf..d9eccee84f 100755
594167
--- a/test/units/testsuite-35.sh
594167
+++ b/test/units/testsuite-35.sh
594167
@@ -262,7 +262,7 @@ check_session() (
594167
         return 1
594167
     fi
594167
 
594167
-    session=$(loginctl --no-legend | grep "logind-test-user" | awk '{ print $1 }')
594167
+    session=$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1 }')
594167
     if [[ -z "$session" ]]; then
594167
         echo "no session found for user logind-test-user" >&2
594167
         return 1
594167
@@ -273,7 +273,7 @@ check_session() (
594167
         return 1
594167
     fi
594167
 
594167
-    leader_pid=$(loginctl session-status "$session" | grep "Leader:" | awk '{ print $2 }')
594167
+    leader_pid=$(loginctl session-status "$session" | awk '$1 == "Leader:" { print $2 }')
594167
     if [[ -z "$leader_pid" ]]; then
594167
         echo "cannot found leader process for session $session" >&2
594167
         return 1
594167
@@ -353,7 +353,7 @@ EOF
594167
     udevadm info "$dev"
594167
 
594167
     # trigger logind and activate session
594167
-    loginctl activate "$(loginctl --no-legend | grep "logind-test-user" | awk '{ print $1 }')"
594167
+    loginctl activate "$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1 }')"
594167
 
594167
     # check ACL
594167
     sleep 1