使用 expect 封装自动 rpmsign 签名

由于 rpmsign 会要求使用者输入 pass phras, 所以可用 exepct 包装下自动输入,完成自动化签名过程:

#!/usr/bin/expect -f  

set key [lindex $argv 0 ]   
set fname [lindex $argv 1 ]   
set timeout 30                   
spawn rpmsign --resign -D  "_gpg_name $key" --quiet  $fname  
expect {                
     "Enter pass phrase:" { send "111111\r" }    
 }  
expect eof
This entry was posted in 系统管理. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.