如何规避“不应解析"apt-key"输出"? [英] How to circumvent "apt-key output should not be parsed"?

查看:768
本文介绍了如何规避“不应解析"apt-key"输出"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在自动执行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:

  1. 一种不同的输出格式:我可以解决这个问题
  2. 警告:

  1. A different output format: I can hack around that
  2. A warning:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆