![bash에서 apt-get 요청 "계속하려면 '예, 말한 대로 하세요!'라는 문구를 입력하세요"에 대한 스크립트 응답](https://rvso.com/image/1452239/bash%EC%97%90%EC%84%9C%20apt-get%20%EC%9A%94%EC%B2%AD%20%22%EA%B3%84%EC%86%8D%ED%95%98%EB%A0%A4%EB%A9%B4%20'%EC%98%88%2C%20%EB%A7%90%ED%95%9C%20%EB%8C%80%EB%A1%9C%20%ED%95%98%EC%84%B8%EC%9A%94!'%EB%9D%BC%EB%8A%94%20%EB%AC%B8%EA%B5%AC%EB%A5%BC%20%EC%9E%85%EB%A0%A5%ED%95%98%EC%84%B8%EC%9A%94%22%EC%97%90%20%EB%8C%80%ED%95%9C%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%20%EC%9D%91%EB%8B%B5.png)
내 스크립트는 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