Browse Source

Merge branch 'feature/__package_apt/recommends' into 'master'

__package_apt: add --install-recommends parameter

See merge request ungleich-public/cdist!949
bugfix/in-script-import
poljakowski 2 years ago
parent
commit
fe8920740f
  1. 17
      cdist/conf/type/__package_apt/gencode-remote
  2. 15
      cdist/conf/type/__package_apt/man.rst
  3. 1
      cdist/conf/type/__package_apt/parameter/boolean

17
cdist/conf/type/__package_apt/gencode-remote vendored

@ -42,6 +42,13 @@ else
target_release=""
fi
if [ -f "$__object/parameter/install-recommends" ]; then
# required if __apt_norecommends is used
recommendsparam="-o APT::Install-Recommends=1"
else
recommendsparam="-o APT::Install-Recommends=0"
fi
if [ -f "$__object/parameter/purge-if-absent" ]; then
purgeparam="--purge"
else
@ -62,16 +69,16 @@ case "$state_is" in
;;
esac
# Hint if we need to avoid questions at some point:
# DEBIAN_PRIORITY=critical can reduce the number of questions
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes -o APT::Install-Recommends=0 -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
if [ "$state_is" = "$state_should" ]; then
if [ -z "$version" ] || [ "$version" = "$version_is" ]; then
exit 0;
fi
fi
# Hint if we need to avoid questions at some point:
# DEBIAN_PRIORITY=critical can reduce the number of questions
aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\""
case "$state_should" in
present)
# following is bit ugly, but important hack.
@ -85,7 +92,7 @@ EOF
if [ -n "$version" ]; then
name="${name}=${version}"
fi
echo "$aptget install $target_release '$name'"
echo "$aptget $recommendsparam install $target_release '$name'"
echo "installed" >> "$__messages_out"
;;
absent)

15
cdist/conf/type/__package_apt/man.rst vendored

@ -9,7 +9,9 @@ cdist-type__package_apt - Manage packages with apt-get
DESCRIPTION
-----------
apt-get is usually used on Debian and variants (like Ubuntu) to
manage packages.
manage packages. The package will be installed without recommended
or suggested packages. If such packages are required, install them
separatly or use the parameter ``--install-recommends``.
This type will also update package index, if it is older
than one day, to avoid missing package error messages.
@ -23,7 +25,7 @@ None
OPTIONAL PARAMETERS
-------------------
name
If supplied, use the name and not the object id as the package name.
If supplied, use the name and not the object id as the package name.
state
Either "present" or "absent", defaults to "present"
@ -39,6 +41,15 @@ version
BOOLEAN PARAMETERS
------------------
install-recommends
If the package will be installed, it also installs recommended packages
with it. It will not install recommended packages if the original package
is already installed.
In most cases, it is recommended to install recommended packages separatly
to control which additional packages will be installed to avoid useless
installed packages.
purge-if-absent
If this parameter is given when state is `absent`, the package is
purged from the system (using `--purge`).

1
cdist/conf/type/__package_apt/parameter/boolean vendored

@ -1 +1,2 @@
install-recommends
purge-if-absent

Loading…
Cancel
Save