Sha256: e74878063204bdea05887266a9c8631e2ec323b18b902a9e84d8cec411bb7194

Contents?: true

Size: 778 Bytes

Versions: 1

Compression:

Stored size: 778 Bytes

Contents

#!/usr/bin/env ruby

unless (rpm_cmd = ARGV[0])
  STDERR.puts 'Usage: sign-rpm RPM_COMMAND'
  exit 1
end

password = '<%= passphrase %>'

require 'pty'

puts rpm_cmd
PTY.spawn(rpm_cmd) do |r, w, pid|
  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
  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/
        STDERR.puts 'RPM signing failure'
        exit 1
      end
    rescue Errno::EIO
      break
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omnibus-4.0.0.beta.1 resources/rpm/signing.erb