Add %l as specifier for the hostname without any domain component
As described in #15603, it is a fairly common setup to use a fqdn as the configured hostname. But it is often convenient to use just the actual hostname, i.e. until the first dot. This adds support in tmpfiles, sysusers, and unit files for %l which expands to that. Fixes #15603.
This commit is contained in:
@@ -160,6 +160,17 @@ int specifier_host_name(char specifier, const void *data, const void *userdata,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int specifier_short_host_name(char specifier, const void *data, const void *userdata, char **ret) {
|
||||
char *n;
|
||||
|
||||
n = gethostname_short_malloc();
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
|
||||
*ret = n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int specifier_kernel_release(char specifier, const void *data, const void *userdata, char **ret) {
|
||||
struct utsname uts;
|
||||
char *n;
|
||||
|
||||
Reference in New Issue
Block a user