Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
35 changes: 14 additions & 21 deletions install_station/create_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -43,33 +43,33 @@ 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")
else:
# 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):
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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