
Мой скрипт заменяет sysvinit на systemd внутри chroot при сборке образа Debian с помощью debootstrap.
Поскольку это «опасное» действие, apt-get задаст глупый вопрос: «Чтобы продолжить, введите фразу «Да, делай, как я говорю!»»
Как мне написать ответ на этот вопрос?
EDIT: Я перепробовал все параметры -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