ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Zbigniew Jędrzejewski-Szmek 5d6eed
From f1e5bbe0ef234b5e6c8a2cd7f601a75a7678cd27 Mon Sep 17 00:00:00 2001
Kevin Fenzi 1eb707
From: Michal Schmidt <mschmidt@redhat.com>
Kevin Fenzi 1eb707
Date: Fri, 16 Dec 2016 18:14:47 +0100
Kevin Fenzi 1eb707
Subject: [PATCH] kernel-install: avoid process substitution
Kevin Fenzi 1eb707
Kevin Fenzi 1eb707
bash implements process substitution using /dev/fd/N (this is documented
Kevin Fenzi 1eb707
in man bash). We'd like kernel-install to work in chrooted RPM
Kevin Fenzi 1eb707
scriptlets without /dev.
Kevin Fenzi 1eb707
Kevin Fenzi 1eb707
We can use here-strings instead. bash uses temporary files to implement
Kevin Fenzi 1eb707
those.
Zbigniew Jędrzejewski-Szmek 03e93e
Zbigniew Jędrzejewski-Szmek 03e93e
(cherry picked from commit db1e2bfc4f049261ae2d407568ff39569b36d98c)
Kevin Fenzi 1eb707
---
Kevin Fenzi 1eb707
 src/kernel-install/kernel-install | 8 ++++----
Kevin Fenzi 1eb707
 1 file changed, 4 insertions(+), 4 deletions(-)
Kevin Fenzi 1eb707
Kevin Fenzi 1eb707
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
Kevin Fenzi 1eb707
index a95b9717f0..c7d9f4eea9 100644
Kevin Fenzi 1eb707
--- a/src/kernel-install/kernel-install
Kevin Fenzi 1eb707
+++ b/src/kernel-install/kernel-install
Kevin Fenzi 1eb707
@@ -34,7 +34,7 @@ dropindirs_sort()
Kevin Fenzi 1eb707
     local -a files
Kevin Fenzi 1eb707
     local f d i
Kevin Fenzi 1eb707
 
Kevin Fenzi 1eb707
-    readarray -t files < <(
Kevin Fenzi 1eb707
+    readarray -t files <<<"$(
Kevin Fenzi 1eb707
         for d in "$@"; do
Kevin Fenzi 1eb707
             for i in "$d/"*"$suffix"; do
Kevin Fenzi 1eb707
                 if [[ -e "$i" ]]; then
Kevin Fenzi 1eb707
@@ -42,7 +42,7 @@ dropindirs_sort()
Kevin Fenzi 1eb707
                 fi
Kevin Fenzi 1eb707
             done
Kevin Fenzi 1eb707
         done | sort -Vu
Kevin Fenzi 1eb707
-    )
Kevin Fenzi 1eb707
+    )"
Kevin Fenzi 1eb707
 
Kevin Fenzi 1eb707
     for f in "${files[@]}"; do
Kevin Fenzi 1eb707
         for d in "$@"; do
Kevin Fenzi 1eb707
@@ -104,11 +104,11 @@ fi
Kevin Fenzi 1eb707
 
Kevin Fenzi 1eb707
 ret=0
Kevin Fenzi 1eb707
 
Kevin Fenzi 1eb707
-readarray -t PLUGINS < <(
Kevin Fenzi 1eb707
+readarray -t PLUGINS <<<"$(
Kevin Fenzi 1eb707
     dropindirs_sort ".install" \
Kevin Fenzi 1eb707
         "/etc/kernel/install.d" \
Kevin Fenzi 1eb707
         "/usr/lib/kernel/install.d"
Kevin Fenzi 1eb707
-)
Kevin Fenzi 1eb707
+)"
Kevin Fenzi 1eb707
 
Kevin Fenzi 1eb707
 case $COMMAND in
Kevin Fenzi 1eb707
     add)