apps: add 'YNH_DEBIAN_VERSION' variable in apps contexts

This commit is contained in:
Alexandre Aubin 2023-02-21 13:03:51 +01:00
parent b887545c3e
commit df6a2a2cd2
2 changed files with 6 additions and 0 deletions

View file

@ -62,6 +62,7 @@ from yunohost.utils.system import (
dpkg_is_broken,
get_ynh_package_version,
system_arch,
debian_version,
human_to_binary,
binary_to_human,
ram_available,
@ -2854,6 +2855,7 @@ def _make_environment_for_app_script(
"YNH_APP_MANIFEST_VERSION": manifest.get("version", "?"),
"YNH_APP_PACKAGING_FORMAT": str(manifest["packaging_format"]),
"YNH_ARCH": system_arch(),
"YNH_DEBIAN_VERSION": debian_version(),
}
if workdir:

View file

@ -28,6 +28,10 @@ logger = logging.getLogger("yunohost.utils.packages")
YUNOHOST_PACKAGES = ["yunohost", "yunohost-admin", "moulinette", "ssowat"]
def debian_version():
return check_output('grep "^VERSION_CODENAME=" /etc/os-release | cut -d= -f2')
def system_arch():
return check_output("dpkg --print-architecture")