__debian_backports -> __apt_backports; add wider os support

As discussed in the chat, this type now supports a broader list of OSes
which it supports backports for. Because of this, it was renamed to
something more generic. "apt" should fit in.
This commit is contained in:
matze 2020-12-12 09:36:17 +01:00
parent 0d96b31b56
commit c4d19a2319
6 changed files with 49 additions and 20 deletions

View file

@ -3,13 +3,13 @@ cdist-type__debian_backports(7)
NAME NAME
---- ----
cdist-type__debian_backports - Install backports for Debain systems cdist-type__apt_backports - Install backports
DESCRIPTION DESCRIPTION
----------- -----------
This singleton type installs backports for the current Debian version. This singleton type installs backports for the current OS release.
It aborts if backports are not supported for the specified os or no It aborts if backports are not supported for the specified OS or no
version codename could be fetched (like Debian unstable). version codename could be fetched (like Debian unstable).
@ -27,8 +27,8 @@ state
Will be directly passed to :strong:`cdist-type__apt_source`\ (7). Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
mirror mirror
The mirror to fetch the backports from. Will defaults to the Debian default The mirror to fetch the backports from. Will defaults to the generic
`<http://deb.debian.org/debian/>`_. mirror of the current OS.
Will be directly passed to :strong:`cdist-type__apt_source`\ (7). Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
@ -49,12 +49,12 @@ EXAMPLES
.. code-block:: sh .. code-block:: sh
# setup the backports # setup the backports
__debian_backports __apt_backports
__debian_backports --state absent __apt_backports --state absent
__debian_backports --state present --mirror "http://ftp.de.debian.org/debian/" __apt_backports --state present --mirror "http://ftp.de.debian.org/debian/"
# update # update
require="__debian_backports" __apt_update_index require="__apt_backports" __apt_update_index
# install a backports package # install a backports package
# currently for the buster release backports # currently for the buster release backports
@ -70,6 +70,15 @@ Aborts if no distribuition codename could be detected. This is common for the
unstable distribution, but there is no backports repository for it already. unstable distribution, but there is no backports repository for it already.
CAVEATS
-------
For Ubuntu, it setup all componenents for the backports repository: ``main``,
``restricted``, ``universe`` and ``multiverse``. The user may not want to
install proprietary packages, which will only be installed if the user
explicitly uses the backports target-release. The user may change this behavior
to install backports packages without the need of explicitly select it.
SEE ALSO SEE ALSO
-------- --------
`Official Debian Backports site <https://backports.debian.org/>`_ `Official Debian Backports site <https://backports.debian.org/>`_

View file

@ -1,5 +1,5 @@
#!/bin/sh -e #!/bin/sh -e
# __debian_backports/manifest # __apt_backports/manifest
# #
# 2020 Matthias Stecher (matthiasstecher at gmx.de) # 2020 Matthias Stecher (matthiasstecher at gmx.de)
# #
@ -23,18 +23,34 @@
# #
# Get the distribution codename by /etc/os-release.
# is already executed in a subshell by string substitution
# lsb_release may not be given in all installations
codename_os_release() {
# shellcheck disable=SC1090
. "$__global/explorer/os-release"
printf "%s" "$VERSION_CODENAME"
}
# detect backport distribution # detect backport distribution
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
debian) debian)
# distribution codename from /etc/os-release dist="$( codename_os_release )"
# lsb_release may not be given in all debian installations components="main"
dist="$( mirror="http://deb.debian.org/debian/"
# shellcheck disable=SC1090
. "$__global/explorer/os-release"
printf "%s" "$VERSION_CODENAME"
)"
;; ;;
devuan)
dist="$( codename_os_release )"
components="main"
mirror="http://deb.devuan.org/merged"
;;
ubuntu)
dist="$( codename_os_release )"
components="main restricted universe multiverse"
mirror="http://archive.ubuntu.com/ubuntu"
;;
*) *)
printf "Backports for %s are not supported!\n" "$os" >&2 printf "Backports for %s are not supported!\n" "$os" >&2
exit 1 exit 1
@ -50,11 +66,16 @@ fi
# parameters # parameters
state="$(cat "$__object/parameter/state")" state="$(cat "$__object/parameter/state")"
mirror="$(cat "$__object/parameter/mirror")"
# mirror already set for the os, only override user-values
if [ -f "$__object/parameter/mirror" ]; then
mirror="$(cat "$__object/parameter/mirror")"
fi
# install the given backports repository # install the given backports repository
__apt_source "${dist}-backports" \ __apt_source "${dist}-backports" \
--state "$state" \ --state "$state" \
--distribution "${dist}-backports" \ --distribution "${dist}-backports" \
--component main \ --component "$components" \
--uri "$mirror" --uri "$mirror"

View file

@ -1 +0,0 @@
http://deb.debian.org/debian/