naccyde / rpms / systemd

Forked from rpms/systemd 11 months ago
Clone
787d6d
From 21c281585983fe2efc2b74d712d98ff7e6c013b1 Mon Sep 17 00:00:00 2001
787d6d
From: Yu Watanabe <watanabe.yu+github@gmail.com>
787d6d
Date: Tue, 14 Jun 2022 09:11:00 +0900
787d6d
Subject: [PATCH] test: introduce inst_recursive() helper function
787d6d
787d6d
(cherry picked from commit da0465dc95388afc15598357452afef85035c639)
787d6d
787d6d
Related: #1866955
787d6d
---
787d6d
 test/test-functions | 14 ++++++++++++++
787d6d
 1 file changed, 14 insertions(+)
787d6d
787d6d
diff --git a/test/test-functions b/test/test-functions
787d6d
index 19363be858..9606a1b085 100644
787d6d
--- a/test/test-functions
787d6d
+++ b/test/test-functions
787d6d
@@ -1224,6 +1224,20 @@ inst_any() {
787d6d
     return 1
787d6d
 }
787d6d
 
787d6d
+inst_recursive() {
787d6d
+    local p item
787d6d
+
787d6d
+    for p in "$@"; do
787d6d
+        while read -r item; do
787d6d
+            if [[ -d "$item" ]]; then
787d6d
+                inst_dir "$item"
787d6d
+            elif [[ -f "$item" ]]; then
787d6d
+                inst_simple "$item"
787d6d
+            fi
787d6d
+        done < <(find "$p" 2>/dev/null)
787d6d
+    done
787d6d
+}
787d6d
+
787d6d
 # dracut_install [-o ] <file> [<file> ... ]
787d6d
 # Install <file> to the initramfs image
787d6d
 # -o optionally install the <file> and don't fail, if it is not there