diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-06 17:26:25 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-06 17:29:57 +0200 |
commit | fd64b84bcc931c4ba432f33d275566abec1132f7 (patch) | |
tree | 4c27f91215cf01b8d9a770cb94c2fa74956732a8 /src/utils/postinstall.py | |
parent | e9ee1b1c9f4caf7ad3fc203856f8084642aa3281 (diff) |
postinstall: linux does not allow more than 64 bytes long hostnames
As per:
$ getconf HOST_NAME_MAX
64
truncate it to the maximum.
Diffstat (limited to 'src/utils/postinstall.py')
-rw-r--r-- | src/utils/postinstall.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/postinstall.py b/src/utils/postinstall.py index f52ca77..a043ae8 100644 --- a/src/utils/postinstall.py +++ b/src/utils/postinstall.py @@ -69,6 +69,10 @@ def set_windows_hostname(disk, partition, name): def set_linux_hostname(disk, partition, name): logging.info(f'Setting Linux hostname to {name}') + if len(name) > 64: + logging.warning(f'Linux does not permit hostnames that exceed 64 characters. Truncating {name}') + name = name[0:64] + device = get_partition_device(disk, partition) mountpoint = device.replace('dev', 'mnt') |