bash에서 apt-get 요청 "계속하려면 '예, 말한 대로 하세요!'라는 문구를 입력하세요"에 대한 스크립트 응답

bash에서 apt-get 요청 "계속하려면 '예, 말한 대로 하세요!'라는 문구를 입력하세요"에 대한 스크립트 응답

내 스크립트는 debootstrap으로 데비안 이미지를 구축하는 동안 chroot 내부에서 sysvinit를 systemd로 대체하고 있습니다.

이는 "위험한" 작업이므로 apt-get은 다음과 같은 어리석은 질문을 합니다. "계속하려면 '예, 내가 말하는 대로 하세요!'라는 문구를 입력하세요."

이에 대한 응답을 어떻게 스크립트로 작성할 수 있나요?

편집: -y --yes --force-yes 옵션을 모두 시도했지만 작동하지 않습니다.

답변1

이상하게도 다음과 같이 묻는 것 같습니다 --force-yes.

apt-get remove -y --force-yes systemd

하지만,

echo 'Yes, do as I say!' | apt-get remove systemd

깔끔하게 작업했습니다.

답변2

apt-get에는 -y, --yes, --assume-yes스위치가 있습니다:

       Automatic yes to prompts; assume "yes" as answer to all prompts and
       run non-interactively. If an undesirable situation, such as
       changing a held package, trying to install a unauthenticated
       package or removing an essential package occurs then apt-get will
       abort. Configuration Item: APT::Get::Assume-Yes.

또는 대안으로 --force-yes스위치:

       Force yes; this is a dangerous option that will cause apt to
       continue without prompting if it is doing something potentially
       harmful. It should not be used except in very special situations.
       Using force-yes can potentially destroy your system! Configuration
       Item: APT::Get::force-yes

http://manpages.ubuntu.com/manpages/utopic/man8/apt-get.8.html

관련 정보