summaryrefslogtreecommitdiffstats
path: root/src/utils/postinstall.py
Commit message (Collapse)AuthorAgeFilesLines
* utils: replace the legacy function ogConfigureFstabAlejandro Sirgo Rica2024-08-301-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement configure_fstab() as a replacement of ogConfigureFstab. Create src/utils/fstab.py to implement the main fstab configuration functions. Define two fstab helper classes, FstabBuilder and FstabEntry. FstabEntry Represents each line in the fstab file. Has the values: device, mountpoint, fstype, options, dump_code and pass_code. FstabBuilder Contains a list of FstabEntry. Handles loading of a preexisting fstab file and the serialization of multiple FstabEntry into a file. The fstab configuration has 3 main steps: Root partition: - Update the device field with the device where the new system is installed. Swap partition: - Preserve all the swapfile entries in every case. - If the filesystem has a swap partition: update the device field in the first fstab swap entry and remove the rest swap entries pointing to a swap partition. Only one swap partition is supported. Create a new fstab entry if no preexisting swap entry exists. - If the system has no swap partition remove every swap partition entry. EFI partition: - Update the device field of the EFI fstab entry if it exists. Create a new fstab entry if no preexisting EFI entry exists. Add get_filesystem_id to disk.py to obtain the UUID. Define every device field as a UUID. That method is more robust than a plain device path as it works after disks being added or removed.
* postinstall: ignore legacy scripts non-zero return codeOpenGnSys Support Team2024-08-301-54/+47
| | | | | legacy scripts are not reliable, legacy scripts continue processing on errors, warn on errors until they are converted to native code instead.
* postinstall: remove shell=TrueAlejandro Sirgo Rica2024-08-091-4/+5
| | | | Remove the use of shell=True.
* postinstall: ignore output when invoking legacy scriptsOpenGnSys Support Team2024-08-081-6/+12
| | | | output is never consumed.
* postinstall: add logging to report this stageOpenGnSys Support Team2024-08-081-0/+2
| | | | log that image restoration has entered OS configuration stage.
* live: move filesystem expansion out of OS configurationOpenGnSys Support Team2024-08-061-2/+0
| | | | just a clean up.
* postinstall: add logging to report postconfiguration script invocationOpenGnSys Support Team2024-08-061-0/+2
|
* postinstall: typo in maximum win hostname errorOpenGnSys Support Team2024-08-061-1/+1
| | | | s/nor/not
* postinstall: linux does not allow more than 64 bytes long hostnamesOpenGnSys Support Team2024-08-061-0/+4
| | | | | | | | | As per: $ getconf HOST_NAME_MAX 64 truncate it to the maximum.
* utils: postinstall: show hostname in logsOpenGnSys Support Team2024-07-301-4/+4
| | | | Display the hostname that is set in the logs.
* utils: add set_linux_hostnameAlejandro Sirgo Rica2024-07-291-0/+22
| | | | | Add set_linux_hostname function to redefine the hostname of a Linux install by overwriting the contents of /etc/hostname
* utils: add set_windows_hostnameAlejandro Sirgo Rica2024-07-291-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Add function to redefine the hostname of a Windows install. Windows hostnames can't be larger than 15 characters due to legacy heritage. Hostname modification is done by modifying 3 registry values in the ControlSetXXX entry of the SYSTEM hive. ControlSet001 is generally the entry to be edited but one must query the value of the 'Current' key in the 'Select' entry of the SYSTEM hive to retrieve the active ControlSet. The hostname has to be introduced in the following entries: path = 'ControlSetXX/Control/ComputerName/ComputerName' key = 'ComputerName' path = 'ControlSetXXX/Services/Tcpip/Parameters' key = 'HostName' key = 'NV Hostname' The value to store in those keys is of tipe SZ and has to be encoded in UCS-2 Little Endian (utf-16-le).
* utils: add postinstall.pyAlejandro Sirgo Rica2024-07-291-0/+170
Replace ConfigureOs script by native calls to: - update BCD via hivex using bcd.py and winreg.py infrastructure. - restore efi bootloader restore_windows_efi_bootloader(). Call legacy scripts for remaining postinstall procedures to replace them incrementally. Define variable CONFIGUREOS_LEGACY_ENABLED as False by default. Run legacy configureOs when CONFIGUREOS_LEGACY_ENABLED = True. This serves as a auxiliar method to keep the restoration functional in case of problems with the new configure_os logic.