__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:
parent
0d96b31b56
commit
c4d19a2319
6 changed files with 49 additions and 20 deletions
|
@ -3,13 +3,13 @@ cdist-type__debian_backports(7)
|
|||
|
||||
NAME
|
||||
----
|
||||
cdist-type__debian_backports - Install backports for Debain systems
|
||||
cdist-type__apt_backports - Install backports
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
This singleton type installs backports for the current Debian version.
|
||||
It aborts if backports are not supported for the specified os or no
|
||||
This singleton type installs backports for the current OS release.
|
||||
It aborts if backports are not supported for the specified OS or no
|
||||
version codename could be fetched (like Debian unstable).
|
||||
|
||||
|
||||
|
@ -27,8 +27,8 @@ state
|
|||
Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
|
||||
|
||||
mirror
|
||||
The mirror to fetch the backports from. Will defaults to the Debian default
|
||||
`<http://deb.debian.org/debian/>`_.
|
||||
The mirror to fetch the backports from. Will defaults to the generic
|
||||
mirror of the current OS.
|
||||
|
||||
Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
|
||||
|
||||
|
@ -49,12 +49,12 @@ EXAMPLES
|
|||
.. code-block:: sh
|
||||
|
||||
# setup the backports
|
||||
__debian_backports
|
||||
__debian_backports --state absent
|
||||
__debian_backports --state present --mirror "http://ftp.de.debian.org/debian/"
|
||||
__apt_backports
|
||||
__apt_backports --state absent
|
||||
__apt_backports --state present --mirror "http://ftp.de.debian.org/debian/"
|
||||
|
||||
# update
|
||||
require="__debian_backports" __apt_update_index
|
||||
require="__apt_backports" __apt_update_index
|
||||
|
||||
# install a backports package
|
||||
# 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.
|
||||
|
||||
|
||||
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
|
||||
--------
|
||||
`Official Debian Backports site <https://backports.debian.org/>`_
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh -e
|
||||
# __debian_backports/manifest
|
||||
# __apt_backports/manifest
|
||||
#
|
||||
# 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
|
||||
os="$(cat "$__global/explorer/os")"
|
||||
case "$os" in
|
||||
debian)
|
||||
# distribution codename from /etc/os-release
|
||||
# lsb_release may not be given in all debian installations
|
||||
dist="$(
|
||||
# shellcheck disable=SC1090
|
||||
. "$__global/explorer/os-release"
|
||||
printf "%s" "$VERSION_CODENAME"
|
||||
)"
|
||||
dist="$( codename_os_release )"
|
||||
components="main"
|
||||
mirror="http://deb.debian.org/debian/"
|
||||
;;
|
||||
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
|
||||
exit 1
|
||||
|
@ -50,11 +66,16 @@ fi
|
|||
|
||||
# parameters
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
# 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
|
||||
__apt_source "${dist}-backports" \
|
||||
--state "$state" \
|
||||
--distribution "${dist}-backports" \
|
||||
--component main \
|
||||
--component "$components" \
|
||||
--uri "$mirror"
|
|
@ -1 +0,0 @@
|
|||
http://deb.debian.org/debian/
|
Loading…
Reference in a new issue