Browse Source

MEN-5410: Modify Debian packages installation for new repositories

Changelog: Download and install Debian packages taking into account the
target OS. Now downloads.mender.io serves four distributions: the two
latests releases for Debian and Ubuntu. Probe /etc/os-release to figure
out the correct package to install, and fallback to Debian Buster
packages which was the previous default.

Signed-off-by: Lluis Campos <lluis.campos@northern.tech>
change-dependabot-prefix
Lluis Campos 3 years ago
parent
commit
b19680413f
  1. 6
      configs/mender_convert_config
  2. 24
      mender-convert-modify
  3. 23
      modules/probe.sh

6
configs/mender_convert_config

@ -146,10 +146,14 @@ MENDER_ADDON_CONFIGURE_VERSION="latest"
# what you are doing.
MENDER_STORAGE_URL="https://downloads.mender.io"
# Mender APT repo, containing binary files, do not modify this unless you know
# Mender APT repo url, containing binary files, do not modify this unless you know
# what you are doing.
MENDER_APT_REPO_URL="${MENDER_STORAGE_URL}/repos/debian"
# Mender APT repo available distributions, do not modify this unless you know
# what you are doing.
MENDER_APT_REPO_DISTS="debian/buster debian/bullseye ubuntu/bionic ubuntu/focal"
# Mender GitHub organization URL prefix
MENDER_GITHUB_ORG="https://github.com/mendersoftware"

24
mender-convert-modify

@ -102,17 +102,23 @@ mkdir -p work/deb-packages
log_info "Installing Mender client and related files"
deb_arch=$(probe_debian_arch_name)
deb_distro=$(probe_debian_distro_name)
deb_codename=$(probe_debian_distro_codename)
if ! [[ "$MENDER_APT_REPO_DISTS" == *"${deb_distro}/${deb_codename}"* ]]; then
deb_distro="debian"
deb_codename="buster"
fi
if [ "${MENDER_CLIENT_INSTALL}" = "y" ]; then
log_info "Installing Mender client version ${MENDER_CLIENT_VERSION}"
if [ "${MENDER_CLIENT_VERSION}" = "latest" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "stable" "mender-client")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/stable" "mender-client")
elif [ "${MENDER_CLIENT_VERSION}" = "master" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "experimental" "mender-client")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/experimental" "mender-client")
else
DEBIAN_REVISION="-1"
DEBIAN_REVISION="-1+${deb_distro}+${deb_codename}"
deb_name=$(deb_from_repo_pool_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "mender-client" "${MENDER_CLIENT_VERSION}${DEBIAN_REVISION}")
fi
@ -133,11 +139,11 @@ if [ "${MENDER_ADDON_CONNECT_INSTALL}" = "y" ]; then
log_info "Installing Mender Connect addon"
if [ "${MENDER_ADDON_CONNECT_VERSION}" = "latest" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "stable" "mender-connect")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/stable" "mender-connect")
elif [ "${MENDER_ADDON_CONNECT_VERSION}" = "master" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "experimental" "mender-connect")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/experimental" "mender-connect")
else
DEBIAN_REVISION="-1"
DEBIAN_REVISION="-1+${deb_distro}+${deb_codename}"
deb_name=$(deb_from_repo_pool_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "mender-connect" "${MENDER_ADDON_CONNECT_VERSION}${DEBIAN_REVISION}")
fi
@ -152,11 +158,11 @@ if [ "${MENDER_ADDON_CONFIGURE_INSTALL}" = "y" ]; then
log_info "Installing Mender Configure addon"
if [ "${MENDER_ADDON_CONFIGURE_VERSION}" = "latest" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "stable" "mender-configure")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/stable" "mender-configure")
elif [ "${MENDER_ADDON_CONFIGURE_VERSION}" = "master" ]; then
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "experimental" "mender-configure")
deb_name=$(deb_from_repo_dist_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "${deb_distro}/${deb_codename}/experimental" "mender-configure")
else
DEBIAN_REVISION="-1"
DEBIAN_REVISION="-1+${deb_distro}+${deb_codename}"
deb_name=$(deb_from_repo_pool_get "work/deb-packages" ${MENDER_APT_REPO_URL} ${deb_arch} "mender-configure" "${MENDER_ADDON_CONFIGURE_VERSION}${DEBIAN_REVISION}")
fi

23
modules/probe.sh

@ -97,6 +97,29 @@ probe_debian_arch_name() {
echo "${deb_arch}"
}
# Prints Debian distro name based on ID from /etc/os-release
#
# Special handling for raspbian, where ID_LIKE is used instead
#
# No input parameters and these work on the assumption that boot and root parts
# are mounted at work/boot and work/rootfs
probe_debian_distro_name() {
distro_name="$(. work/rootfs/etc/os-release && echo "$ID")"
if [[ "$distro_name" == "raspbian" ]]; then
distro_name="$(. work/rootfs/etc/os-release && echo "$ID_LIKE")"
fi
echo "${distro_name}"
}
# Prints Debian distro codename based on VERSION_CODENAME from /etc/os-release
#
# No input parameters and these work on the assumption that boot and root parts
# are mounted at work/boot and work/rootfs
probe_debian_distro_codename() {
distro_codename="$(. work/rootfs/etc/os-release && echo "$VERSION_CODENAME")"
echo "${distro_codename}"
}
# Prints GRUB EFI target name depending on target architecture
#
# This is what the file name should be when put on target boot part.

Loading…
Cancel
Save