__prometheus_{server,alertmanager}: use os_version instead of lsb_release

works without the `lsb-release` package and actually seems to be more reliable, even though it is inconsistent between debian and devuan
This commit is contained in:
kamila 2018-03-11 10:55:21 +01:00
parent 7ae24cf677
commit 787f5237e5
2 changed files with 12 additions and 20 deletions

View file

@ -17,22 +17,18 @@ storage_path="$(cat "$__object/parameter/storage-path")"
require_pkg="" # what to require if I want to require "the package"
if [ -f "$__object/parameter/install-from-backports" ]; then
os=$(cat "$__global/explorer/os")
lsb_codename=$(cat "$__global/explorer/lsb_codename")
os_version=$(cat "$__global/explorer/os_version")
case $os in
devuan)
if [ -z "$lsb_codename" ]; then
echo "Command `lsb_release` not functional -- is package `lsb-release` installed?" >&2
exit 1
fi
[ "$lsb_codename" = "n/a" ] && lsb_codename='ascii' # TODO this is a devuan bug that should be fixed soon => remove when no longer needed
__apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $lsb_codename-backports --component main
require="$require __apt_source/backports" __package_apt prometheus-alertmanager --target-release $lsb_codename-backports
[ "$os_version" = "ascii/ceres" ] && os_version='ascii' # "ascii" used in the repo URLs
__apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $os_version-backports --component main
require="$require __apt_source/backports" __package_apt prometheus-alertmanager --target-release $os_version-backports
require_pkg="__package_apt/prometheus-alertmanager"
;;
*)
echo "--install-from-backports is only supported on Devuan -- ignoring" >&2
echo "send a pull request if you require it" >&2
echo "--install-from-backports is only supported on Devuan -- ignoring." >&2
echo "Send a pull request if you require it." >&2
;;
esac
else

View file

@ -20,22 +20,18 @@ rule_files="$(cat "$__object/parameter/rule-files")"
require_pkg="" # what to require if I want to require "the package"
if [ -f "$__object/parameter/install-from-backports" ]; then
os=$(cat "$__global/explorer/os")
lsb_codename=$(cat "$__global/explorer/lsb_codename")
os_version=$(cat "$__global/explorer/os_version")
case $os in
devuan)
if [ -z "$lsb_codename" ]; then
echo "Command `lsb_release` not functional -- is package `lsb-release` installed?" >&2
exit 1
fi
[ "$lsb_codename" = "n/a" ] && lsb_codename='ascii' # TODO this is a devuan bug that should be fixed soon => remove when no longer needed
__apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $lsb_codename-backports --component main
require="$require __apt_source/backports" __package_apt prometheus --target-release $lsb_codename-backports
[ "$os_version" = "ascii/ceres" ] && os_version='ascii' # "ascii" used in the repo URLs
__apt_source backports --uri http://auto.mirror.devuan.org/merged --distribution $os_version-backports --component main
require="$require __apt_source/backports" __package_apt prometheus --target-release $os_version-backports
require_pkg="__package_apt/prometheus"
;;
*)
echo "--install-from-backports is only supported on Devuan -- ignoring" >&2
echo "send a pull request if you require it" >&2
echo "--install-from-backports is only supported on Devuan -- ignoring." >&2
echo "Send a pull request if you require it." >&2
;;
esac
else