@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HomeURL = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
+ readonly s OperatingSystemImageID = '...';
+ @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
+ readonly s OperatingSystemImageVersion = '...';
+ @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HardwareVendor = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HardwareModel = '...';
<variablelist class="dbus-property" generated="True" extra-ref="HomeURL"/>
+ <variablelist class="dbus-property" generated="True" extra-ref="OperatingSystemImageID"/>
+
+ <variablelist class="dbus-property" generated="True" extra-ref="OperatingSystemImageVersion"/>
+
<variablelist class="dbus-property" generated="True" extra-ref="HardwareVendor"/>
<variablelist class="dbus-property" generated="True" extra-ref="HardwareModel"/>
information is known. It's an unsigned 64bit value, in µs since the UNIX epoch, UTC. If this information
is not known carries the value 2^64-1, i.e. <constant>UINT64_MAX</constant>.</para>
+ <para><varname>OperatingSystemImageID</varname> and <varname>OperatingSystemImageVersion</varname> expose
+ the OS image name and version if available, or contain empty strings otherwise. This mostly corresponds
+ to the <varname>IMAGE_ID=</varname> and <varname>IMAGE_VERSION=</varname> fields of the
+ <filename>os-release</filename> file.</para>
+
<para><varname>HardwareVendor</varname> and <varname>HardwareModel</varname> expose information about the
vendor of the hardware of the system. If no such information can be determined these properties are set
to empty strings.</para>
<varname>FirmwareDate</varname> were added in version 253.</para>
<para><varname>MachineID</varname>, <varname>BootID</varname> and
<varname>VSockCID</varname> were added in version 256.</para>
- <para><varname>ChassisAssetTag</varname> was added in version 258.</para>
+ <para><varname>ChassisAssetTag</varname>, <varname>OperatingSystemImageID</varname> and
+ <varname>OperatingSystemImageVersion</varname> were added in version 258.</para>
</refsect2>
</refsect1>
const char *os_pretty_name;
const char *os_cpe_name;
usec_t os_support_end;
+ const char *os_image_id;
+ const char *os_image_version;
const char *virtualization;
const char *architecture;
const char *home_url;
return table_log_add_error(r);
}
+ if (!isempty(i->os_image_id)) {
+ r = table_add_many(table,
+ TABLE_FIELD, "OS Image",
+ TABLE_STRING, i->os_image_id);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
+ if (!isempty(i->os_image_version)) {
+ r = table_add_many(table,
+ TABLE_FIELD, "OS Image Version",
+ TABLE_STRING, i->os_image_version);
+ if (r < 0)
+ return table_log_add_error(r);
+ }
+
if (!isempty(i->kernel_name) && !isempty(i->kernel_release)) {
const char *v;
};
static const struct bus_properties_map hostname_map[] = {
- { "Hostname", "s", NULL, offsetof(StatusInfo, hostname) },
- { "StaticHostname", "s", NULL, offsetof(StatusInfo, static_hostname) },
- { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
- { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) },
- { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) },
- { "ChassisAssetTag", "s", NULL, offsetof(StatusInfo, chassis_asset_tag)},
- { "Deployment", "s", NULL, offsetof(StatusInfo, deployment) },
- { "Location", "s", NULL, offsetof(StatusInfo, location) },
- { "KernelName", "s", NULL, offsetof(StatusInfo, kernel_name) },
- { "KernelRelease", "s", NULL, offsetof(StatusInfo, kernel_release) },
- { "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) },
- { "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) },
- { "OperatingSystemSupportEnd", "t", NULL, offsetof(StatusInfo, os_support_end) },
- { "HomeURL", "s", NULL, offsetof(StatusInfo, home_url) },
- { "HardwareVendor", "s", NULL, offsetof(StatusInfo, hardware_vendor) },
- { "HardwareModel", "s", NULL, offsetof(StatusInfo, hardware_model) },
- { "FirmwareVersion", "s", NULL, offsetof(StatusInfo, firmware_version) },
- { "FirmwareDate", "t", NULL, offsetof(StatusInfo, firmware_date) },
- { "MachineID", "ay", bus_map_id128, offsetof(StatusInfo, machine_id) },
- { "BootID", "ay", bus_map_id128, offsetof(StatusInfo, boot_id) },
- { "VSockCID", "u", NULL, offsetof(StatusInfo, vsock_cid) },
+ { "Hostname", "s", NULL, offsetof(StatusInfo, hostname) },
+ { "StaticHostname", "s", NULL, offsetof(StatusInfo, static_hostname) },
+ { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
+ { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) },
+ { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) },
+ { "ChassisAssetTag", "s", NULL, offsetof(StatusInfo, chassis_asset_tag)},
+ { "Deployment", "s", NULL, offsetof(StatusInfo, deployment) },
+ { "Location", "s", NULL, offsetof(StatusInfo, location) },
+ { "KernelName", "s", NULL, offsetof(StatusInfo, kernel_name) },
+ { "KernelRelease", "s", NULL, offsetof(StatusInfo, kernel_release) },
+ { "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) },
+ { "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) },
+ { "OperatingSystemSupportEnd", "t", NULL, offsetof(StatusInfo, os_support_end) },
+ { "OperatingSystemImageID", "s", NULL, offsetof(StatusInfo, os_image_id) },
+ { "OperatingSystemImageVersion", "s", NULL, offsetof(StatusInfo, os_image_version) },
+ { "HomeURL", "s", NULL, offsetof(StatusInfo, home_url) },
+ { "HardwareVendor", "s", NULL, offsetof(StatusInfo, hardware_vendor) },
+ { "HardwareModel", "s", NULL, offsetof(StatusInfo, hardware_model) },
+ { "FirmwareVersion", "s", NULL, offsetof(StatusInfo, firmware_version) },
+ { "FirmwareDate", "t", NULL, offsetof(StatusInfo, firmware_date) },
+ { "MachineID", "ay", bus_map_id128, offsetof(StatusInfo, machine_id) },
+ { "BootID", "ay", bus_map_id128, offsetof(StatusInfo, boot_id) },
+ { "VSockCID", "u", NULL, offsetof(StatusInfo, vsock_cid) },
{}
}, manager_map[] = {
- { "Virtualization", "s", NULL, offsetof(StatusInfo, virtualization) },
- { "Architecture", "s", NULL, offsetof(StatusInfo, architecture) },
+ { "Virtualization", "s", NULL, offsetof(StatusInfo, virtualization) },
+ { "Architecture", "s", NULL, offsetof(StatusInfo, architecture) },
{}
};
PROP_OS_CPE_NAME,
PROP_OS_HOME_URL,
PROP_OS_SUPPORT_END,
+ PROP_OS_IMAGE_ID,
+ PROP_OS_IMAGE_VERSION,
_PROP_MAX,
_PROP_INVALID = -EINVAL,
} HostProperty;
(UINT64_C(1) << PROP_OS_PRETTY_NAME) |
(UINT64_C(1) << PROP_OS_CPE_NAME) |
(UINT64_C(1) << PROP_OS_HOME_URL) |
- (UINT64_C(1) << PROP_OS_SUPPORT_END));
+ (UINT64_C(1) << PROP_OS_SUPPORT_END) |
+ (UINT64_C(1) << PROP_OS_IMAGE_ID) |
+ (UINT64_C(1) << PROP_OS_IMAGE_VERSION));
r = parse_os_release(NULL,
- "PRETTY_NAME", &os_pretty_name,
- "NAME", &os_name,
- "CPE_NAME", &c->data[PROP_OS_CPE_NAME],
- "HOME_URL", &c->data[PROP_OS_HOME_URL],
- "SUPPORT_END", &c->data[PROP_OS_SUPPORT_END]);
+ "PRETTY_NAME", &os_pretty_name,
+ "NAME", &os_name,
+ "CPE_NAME", &c->data[PROP_OS_CPE_NAME],
+ "HOME_URL", &c->data[PROP_OS_HOME_URL],
+ "SUPPORT_END", &c->data[PROP_OS_SUPPORT_END],
+ "IMAGE_ID", &c->data[PROP_OS_IMAGE_ID],
+ "IMAGE_VERSION", &c->data[PROP_OS_IMAGE_VERSION]);
if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read os-release file, ignoring: %m");
SD_JSON_BUILD_PAIR_STRING("OperatingSystemHomeURL", c->data[PROP_OS_HOME_URL]),
JSON_BUILD_PAIR_FINITE_USEC("OperatingSystemSupportEnd", eol),
SD_JSON_BUILD_PAIR("OperatingSystemReleaseData", JSON_BUILD_STRV_ENV_PAIR(os_release_pairs)),
+ SD_JSON_BUILD_PAIR_STRING("OperatingSystemImageID", c->data[PROP_OS_IMAGE_ID]),
+ SD_JSON_BUILD_PAIR_STRING("OperatingSystemImageVersion", c->data[PROP_OS_IMAGE_VERSION]),
SD_JSON_BUILD_PAIR("MachineInformationData", JSON_BUILD_STRV_ENV_PAIR(machine_info_pairs)),
SD_JSON_BUILD_PAIR_STRING("HardwareVendor", vendor ?: c->data[PROP_HARDWARE_VENDOR]),
SD_JSON_BUILD_PAIR_STRING("HardwareModel", model ?: c->data[PROP_HARDWARE_MODEL]),
SD_BUS_VTABLE_START(0),
SD_BUS_PROPERTY("Hostname", "s", property_get_hostname, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("StaticHostname", "s", property_get_static_hostname, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
- SD_BUS_PROPERTY("PrettyHostname", "s", property_get_machine_info_field, offsetof(Context, data) + sizeof(char*) * PROP_PRETTY_HOSTNAME, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+ SD_BUS_PROPERTY("PrettyHostname", "s", property_get_machine_info_field, offsetof(Context, data[PROP_PRETTY_HOSTNAME]), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("DefaultHostname", "s", property_get_default_hostname, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HostnameSource", "s", property_get_hostname_source, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("IconName", "s", property_get_icon_name, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("Chassis", "s", property_get_chassis, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
- SD_BUS_PROPERTY("Deployment", "s", property_get_machine_info_field, offsetof(Context, data) + sizeof(char*) * PROP_DEPLOYMENT, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
- SD_BUS_PROPERTY("Location", "s", property_get_machine_info_field, offsetof(Context, data) + sizeof(char*) * PROP_LOCATION, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+ SD_BUS_PROPERTY("Deployment", "s", property_get_machine_info_field, offsetof(Context, data[PROP_DEPLOYMENT]), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
+ SD_BUS_PROPERTY("Location", "s", property_get_machine_info_field, offsetof(Context, data[PROP_LOCATION]), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("KernelName", "s", property_get_uname_field, offsetof(struct utsname, sysname), SD_BUS_VTABLE_ABSOLUTE_OFFSET|SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("KernelRelease", "s", property_get_uname_field, offsetof(struct utsname, release), SD_BUS_VTABLE_ABSOLUTE_OFFSET|SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("KernelVersion", "s", property_get_uname_field, offsetof(struct utsname, version), SD_BUS_VTABLE_ABSOLUTE_OFFSET|SD_BUS_VTABLE_PROPERTY_CONST),
- SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
- SD_BUS_PROPERTY("OperatingSystemCPEName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", property_get_os_release_field, offsetof(Context, data[PROP_OS_PRETTY_NAME]), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("OperatingSystemCPEName", "s", property_get_os_release_field, offsetof(Context, data[PROP_OS_CPE_NAME]), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("OperatingSystemSupportEnd", "t", property_get_os_support_end, 0, SD_BUS_VTABLE_PROPERTY_CONST),
- SD_BUS_PROPERTY("HomeURL", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_HOME_URL, SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("HomeURL", "s", property_get_os_release_field, offsetof(Context, data[PROP_OS_HOME_URL]), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("OperatingSystemImageID", "s", property_get_os_release_field, offsetof(Context, data[PROP_OS_IMAGE_ID]), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("OperatingSystemImageVersion", "s", property_get_os_release_field, offsetof(Context, data[PROP_OS_IMAGE_VERSION]), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HardwareVendor", "s", property_get_hardware_vendor, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HardwareModel", "s", property_get_hardware_model, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("FirmwareVersion", "s", property_get_firmware_version, 0, SD_BUS_VTABLE_PROPERTY_CONST),