diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-03-23 16:10:31 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-03-31 10:46:22 +0200 |
commit | 9a515f0a55318d6db49be1f67fe7d3a7f8a3002c (patch) | |
tree | e0000a1a61c0fc2929e532acaea9d474f66dd634 /src/shared/specifier.h | |
parent | e8726796296e86f05d3845911f93407d7122e270 (diff) | |
download | systemd-9a515f0a55318d6db49be1f67fe7d3a7f8a3002c.tar.gz |
shared: add new IMAGE_VERSION=/IMAGE_ID= field to /etc/os-release
This specifes two new optional fields for /etc/os-release:
IMAGE_VERSION= and IMAGE_ID= that are supposed to identify the image of
the current booted system by name and version.
This is inspired by the versioning stuff in
https://github.com/systemd/mkosi/pull/683.
In environments where pre-built images are installed and updated as a
whole the existing os-release version/distro identifier are not
sufficient to describe the system's version, as they describe only the
distro an image is built from, but not the image itself, even if that
image is deployed many times on many systems, and even if that image
contains more resources than just the RPMs/DEBs.
In particular, "mkosi" is a tool for building disk images based on
distro RPMs with additional resources dropped in. The combination of all
of these together with their versions should also carry an identifier
and version, and that's what IMAGE_VERSION= and IMAGE_ID= is supposed to
be.
Diffstat (limited to 'src/shared/specifier.h')
-rw-r--r-- | src/shared/specifier.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/specifier.h b/src/shared/specifier.h index 1323b41d98..6735a7a363 100644 --- a/src/shared/specifier.h +++ b/src/shared/specifier.h @@ -25,6 +25,8 @@ int specifier_os_id(char specifier, const void *data, const void *userdata, char int specifier_os_version_id(char specifier, const void *data, const void *userdata, char **ret); int specifier_os_build_id(char specifier, const void *data, const void *userdata, char **ret); int specifier_os_variant_id(char specifier, const void *data, const void *userdata, char **ret); +int specifier_os_image_id(char specifier, const void *data, const void *userdata, char **ret); +int specifier_os_image_version(char specifier, const void *data, const void *userdata, char **ret); int specifier_group_name(char specifier, const void *data, const void *userdata, char **ret); int specifier_group_id(char specifier, const void *data, const void *userdata, char **ret); @@ -41,11 +43,13 @@ int specifier_var_tmp_dir(char specifier, const void *data, const void *userdata * * COMMON_SYSTEM_SPECIFIERS: * %a: the native userspace architecture + * %A: the OS image version, according to /etc/os-release * %b: the boot ID of the running system * %B: the OS build ID, according to /etc/os-release * %H: the hostname of the running system * %l: the short hostname of the running system * %m: the machine ID of the running system + * %M: the OS image ID, according to /etc/os-release * %o: the OS ID according to /etc/os-release * %v: the kernel version * %w: the OS version ID, according to /etc/os-release @@ -64,16 +68,19 @@ int specifier_var_tmp_dir(char specifier, const void *data, const void *userdata #define COMMON_SYSTEM_SPECIFIERS \ { 'a', specifier_architecture, NULL }, \ + { 'A', specifier_os_image_version,NULL }, \ { 'b', specifier_boot_id, NULL }, \ { 'B', specifier_os_build_id, NULL }, \ { 'H', specifier_host_name, NULL }, \ { 'l', specifier_short_host_name, NULL }, \ { 'm', specifier_machine_id, NULL }, \ + { 'M', specifier_os_image_id, NULL }, \ { 'o', specifier_os_id, NULL }, \ { 'v', specifier_kernel_release, NULL }, \ { 'w', specifier_os_version_id, NULL }, \ { 'W', specifier_os_variant_id, NULL } + #define COMMON_CREDS_SPECIFIERS \ { 'g', specifier_group_name, NULL }, \ { 'G', specifier_group_id, NULL }, \ |