From a2e641f8677a61a269bcf7dc95f7e89e89f96b7f Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Sun, 9 Apr 2023 03:21:25 +0200 Subject: [PATCH] port more of the bash config --- internal/configs/configs.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/configs/configs.go b/internal/configs/configs.go index 8ab3cbb..a49c3b2 100644 --- a/internal/configs/configs.go +++ b/internal/configs/configs.go @@ -59,6 +59,7 @@ func GetConfig() *Config { func InitConfigs() { config := GetConfig() + // Add all directories we need into a stringlist dirs := []string{ config.path.MODPROBE, config.path.INITRAMFS, @@ -85,6 +86,7 @@ func InitConfigs() { } } + // Add all files we need to a stringlist files := []string{ config.path.ETCMODULES, config.path.MKINITCPIO, @@ -101,7 +103,16 @@ func InitConfigs() { // Create the directories for our configs file, err := os.Create(conffile) errorcheck.ErrorCheck(err) - defer file.Close() + // Close the file so we can edit it + file.Close() + } + + // If we now have a config that exists + if _, err := os.Stat(conffile); !errors.Is(err, os.ErrNotExist) { + header := readHeader(4, sysfile) + writeContent(header, conffile) + addModules(conffile) + } } }