Skip to content

Commit

Permalink
Merge pull request #892 from twk3/sign-new-rpm
Browse files Browse the repository at this point in the history
Update the rpm package signing to work with newer rpm version
  • Loading branch information
tas50 authored Dec 31, 2019
2 parents acd88ee + e15bdc5 commit eecac7e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions resources/rpm/signing.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@ 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)

# match the expected prompt exactly, since that's the only way we know if
# something went wrong.
unless prompt == 'Enter pass phrase: '
STDERR.puts "unexpected output from `#{rpm_cmd}`: '#{prompt}'"
Process.kill(:KILL, pid)
exit 1
if prompt == 'Enter pass phrase: '
STDOUT.puts prompt
w.write("#{password}\n")
end

STDOUT.puts prompt
w.write("#{password}\n")

# Keep printing output unti the command exits
loop do
begin
line = r.gets
puts line
if (line =~ /failed/) && !(line =~ /warning:/)
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'
exit 1
end
Expand Down

0 comments on commit eecac7e

Please sign in to comment.