mirror of
https://github.com/systemd/systemd.git
synced 2024-11-27 20:23:36 +08:00
Merge pull request #22859 from poettering/hardware-rename
machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
This commit is contained in:
commit
88a19c7e04
4
NEWS
4
NEWS
@ -184,8 +184,8 @@ CHANGES WITH 251 in spe:
|
||||
|
||||
'portablectl attach --extension=' now also accepts directory paths.
|
||||
|
||||
* VENDOR= and MODEL= can be set in /etc/machine-info to override the
|
||||
values gleaned from the hwdb.
|
||||
* HARDWARE_VENDOR= and HARDWARE_MODEL= can be set in /etc/machine-info
|
||||
to override the values gleaned from the hwdb.
|
||||
|
||||
* A ID_CHASSIS property can be set in the hwdb (for the DMI device
|
||||
/sys/class/dmi/id) to override the chassis that is reported by
|
||||
|
@ -130,17 +130,19 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>VENDOR=</varname></term>
|
||||
<term><varname>HARDWARE_VENDOR=</varname></term>
|
||||
|
||||
<listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI
|
||||
or hwdb will be used.</para></listitem>
|
||||
<listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI or
|
||||
<citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
|
||||
used.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>MODEL=</varname></term>
|
||||
<term><varname>HARDWARE_MODEL=</varname></term>
|
||||
|
||||
<listitem><para>Specifies the hardware model. If unspecified, the hardware model set in DMI or
|
||||
hwdb will be used.</para></listitem>
|
||||
<citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
|
||||
used.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
@ -53,8 +53,8 @@ typedef enum {
|
||||
PROP_CHASSIS,
|
||||
PROP_DEPLOYMENT,
|
||||
PROP_LOCATION,
|
||||
PROP_VENDOR,
|
||||
PROP_MODEL,
|
||||
PROP_HARDWARE_VENDOR,
|
||||
PROP_HARDWARE_MODEL,
|
||||
|
||||
/* Read from /etc/os-release (or /usr/lib/os-release) */
|
||||
PROP_OS_PRETTY_NAME,
|
||||
@ -128,7 +128,9 @@ static void context_read_machine_info(Context *c) {
|
||||
(UINT64_C(1) << PROP_ICON_NAME) |
|
||||
(UINT64_C(1) << PROP_CHASSIS) |
|
||||
(UINT64_C(1) << PROP_DEPLOYMENT) |
|
||||
(UINT64_C(1) << PROP_LOCATION));
|
||||
(UINT64_C(1) << PROP_LOCATION) |
|
||||
(UINT64_C(1) << PROP_HARDWARE_VENDOR) |
|
||||
(UINT64_C(1) << PROP_HARDWARE_MODEL));
|
||||
|
||||
r = parse_env_file(NULL, "/etc/machine-info",
|
||||
"PRETTY_HOSTNAME", &c->data[PROP_PRETTY_HOSTNAME],
|
||||
@ -136,8 +138,8 @@ static void context_read_machine_info(Context *c) {
|
||||
"CHASSIS", &c->data[PROP_CHASSIS],
|
||||
"DEPLOYMENT", &c->data[PROP_DEPLOYMENT],
|
||||
"LOCATION", &c->data[PROP_LOCATION],
|
||||
"VENDOR", &c->data[PROP_VENDOR],
|
||||
"MODEL", &c->data[PROP_MODEL]);
|
||||
"HARDWARE_VENDOR", &c->data[PROP_HARDWARE_VENDOR],
|
||||
"HARDWARE_MODEL", &c->data[PROP_HARDWARE_MODEL]);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_warning_errno(r, "Failed to read /etc/machine-info, ignoring: %m");
|
||||
|
||||
@ -563,7 +565,7 @@ static int property_get_hardware_property(
|
||||
|
||||
assert(reply);
|
||||
assert(c);
|
||||
assert(IN_SET(prop, PROP_VENDOR, PROP_MODEL));
|
||||
assert(IN_SET(prop, PROP_HARDWARE_VENDOR, PROP_HARDWARE_MODEL));
|
||||
assert(getter);
|
||||
|
||||
context_read_machine_info(c);
|
||||
@ -583,7 +585,7 @@ static int property_get_hardware_vendor(
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
return property_get_hardware_property(reply, userdata, PROP_VENDOR, get_hardware_vendor);
|
||||
return property_get_hardware_property(reply, userdata, PROP_HARDWARE_VENDOR, get_hardware_vendor);
|
||||
}
|
||||
|
||||
static int property_get_hardware_model(
|
||||
@ -595,7 +597,7 @@ static int property_get_hardware_model(
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
return property_get_hardware_property(reply, userdata, PROP_MODEL, get_hardware_model);
|
||||
return property_get_hardware_property(reply, userdata, PROP_HARDWARE_MODEL, get_hardware_model);
|
||||
}
|
||||
|
||||
static int property_get_hostname(
|
||||
@ -1179,9 +1181,9 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
|
||||
|
||||
assert_se(uname(&u) >= 0);
|
||||
|
||||
if (isempty(c->data[PROP_VENDOR]))
|
||||
if (isempty(c->data[PROP_HARDWARE_VENDOR]))
|
||||
(void) get_hardware_vendor(&vendor);
|
||||
if (isempty(c->data[PROP_MODEL]))
|
||||
if (isempty(c->data[PROP_HARDWARE_MODEL]))
|
||||
(void) get_hardware_model(&model);
|
||||
|
||||
if (privileged) {
|
||||
@ -1206,8 +1208,8 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
|
||||
JSON_BUILD_PAIR("OperatingSystemPrettyName", JSON_BUILD_STRING(c->data[PROP_OS_PRETTY_NAME])),
|
||||
JSON_BUILD_PAIR("OperatingSystemCPEName", JSON_BUILD_STRING(c->data[PROP_OS_CPE_NAME])),
|
||||
JSON_BUILD_PAIR("OperatingSystemHomeURL", JSON_BUILD_STRING(c->data[PROP_OS_HOME_URL])),
|
||||
JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_VENDOR])),
|
||||
JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_MODEL])),
|
||||
JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_HARDWARE_VENDOR])),
|
||||
JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_HARDWARE_MODEL])),
|
||||
JSON_BUILD_PAIR("HardwareSerial", JSON_BUILD_STRING(serial)),
|
||||
JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_ID128(product_uuid)),
|
||||
JSON_BUILD_PAIR_CONDITION(sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_NULL)));
|
||||
|
Loading…
Reference in New Issue
Block a user