How to circumvent “apt-key output should not be parsed”?

后端 未结 3 1374
野性不改
野性不改 2020-12-14 14:20

I\'m automating my Docker installation. Something like this:

if apt-key fingerprint 0EBFCD88 | grep \"Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 80         


        
3条回答
  •  余生分开走
    2020-12-14 14:45

    I'm modifying the command itself to use batch mode so it will not complain about stdout. For the bigger apt-key this will work, quickly tested on debian:

    sed -i "s%{GPG_EXE}\")' --%{GPG_EXE}\")' --batch --%g" /usr/bin/apt-key
    

    While for the smaller apt-key this could work (untested as I can't recall exactly where I have seen this simpler variant):

    sed -i 's%GPG_CMD="gpg %GPG_CMD="gpg --batch %g' /usr/bin/apt-key
    

    You need privileges to write to the /usr/bin/apt-key so either run as root or use sudo

提交回复
热议问题