diff --git a/README.md b/README.md index a2539e8..67e751d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Install Station === -It is a strip down version of install-station and it is the new installer for GhostBSD. +Install Station is the streamlined installer for GhostBSD. -Install Station only edit disk, partition and will install GhostBSD. Users and system setup will be done with at the first boot after installation with Setup Station. +Install Station handles disk editing, partitioning, and OS installation. User configuration and system setup are performed at first boot after installation with Setup Station. ## Managing Translations To create a translation file. diff --git a/install_station/create_cfg.py b/install_station/create_cfg.py index 3472ffd..71391ac 100644 --- a/install_station/create_cfg.py +++ b/install_station/create_cfg.py @@ -27,13 +27,13 @@ def sanity_check(cls): list_of_errors: List of error messages describing validation failures """ errors = [] - + # Check basic installation data if not hasattr(InstallationData, 'boot') or not InstallationData.boot: errors.append("Boot manager not specified") elif InstallationData.boot not in ['refind', 'grub', 'none']: errors.append(f"Invalid boot manager: {InstallationData.boot}") - + # Check ZFS configuration path if InstallationData.zfs_config_data: if not isinstance(InstallationData.zfs_config_data, list): @@ -43,7 +43,7 @@ def sanity_check(cls): has_partscheme = any('partscheme' in str(line) for line in InstallationData.zfs_config_data) if not has_partscheme: errors.append("ZFS config missing partition scheme") - + has_disk = any('disk0=' in str(line) for line in InstallationData.zfs_config_data) if not has_disk: errors.append("ZFS config missing disk specification") @@ -51,25 +51,25 @@ def sanity_check(cls): # Check custom partition configuration path if not hasattr(InstallationData, 'disk') or not InstallationData.disk: errors.append("Disk not specified for custom partitioning") - + if not hasattr(InstallationData, 'slice') or not InstallationData.slice: errors.append("Partition slice not specified") - + if not hasattr(InstallationData, 'scheme') or not InstallationData.scheme: errors.append("Partition scheme not specified") elif InstallationData.scheme not in ['partscheme=GPT', 'partscheme=MBR']: errors.append(f"Invalid partition scheme: {InstallationData.scheme}") - + if not hasattr(InstallationData, 'new_partition') or not InstallationData.new_partition: errors.append("No partitions defined for custom partitioning") elif not isinstance(InstallationData.new_partition, list): errors.append("Partition data is not a list") - + # Check installation config file path if not installation_config: errors.append("Installation config file path not defined") - - return len(errors) == 0, errors + + return not errors, errors @classmethod def create_cfg(cls): @@ -96,7 +96,7 @@ def create_cfg(cls): if not is_valid: error_msg = "Configuration validation failed:\n" + "\n".join(f"- {error}" for error in errors) raise ValueError(error_msg) - + try: with open(installation_config, 'w') as f: # Installation Mode @@ -106,7 +106,7 @@ def create_cfg(cls): f.write('installType=GhostBSD\n') f.write('installMedium=livezfs\n') f.write('packageType=livezfs\n') - + if InstallationData.zfs_config_data: # ZFS Configuration Path for line in InstallationData.zfs_config_data: @@ -142,26 +142,19 @@ def create_cfg(cls): # Partition Setup f.write('\n# Partition Setup\n') for line in InstallationData.new_partition: - if 'BOOT' in line or 'BIOS' in line or 'UEFI' in line: - pass - else: + if 'BOOT' not in line and 'BIOS' not in line and 'UEFI' not in line: f.write(f'disk0-part={line.strip()}\n') f.write('commitDiskLabel\n') # Network Configuration f.write('\n# Network Configuration\n') f.write('hostname=installed\n') - + # First Boot Preparation Commands f.write('\n# command to prepare first boot\n') f.write("runCommand=sysrc hostname='installed'\n") f.write("runCommand=pw userdel -n ghostbsd -r\n") f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/gettytab\n") f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/ttys\n") - f.write("runCommand=mv /usr/local/etc/devd/automount_devd" - ".conf.skip /usr/local/etc/devd/automount_devd.conf\n") - f.write("runCommand=mv /usr/local/etc/devd/automount_devd" - "_localdisks.conf.skip /usr/local/etc/devd/" - "automount_devd_localdisks.conf\n") except IOError as e: - raise IOError(f"Failed to write configuration file: {e}") + raise IOError(f"Failed to write configuration file: {e}") from e