added functionality to delete existing partitions before reinstall
Some checks failed
Build / build (push) Failing after 4m53s

This commit is contained in:
tumillanino
2025-11-12 15:55:15 +11:00
parent adab84e8ff
commit f05bd8b929
575 changed files with 187 additions and 160911 deletions

View File

@@ -7,30 +7,30 @@ import (
)
type InstallConfig struct {
Disk string
EnableLUKS bool
Hostname string
Username string
RootPassword string
UserPassword string
Timezone string
Locale string
Disk string
EnableLUKS bool
Hostname string
Username string
RootPassword string
UserPassword string
Timezone string
Locale string
}
type ArchInstallConfig struct {
Version string `json:"version"`
Script string `json:"script"`
ArchinstallLanguage string `json:"archinstall-language"`
Bootloader string `json:"bootloader"`
Kernels []string `json:"kernels"`
Hostname string `json:"hostname"`
Timezone string `json:"timezone"`
LocaleConfig LocaleConfig `json:"locale_config"`
DiskConfig DiskConfig `json:"disk_config"`
ProfileConfig ProfileConfig `json:"profile_config"`
AuthConfig AuthConfig `json:"auth_config"`
Packages []string `json:"packages"`
Services []string `json:"services"`
Version string `json:"version"`
Script string `json:"script"`
ArchinstallLanguage string `json:"archinstall-language"`
Bootloader string `json:"bootloader"`
Kernels []string `json:"kernels"`
Hostname string `json:"hostname"`
Timezone string `json:"timezone"`
LocaleConfig LocaleConfig `json:"locale_config"`
DiskConfig DiskConfig `json:"disk_config"`
ProfileConfig ProfileConfig `json:"profile_config"`
AuthConfig AuthConfig `json:"auth_config"`
Packages []string `json:"packages"`
Services []string `json:"services"`
}
type LocaleConfig struct {
@@ -40,14 +40,14 @@ type LocaleConfig struct {
}
type DiskConfig struct {
ConfigType string `json:"config_type"`
ConfigType string `json:"config_type"`
DeviceModifications []DeviceModification `json:"device_modifications"`
}
type DeviceModification struct {
Device string `json:"device"`
Partitions []Partition `json:"partitions"`
Wipe bool `json:"wipe"`
Device string `json:"device"`
Partitions []Partition `json:"partitions"`
Wipe bool `json:"wipe"`
}
type Partition struct {
@@ -125,33 +125,34 @@ func (c *InstallConfig) ToArchInstall() *ArchInstallConfig {
"linux-hardened",
"linux-firmware",
"btrfs-progs",
// Text editors
"neovim",
// Shell
"zsh",
// Terminal
"alacritty",
// System tools
"tmux",
"git",
"networkmanager",
// Security tools
"opendoas",
"firejail",
"apparmor",
"nftables", // Using nftables instead of ufw as requested
"hardened-malloc",
// Browsers
"chromium", // Using regular chromium instead of ungoogled-chromium as requested
// Wayland support
"xwayland-satellite",
// Cosmic Desktop
"cosmic-session",
"cosmic-greeter",
@@ -219,24 +220,24 @@ func (c *InstallConfig) SaveArchInstallConfig(filepath string) error {
return fmt.Errorf("failed to marshal config: %w", err)
}
return os.WriteFile(filepath, data, 0o644)
return os.WriteFile(filepath, data, 0644)
}
func (c *InstallConfig) SaveUserCredentials(filepath string) error {
// For credentials, we only save the sensitive information
creds := map[string]interface{}{}
if c.EnableLUKS && c.RootPassword != "" {
creds["encryption_password"] = c.RootPassword
}
creds["users"] = []map[string]string{
{
"username": c.Username,
"password": c.UserPassword,
},
}
if c.RootPassword != "" {
creds["root_enc_password"] = c.RootPassword
}
@@ -246,5 +247,5 @@ func (c *InstallConfig) SaveUserCredentials(filepath string) error {
return fmt.Errorf("failed to marshal credentials: %w", err)
}
return os.WriteFile(filepath, data, 0o600)
return os.WriteFile(filepath, data, 0600)
}