Skriptantwort auf Apt-Get-Anfrage „Um fortzufahren, geben Sie den Satz ‚Ja, tun Sie, was ich sage!‘ ein“ in Bash

Skriptantwort auf Apt-Get-Anfrage „Um fortzufahren, geben Sie den Satz ‚Ja, tun Sie, was ich sage!‘ ein“ in Bash

Mein Skript ersetzt sysvinit durch systemd in einem Chroot, während ich mit Debootstrap ein Debian-Image erstelle.

Da dies eine „gefährliche“ Aktion ist, stellt apt-get eine dumme Frage: „Um fortzufahren, geben Sie den Satz ‚Ja, tun Sie, was ich sage!‘ ein.“

Wie kann ich die Antwort darauf schreiben?

BEARBEITEN: Ich habe alle Optionen -y --yes --force-yes ausprobiert, aber sie funktionieren nicht.

Antwort1

Seltsamerweise scheint es sogar so zu sein --force-yes:

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

Jedoch,

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

hat sauber geklappt.

Antwort2

apt-get hat einen -y, --yes, --assume-yesSchalter:

       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.

oder alternativ ein --force-yesSchalter:

       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

verwandte Informationen