From e15bdc5b0bda706c58510c8ab5dea4b6afd36abb Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Fri, 14 Jun 2019 21:52:35 -0700 Subject: [PATCH] Restore some of the previous behaviour that read the old rpmsign prompt Signed-off-by: DJ Mountney --- resources/rpm/signing.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/rpm/signing.erb b/resources/rpm/signing.erb index 6af2acb6d..7ba782f81 100755 --- a/resources/rpm/signing.erb +++ b/resources/rpm/signing.erb @@ -11,12 +11,20 @@ require 'pty' puts rpm_cmd PTY.spawn(rpm_cmd) do |r, w, pid| + # Older versions of rpmsign will prompt right away for the passphrase + prompt = r.read(19) + + if prompt == 'Enter pass phrase: ' + STDOUT.puts prompt + w.write("#{password}\n") + end + # Keep printing output unti the command exits loop do begin line = r.gets puts line - if line =~ /Enter pass phrase:/ || line =~ /Please enter the passphrase to unlock the OpenPGP secret key:/ + if line =~ /Please enter the passphrase to unlock the OpenPGP secret key:/ w.write("#{password}\n") elsif (line =~ /failed/) && !(line =~ /warning:/) STDERR.puts 'RPM signing failure'