구성 파일 내의 적절한 옵션

구성 파일 내의 적절한 옵션

나는 apt-get다음과 같이 실행하고 있습니다 :

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

/etc/apt/apt.conf.d/구성 파일에서 옵션을 제거하여 이러한 옵션을 지정하지 않고도 명령이 실행될 수 있도록 하고 싶습니다 . 즉, 다음을 제거하고 싶습니다.

  1. --option Acquire::Check-Valid-Until=false~에서apt-get update
  2. DEBIAN_FRONTEND=noninteractive그리고 --yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold"로부터 apt-get upgrade그리고apt-get dist-upgrade
  3. --yes --force-yes~에서apt-get autoremove

그리고 내가 그걸 봤음에도 불구하고매뉴얼 페이지, 나는 그것을 올바르게 수행하는 방법을 알 수 없었습니다.

그것이 어떻게 달성될 수 있는지 자세한 설명을 부탁드립니다.

필요한 경우를 대비해 내 시스템에 대한 정보는 다음과 같습니다.

$ 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

답변1

파일 --option없이 부품을 추가할 수 있습니다 .=

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

--yes및 에 관해서는 --force-yes,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. This is deprecated and replaced by
   --allow-downgrades, --allow-remove-essential,
   --allow-change-held-packages in 1.1.

그래서:

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

APT::Get::allow-downgrades두 번째 줄은 , APT::Get::allow-remove-essential, 중 하나 이상을 APT::Get::allow-change-held-packagestrue로 설정하는 줄로 바꿔야 합니다 .

DEBIAN_FRONTEND=noninteractive은 debconf 설정이며 에서 설정해야 합니다 debconf.conf. 그만큼맨페이지예가 있습니다.

구성 파일에 이를 설정하는 대신 스크립트를 작성하는 것이 좋습니다. 또한 upgrade이전 에 실행하는 것은 의미가 없습니다 . dist-upgrade단독 dist-upgrade으로 충분합니다.

관련 정보