以下のように実行しています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/
これらのオプションを指定せずにコマンドを実行できるようにし、オプションが尊重されるようにしたいと思います。具体的には、次のものを削除します。
--option Acquire::Check-Valid-Until=false
からapt-get update
DEBIAN_FRONTEND=noninteractive
そして--yes --option Dpkg::Options::="--force-confdef" --option Dpkg::Options::="--force-confold"
からapt-get upgrade
そしてapt-get dist-upgrade
--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
2 行目は、、の 1 つ以上をAPT::Get::allow-remove-essential
trueAPT::Get::allow-change-held-packages
に設定する行に置き換える必要があります。
DEBIAN_FRONTEND=noninteractive
はdebconf設定であり、で設定する必要がありますdebconf.conf
。マニュアルページ例があります。
これらを設定ファイルで設定するのではなく、スクリプトを作成することを強くお勧めします。また、upgrade
の前にを実行しても意味がありませんdist-upgrade
。 だけdist-upgrade
で十分です。