utils: postinstall: show hostname in logs

Display the hostname that is set in the logs.
master
OpenGnSys Support Team 2024-07-30 16:37:28 +02:00
parent 1329c0955b
commit 9a553765b4
1 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ CONFIGUREOS_LEGACY_ENABLED = False
def set_windows_hostname(disk, partition, name):
logging.info(f'Configuring hostname')
logging.info(f'Setting Windows hostname to {name}')
if len(name) > 15:
logging.warning(f'Windows does nor permit hostnames that exceed 15 characters. Truncating {name}')
@ -61,13 +61,13 @@ def set_windows_hostname(disk, partition, name):
hive.commit(hive_path)
except Exception as e:
raise OgError(f'Unable to configure Windows hostname: {e}') from e
raise OgError(f'Unable to set Windows hostname: {e}') from e
finally:
umount(mountpoint)
def set_linux_hostname(disk, partition, name):
logging.info(f'Configuring hostname')
logging.info(f'Setting Linux hostname to {name}')
device = get_partition_device(disk, partition)
mountpoint = device.replace('dev', 'mnt')
@ -80,7 +80,7 @@ def set_linux_hostname(disk, partition, name):
with open(hostname_path, 'w') as f:
f.write(name)
except OSError as e:
raise OgError(f'Unable to configure Linux hostname: {e}') from e
raise OgError(f'Unable to set Linux hostname: {e}') from e
finally:
umount(mountpoint)