apt-Optionen in Konfigurationsdateien

apt-Optionen in Konfigurationsdateien

ich führe es apt-getwie folgt aus:

rm -rf /var/lib/apt/lists/*'
apt-get clean
apt-get --option Acquire::Check-Valid-Until=false update
DEBIAN_FRONTEND=noninteractive apt-get --yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold" upgrade
DEBIAN_FRONTEND=noninteractive apt-get --yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold" dist-upgrade
apt-get autoremove --yes --force-yes
apt-get clean

ich möchte die Optionen aus einer Konfigurationsdatei entfernen, sodass /etc/apt/apt.conf.d/die Befehle ohne Angabe dieser Optionen ausgeführt werden können und sie trotzdem berücksichtigt werden. Insbesondere möchte ich Folgendes entfernen:

  1. --option Acquire::Check-Valid-Until=falseausapt-get update
  2. DEBIAN_FRONTEND=noninteractiveund --yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold"von apt-get upgradeundapt-get dist-upgrade
  3. --yes --force-yesausapt-get autoremove

und obwohl ich mir dieHandbuchseiten, ich konnte nicht herausfinden, wie man es richtig macht.

ich würde mich über eine detaillierte Erklärung freuen, wie das erreicht werden kann.

falls nötig, hier ein paar Informationen zu meinem System:

$ cat /etc/*release* | grep -i dist
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"

$ dpkg -l | grep -i apt | head -n 1
ii  apt  1.2.15ubuntu0.2  amd64  commandline package manager

Antwort1

--optionSie können die Teile auch ohne =zur Datei hinzufügen :

Acquire::Check-Valid-Until "false";
Dpkg::Options:: "--force-confdef";
Dpkg::Options:: "--force-confold";

--yesWas und betrifft --force-yes, dieapt-getmanpagesagt:

-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. This is deprecated and replaced by
   --allow-downgrades, --allow-remove-essential,
   --allow-change-held-packages in 1.1.

Also:

APT::Get::Assume-Yes "true";
APT::Get::force-yes "true";

Die zweite Zeile sollten Sie durch Zeilen ersetzen APT::Get::allow-downgrades, APT::Get::allow-remove-essentialdie eine oder mehrere der folgenden Aussagen APT::Get::allow-change-held-packagesauf „true“ setzen.

DEBIAN_FRONTEND=noninteractiveist eine Debconf-Einstellung und sollte in gesetzt werden debconf.conf. Diemanpagehat Beispiele.

Ich empfehle Ihnen dringend, ein Skript zu schreiben, anstatt diese in Konfigurationsdateien festzulegen. Außerdem hat es keinen Sinn, upgradevor dem ein auszuführen dist-upgrade– das dist-upgradeallein reicht aus.

verwandte Informationen