Install efi files in uki mode using naming convention

replace "artifact" with "active" in conf files and in filenames

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
This commit is contained in:
Dimitris Karakasilis
2024-02-12 19:20:45 +02:00
parent 75eda111cd
commit d981656715
6 changed files with 115 additions and 93 deletions

View File

@@ -17,11 +17,9 @@ limitations under the License.
package utils
import (
"bufio"
"crypto/sha256"
"errors"
"fmt"
"github.com/kairos-io/kairos-sdk/state"
"io"
random "math/rand"
"net/url"
@@ -32,6 +30,8 @@ import (
"strings"
"time"
"github.com/kairos-io/kairos-sdk/state"
agentConfig "github.com/kairos-io/kairos-agent/v2/pkg/config"
fsutils "github.com/kairos-io/kairos-agent/v2/pkg/utils/fs"
"github.com/kairos-io/kairos-agent/v2/pkg/utils/partitions"
@@ -528,31 +528,3 @@ func UkiBootMode() state.Boot {
}
return state.Unknown
}
// SystemdBootConfReader reads a systemd-boot conf file and returns a map with the key/value pairs
func SystemdBootConfReader(filePath string) (map[string]string, error) {
file, err := os.Open(filePath)
if err != nil {
return nil, err
}
defer file.Close()
result := make(map[string]string)
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
parts := strings.SplitN(line, " ", 2)
if len(parts) == 2 {
result[parts[0]] = parts[1]
}
if len(parts) == 1 {
result[parts[0]] = ""
}
}
if err := scanner.Err(); err != nil {
return nil, err
}
return result, nil
}