summaryrefslogtreecommitdiff
path: root/src/hostname
Commit message (Collapse)AuthorAgeFilesLines
* basic: add RuntimeScope enumLennart Poettering2023-03-101-1/+1
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* hostnamectl: show support and among outputLennart Poettering2023-01-241-0/+32
|
* hostnamed: expose support end timestamp as property on the busLennart Poettering2023-01-241-5/+33
|
* tree-wide: unify how we pick OS pretty name to displayLennart Poettering2023-01-241-1/+6
|
* hostnamectl: show firmware date with date only, without timeLennart Poettering2023-01-201-1/+1
| | | | | The source (usually DMI/SMBIOS) only has 24h granularity, hence don't show time as well, it's useless.
* hostnamed: expose FirmwareDate as timestamp in dbusJelle van der Waa2023-01-192-7/+75
| | | | | | Offer the firmware date as an epoch instead of the literal DMI string. Closes #25679
* hostnamed: expose FirmwareDate dbus propertyJelle van der Waa2022-12-071-1/+23
| | | | Expose /sys/class/dmi/id/bios_date as dbus property in hostnamed.
* hostnamed: expose FirmwareVendor as dbus propertyJelle van der Waa2022-12-071-1/+25
| | | | Expose /sys/class/dmi/id/bios_vendor as dbus property in hostnamed.
* hostnamectl: port to vertical tableDavid Tardon2022-11-131-21/+18
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* tree-wide: use the term "initrd" at most places we so far used "initramfs"Lennart Poettering2022-09-231-2/+2
| | | | | | | | | | | | In most cases we refernced the concept as "initrd". Let's convert most remaining uses of "initramfs" to "initrd" too, to stay internally consistent. This leaves "initramfs" only where it's relevant to explain historical concepts or where "initramfs" is part of the API (i.e. in /run/initramfs). Follow-up for: b66a6e1a5838b874b789820c090dd6850cf10513
* shared/format-table: use enum instead of Table.empty_stringZbigniew Jędrzejewski-Szmek2022-09-221-3/+1
| | | | | | | | | | | | All users were setting this to some static string (usually "-"), so let's simplify things by not doing strdup, but instead limiting callers to a fixed set of values. In preparation for the next commit, the function is renamed from "empty" to "replacement", because it'll be used for more than empty fields. I didn't do the whole string-table setup, because it's all used internally in one file and this way we can immediately assert if an invalid value is passed in. Some callers were (void)ing the error, others were ignoring it, and others propagating. It's nicer to remove the boilerplate.
* hostnamectl,localectl: use "(unset)" in empty fieldsZbigniew Jędrzejewski-Szmek2022-09-211-1/+1
| | | | | "n/a" is more ambiguous: not available or not set or maybe we didn't check it. Let's just say directly that the field is not set.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-14/+7
|
* hostname: make chassis type actually obtained from ACPI when nothing from DMIYu Watanabe2022-08-221-1/+1
| | | | | | Fixes a bug introduced by 8c8b1800e90d4307397300ef32b0f6d95efad057. Fixes #24384.
* Use https for freedesktop.orgMichael Biebl2022-06-282-2/+2
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* hostnamed: update to use new style sd-bus macrosSonali Srivastava2022-04-211-62/+45
|
* hostnamed: display firmware versionSonali Srivastava2022-04-192-21/+62
|
* virt: make virtualization enum a named typeLennart Poettering2022-04-041-1/+2
| | | | | | | | These days we have a mechanism for safely returning errnos in enum types, via definining -ERRNO_MAX as one special enu value. Let's use that for Virtualization. No change in behaviour, just some typesafety improvement.
* tree-wide: add a space after if, switch, for, and whileYu Watanabe2022-04-011-1/+1
|
* hostnamed: properly reset hw model/vendor props before re-reading themLennart Poettering2022-03-241-1/+3
| | | | Follow-up for 4fc7e4f374bf4401330e90e267227267abf1dcac
* machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=Lennart Poettering2022-03-241-11/+11
| | | | | | | | | | | | Let's be more precise here. Otherwise people might think this describes the software system or so. We already expose this via hostnamed as HardwareVendor/HardwareModel hence use the exact same wording. (Note that the relevant props on the dmi device are just VENDOR/MODEL, but that's OK given that DMI really is about hardware anyway, unconditionally, hence no chance of confusion there.) Follow-up for 4fc7e4f374bf4401330e90e267227267abf1dcac
* hostnamed: update chassis table to SMBIOS 3.5Lennart Poettering2022-03-141-7/+13
|
* hostnamectl: use u8 literal specifierYu Watanabe2022-03-111-8/+8
|
* hostnamed: trivial optimizationLennart Poettering2022-02-031-3/+4
|
* hostnamed: drop "iteractive" parameter from GetHardwareSerial()Lennart Poettering2022-02-031-8/+3
| | | | | | | | | | | | | | | Since a long time the D-Bus spec knows a special bit in its message header for indicating that "interactive" authentication is OK. The original hostnamed API is before that was added hence most functions expose that boolean as explicit argument. For new added functions let's get rid of it, the message flag is good enough and replaces it with complete functionality. No new APIs should carry the "interactive" boolean flag explicitly as argument anymore. Follow-up for: 9697662915e47a4797b05003cb1970fe2b01e530
* hostname: expose hardware serial through dbusYu Watanabe2022-01-242-4/+105
| | | | Closes #22119.
* hostname: allow to override hardware vendor and modelYu Watanabe2022-01-231-15/+36
| | | | | | | | | | Sometimes hardware vendor does not set DMI info correctly. Already there is a way that the dbus properties can be overriden by using hwdb. But that is not user friendly. This adds two new fields in /etc/machine-info. Closes #22207.
* hostname: introduce context_get_chassis() and use it everywhereYu Watanabe2022-01-231-52/+61
| | | | Follow-up for 4b35eb2579b226785f0d94129a7652450f9723fd.
* hostname: Allow overriding the chassis type from hwdbBastien Nocera2022-01-211-5/+7
| | | | Closes: #7390
* policy files: adjust landing page linkZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
|
* hostname: use _cleanup_ in one more placeZbigniew Jędrzejewski-Szmek2021-12-231-14/+11
|
* hostnamectl: add a chassis symbol in status outputZbigniew Jędrzejewski-Szmek2021-12-141-1/+27
| | | | | | | | | | | | | The idea is to be able to distinguish whether we're in a VM/container or something more substantial at a glance. Chassis: laptop 💻 Chassis: tablet 具 Chassis: vm 🖴 Chassis: server 🖳 Chassis: handset 🕻 Chassis: watch ⌚ Chassis: desktop 🖥 Chassis: container ☐
* Change gendered terms to be gender-neutral (#21325)Emily Gonyer2021-11-121-1/+1
| | | Some typos are also fixed.
* hostnamed: use /proc/device-tree to get chassis typeYu Watanabe2021-11-111-1/+1
| | | | | | | | | | | | From https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw --- Userspace must not use the /sys/firmware/devicetree/base path directly, but instead should follow /proc/device-tree symlink. It is possible that the absolute path will change in the future, but the symlink is the stable ABI. --- Addresses the comment https://github.com/systemd/systemd/pull/20731#discussion_r744095262.
* tree-wide: do not print hint about -M if -M is already usedZbigniew Jędrzejewski-Szmek2021-11-041-1/+1
| | | | | | | | (Or when -H is used, since -H and -M are incompatible.) Note that the slightly unusual form with separate boolean variables (hint_vars, hint_addr) instead of e.g. a const char* variable to hold the message, because this way we don't trigger the warning about non-literal format.
* hostnamed: add support for getting the chassis type from device-treeArnaud Ferraris2021-09-151-5/+23
| | | | | | | | | | | | | | Device-tree based devices can't get the chassis type from DMI or ACPI, and so far need a custom `/etc/machine-info` to set this property right. A new 'chassis-type' toplevel device tree property has recently been approved into the DT specification, making it possible to automate chassis type detection on such devices. This patch therefore falls back to reading this device-tree property if nothing is available through both DMI and ACPI. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
* hostname: introduce gethostname_full() and use it in various gethostname() ↵Yu Watanabe2021-08-121-3/+4
| | | | variants
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* hostnamed: correct variable with errno in fallback_chassisJan Palus2021-07-081-4/+4
| | | | | | fixes assertion failure on arm: systemd-hostnamed[642]: Assertion '(_error) != 0' failed at src/hostname/hostnamed.c:207, function fallback_chassis(). Aborting.
* hostnamectl: fix hyperlink in "Operating System" fieldYu Watanabe2021-05-041-9/+2
| | | | | | | | | This fixes a bug introduced by 822be62fb23ed0ec1062ffd18057e53f6c2f8c01. Before this, if terminal width is not enough, the all subsequent lines are included in the hyperlink. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1955475.
* hostnamectl: deprecate set-* methods and expose getters by only using nouns ↵Jakub Warczarek2021-05-031-32/+50
| | | | in commands
* hostnamectl: add --json= switch for JSON outputLennart Poettering2021-04-291-2/+47
| | | | This wraps the new Describe() bus call of hostnamed.
* hostnamed: add Describe() call to hostnamed, returning all props a JSONLennart Poettering2021-04-291-0/+108
|
* hostnamed: drop unused enumsLennart Poettering2021-04-291-3/+2
|
* hostnamed: split out how we determine the hostname a bitLennart Poettering2021-04-291-27/+32
| | | | | No changes in code, just some splitting out of code we want to use elsewhere soon.
* hostnamed: refactor vendor/model querying a bit, reuse functionLennart Poettering2021-04-291-25/+44
|
* hostnamed: use byte array when we need a byte arrayLennart Poettering2021-04-291-1/+1
| | | | it's more corect this way, but shouldn#t change a thing binary-wise