From 3a914619ce4d7d95465e46607c1f4d713a089139 Mon Sep 17 00:00:00 2001 From: James Laska Date: Wed, 9 Sep 2015 11:01:44 -0400 Subject: [PATCH] Improvements to the package signing script --- tools/scripts/sign.exp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/scripts/sign.exp b/tools/scripts/sign.exp index 79f534b285..27aefcfcc2 100755 --- a/tools/scripts/sign.exp +++ b/tools/scripts/sign.exp @@ -4,15 +4,33 @@ # set timeout 600 + +# Optionally print usage message +if {[llength $argv] <= 0} { + puts "Usage: sign.exp " + exit 1 +} + +# Process arguments set command [join $argv] -set passphrase $env(PASSPHRASE) -puts "# $command" -spawn -noecho {*}$command + +if { [info exists env(PASSPHRASE) ] } { + set passphrase $env(PASSPHRASE) +} else { + set passphrase "" +} + +# Run the desired command +spawn {*}$command expect { -exact -nocase "enter passphrase: " { send -- "$passphrase\r" exp_continue } + timeout { + puts "[error] expect timeout" + exit 1 + } eof { } }