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