Sha256: 9988a6d3a70418b7db29bf5787f2d6768359b8006fb560e4bce1dbb7c64c40f0

Contents?: true

Size: 891 Bytes

Versions: 8

Compression:

Stored size: 891 Bytes

Contents

#!/usr/bin/expect --

set pass $env(GPG_PASSWORD)

set badpass 0
set timeout 5
set count 5;
eval spawn $argv
# Apt asks for your passphrase twice, hence the loop
while {$count > 0 } {
  expect {
    "phrase:" {
      send "$pass\r"
    }
    "Bad passphrase" {
      # CentOS/RHEL case
      set badpass 1
    }
    "again:" {
      # Ubuntu case, it reprompts. Keep sending till it runs out of retries
      # else we'll corrupt the db when we exit easrly
      send "$pass\r"
      set badpass 1
    }
    eof {
      if {$badpass == 1} {
        puts "Failure! Bad Passphrase!"
        exit 1
      } else {
        puts "Success!"
        exit 0
      }
    }
    timeout {
      puts "\nTimeout failure. For Apt, repo DB may be locked/corrupted and need to be refetch manually"
      exit 1
    }
  }
  set count [expr $count-1];
}

puts "Failed to sign package after 5 attempts"
exit 1

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
right_publish-0.6.0 bin/autosign.expect
right_publish-0.5.2 bin/autosign.expect
right_publish-0.5.1 bin/autosign.expect
right_publish-0.5.0 bin/autosign.expect
right_publish-0.4.2 bin/autosign.expect
right_publish-0.4.0 bin/autosign.expect
right_publish-0.3.0 bin/autosign.expect
right_publish-0.2.1 bin/autosign.expect