[users] Document new template setting for hostname

This commit is contained in:
Adriaan de Groot 2022-04-11 14:26:29 +02:00
parent b95eb55994
commit 9ca6d3c715
3 changed files with 26 additions and 2 deletions

View File

@ -23,6 +23,11 @@ This release contains contributions from (alphabetically by first name):
- *users* module has a new hostname.location setting, *Transient*, which - *users* module has a new hostname.location setting, *Transient*, which
will force the installed system to transient-hostname-setting by removing will force the installed system to transient-hostname-setting by removing
the file `/etc/hostname`. the file `/etc/hostname`.
- *users* module has a new hostname.template setting, which allows some
tweaking of how the hostname suggestion is constructed. In particular,
it can be configured to use the current hostname (whatever that may be).
See the example `users.conf` for details on available keys.
# 3.2.54 (2022-03-21) # # 3.2.54 (2022-03-21) #

View File

@ -156,7 +156,7 @@ userShell: /bin/bash
# a default / suggestion) and where (or how) the hostname is set in # a default / suggestion) and where (or how) the hostname is set in
# the target system. # the target system.
# #
# Key *hostname* has the following sub-keys (just one): # Key *hostname* has the following sub-keys:
# #
# - *location* How the hostname is set in the target system: # - *location* How the hostname is set in the target system:
# - *None*, to not set the hostname at all # - *None*, to not set the hostname at all
@ -164,14 +164,32 @@ userShell: /bin/bash
# - *Etc*, identical to above # - *Etc*, identical to above
# - *Hostnamed*, to use systemd hostnamed(1) over DBus # - *Hostnamed*, to use systemd hostnamed(1) over DBus
# - *Transient*, to remove `/etc/hostname` from the target # - *Transient*, to remove `/etc/hostname` from the target
# The default is *EtcFile*. Setting this to *None* will # The default is *EtcFile*. Setting this to *None* or *Transient* will
# hide the hostname field. # hide the hostname field.
# - *writeHostsFile* Should /etc/hosts be written with a hostname for # - *writeHostsFile* Should /etc/hosts be written with a hostname for
# this machine (also adds localhost and some ipv6 standard entries). # this machine (also adds localhost and some ipv6 standard entries).
# Defaults to *true*. # Defaults to *true*.
# - *template* Is a simple template for making a suggestion for the
# hostname, based on user data. The default is "${first}-${product}".
# This is used only if the hostname field is shown. KMacroExpander is
# used; write `${key}` where `key` is one of the following:
# - *first* User's first name (whatever is first in the User Name field,
# which is first-in-order but not necessarily a "first name" as in
# "given name" or "name by which you call someone"; beware of western bias)
# - *name* All the text in the User Name field.
# - *login* The login name (which may be suggested based on User Name)
# - *product* The hardware product, based on DMI data
# - *product2* The product as described by Qt
# - *cpu* CPU name
# - *host* Current hostname (which may be a transient hostname)
# Literal text in the template is preserved. Calamares tries to map
# `${key}` values to something that will fit in a hostname, but does not
# apply the same to literal text in the template. Do not use invalid
# characters in the literal text, or no suggeston will be done.
hostname: hostname:
location: EtcFile location: EtcFile
writeHostsFile: true writeHostsFile: true
template: "derp-${cpu}"
# TODO:3.3: Remove this setting # TODO:3.3: Remove this setting
# #

View File

@ -46,6 +46,7 @@ properties:
properties: properties:
location: { type: string, enum: [ None, EtcFile, Hostnamed, Transient ] } location: { type: string, enum: [ None, EtcFile, Hostnamed, Transient ] }
writeHostsFile: { type: boolean, default: true } writeHostsFile: { type: boolean, default: true }
template: { type: string, default: "${first}-${product}" }
# Legacy Hostname setting # Legacy Hostname setting
setHostname: { type: string, enum: [ None, EtcFile, Hostnamed ] } setHostname: { type: string, enum: [ None, EtcFile, Hostnamed ] }
writeHostsFile: { type: boolean, default: true } writeHostsFile: { type: boolean, default: true }