如何规避“apt-key 输出不应被解析"? [英] How to circumvent "apt-key output should not be parsed"?
问题描述
我正在自动化我的 Docker 安装.像这样:
I'm automating my Docker installation. Something like this:
if apt-key fingerprint 0EBFCD88 | grep "Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88" > /dev/null
then
# proceed
fi
这在 apt-key
的旧版本中运行良好,但最近的版本有两个问题:
This worked fine in older versions of apt-key
, but recent versions have two issues:
- 不同的输出格式:我可以解决这个问题
警告:
Warning: apt-key output should not be parsed (stdout is not a terminal)
显然,我也可以解决这个问题,只需将 stderr
重定向到 /dev/null
.这让我很好奇:
Clearly, I can hack around this as well, just redirect stderr
to /dev/null
. It just made me curious:
这些优秀的人如何建议我验证我的密钥指纹?或者我是否因为想要自动化而从根本上犯了这个错误,这是否违背了这一点?(我认为不会,因为我仍然手动从网站上提取了预期的指纹,但请随时告诉我其他情况......)
How do these fine folks suggest I verify my key fingerprints? Or am I getting this fundamentally wrong by wanting to automate it, does that defeat the point? (I think not, since I still manually lifted the expected fingerprint from the website, but feel free to tell me otherwise...)
推荐答案
从 apt-key 来源,您可以将 APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE
设置为非空值以禁用此警告.
From apt-key sources, you can set APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE
to a non-empty value to disable this warning.
您也可以使用grep -q",这样您也不需要在 /dev/null
中重定向标准输出.
You can also use "grep -q" so you don't need to redirect stdout in /dev/null
either.
这篇关于如何规避“apt-key 输出不应被解析"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!