2020-12-10 20:24:26 +00:00
|
|
|
#!/bin/sh -e
|
2020-12-12 08:36:17 +00:00
|
|
|
# __apt_backports/manifest
|
2020-12-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
# 2020 Matthias Stecher (matthiasstecher at gmx.de)
|
|
|
|
#
|
|
|
|
# This file is part of cdist.
|
|
|
|
#
|
|
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# cdist is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
2020-12-12 09:00:23 +00:00
|
|
|
# Enables/disables backports repository. Utilises __apt_source for it.
|
2020-12-10 20:24:26 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2020-12-12 08:36:17 +00:00
|
|
|
# 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
|
2021-08-24 18:32:44 +00:00
|
|
|
# shellcheck disable=SC1091
|
2020-12-12 16:29:58 +00:00
|
|
|
. "$__global/explorer/os_release"
|
2020-12-12 08:36:17 +00:00
|
|
|
printf "%s" "$VERSION_CODENAME"
|
|
|
|
}
|
|
|
|
|
2020-12-10 20:24:26 +00:00
|
|
|
# detect backport distribution
|
|
|
|
os="$(cat "$__global/explorer/os")"
|
|
|
|
case "$os" in
|
|
|
|
debian)
|
2020-12-12 08:36:17 +00:00
|
|
|
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"
|
2020-12-10 20:24:26 +00:00
|
|
|
;;
|
2020-12-12 08:36:17 +00:00
|
|
|
ubuntu)
|
|
|
|
dist="$( codename_os_release )"
|
|
|
|
components="main restricted universe multiverse"
|
|
|
|
mirror="http://archive.ubuntu.com/ubuntu"
|
|
|
|
;;
|
|
|
|
|
2020-12-10 20:24:26 +00:00
|
|
|
*)
|
|
|
|
printf "Backports for %s are not supported!\n" "$os" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# error if no codename given (e.g. on Debian unstable)
|
|
|
|
if [ -z "$dist" ]; then
|
|
|
|
printf "No backports for unkown version of distribution %s!\n" "$os" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# parameters
|
|
|
|
state="$(cat "$__object/parameter/state")"
|
2020-12-12 08:36:17 +00:00
|
|
|
|
|
|
|
# mirror already set for the os, only override user-values
|
|
|
|
if [ -f "$__object/parameter/mirror" ]; then
|
|
|
|
mirror="$(cat "$__object/parameter/mirror")"
|
|
|
|
fi
|
|
|
|
|
2020-12-10 20:24:26 +00:00
|
|
|
|
|
|
|
# install the given backports repository
|
|
|
|
__apt_source "${dist}-backports" \
|
|
|
|
--state "$state" \
|
|
|
|
--distribution "${dist}-backports" \
|
2020-12-12 08:36:17 +00:00
|
|
|
--component "$components" \
|
2020-12-10 20:24:26 +00:00
|
|
|
--uri "$mirror"
|