我正在尝试使用GPG创建的RPM软件包进行签名,而无需输入密码,也无需输入可以签名的密码,但是,如果没有输入密码,则会打开消息框Please enter the passphrase to unlock the OpenPGP secret key,所以我不需要在签名软件包时要求输入密码这将是在“静音模式”下执行的脚本。我可能输入了错误的命令,但是我很难找到解决方案。
这是我尝试执行的命令,即使这样,仍要求输入密码:
gpg --batch --passphrase "78910" --clearsign test-1-0.x86_64.rpm
使用第二个命令,不需要输入密码:
echo "78910" | gpg --batch --passphrase-fd 0 --clearsign test-1-0.x86_64.rpm
但是,不执行签名,并返回如下所述的错误:
gpg: signing failed: Inappropriate ioctl for device gpg: /test-1-0.x86_64.rpm: clear-sign failed: Inappropriate ioctl for device
使用此第三条命令,报告的错误有所不同:
echo "78910" | gpg --batch --passphrase-fd 0 ~/.gnupg/trustdb.gpg --clearsign test-1-0.x86_64.rpm
错误信息:
gpg: Note: '--clearsign' is not considered an option gpg: WARNING: no command supplied. Trying to guess what you mean ... usage: gpg [options] [filename]
这是我创建gpg密钥的代码,我尝试在没有密码的情况下创建,但是当密码值为空时我收到错误消息。
#!/bin/bash
echo "Key-Type: 1" > gen-key-script
echo "Key-Length: 1024" >> gen-key-script
echo "Subkey-Type: 1" >> gen-key-script
echo "Subkey-Length: 1024" >> gen-key-script
echo "Name-Real: gpg test" >> gen-key-script
echo "Name-Email: test@test.com" >> gen-key-script
echo "Expire-Date: 0" >> gen-key-script
echo "Passphrase: 78910" >> gen-key-script
echo "" >> gen-key-script
#---------------------------------------------------------
# GENERATE THE KEY
#---------------------------------------------------------
gpg --batch --gen-key gen-key-script
#---------------------------------------------------------
# .RPMMACROS
#---------------------------------------------------------
echo "%_gpg_name gpg test <test@test.com>" > ~/.rpmmacros
忽然笑