// https://github.com/JefferysDockers/ubu-lts/blob/master/Dockerfile
// https://gitlab.com/kalilinux/build-scripts/kali-docker/-/blob/master/build-rootfs.sh

// Package installation uses and leaves caches, but these are not needed after
// the Docker build. Apt-clean needs to be run, but apparently there is some
// difficulty in doing this. Therefore caches are cleared using post-install
// hooks and config parameters.
DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
//APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };
Dir::Cache::pkgcache "";
Dir::Cache::srcpkgcache "";

// Prevent extra package installation.
// https://www.linuxquestions.org/questions/debian-26/how-to-configure-apt-get-to-install-suggested-packages-169746/
APT::Install-Recommends "false";
APT::Install-Suggests "false";
APT::Get::Install-Recommends "false";
APT::Get::Install-Suggests "false";
APT::AutoRemove::SuggestsImportant "false";
APT::AutoRemove::RecommendsImportant "false";

// Ensure apt package lists are compressed to save space.
Acquire::GzipIndexes "true";
Acquire::CompressionTypes::Order:: "gz";

// If a package is installed as a dependency, and the package it was installed
// for is removed, the dependency is uninstalled if no other package needs it.
// Needing it normally includes if any package suggests it, even if suggested
// packages are not being installed. Once installed, why remove it if it might
// be useful? To save space. Docker images put a premium on space, so configure
// apt to ignore suggestions when deciding which dependencies prevent deletion.
Acquire::Languages "none";

// Give more chances to succeed since Parrot sometimes catches when mirror cycling.
Acquire::Retries "4";

// https://unix.stackexchange.com/questions/416815/force-non-interactive-dpkg-configure-when-using-apt-get-install
DPkg::options { "--force-confdef"; };
