Skip to content

Commit c1a8309

Browse files
committed
feat: Add flexible pacman config path
1 parent d61beeb commit c1a8309

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

alteriso/src/internal/archiso/profile_gen.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log/slog"
66
"os"
77
"path"
8+
"path/filepath"
89
"reflect"
910
"runtime"
1011

@@ -15,9 +16,20 @@ import (
1516
cp "github.com/otiai10/copy"
1617
)
1718

18-
func (p *Profile) pacmanConf(outDir string) error {
19+
func (p *Profile) PacmanConf() string {
20+
if p.Config.PacmanConf == "" {
21+
return path.Join(p.Path, "pacman.conf")
22+
}
23+
if filepath.IsAbs(p.Config.PacmanConf) {
24+
return p.Config.PacmanConf
25+
} else {
26+
return path.Join(p.Path, p.Config.PacmanConf)
27+
}
28+
}
29+
30+
func (p *Profile) copyPacmanConf(outDir string) error {
1931
dst := path.Join(outDir, "pacman.conf")
20-
src := path.Join(p.Path, "pacman.conf")
32+
src := p.PacmanConf()
2133
if !futils.Exists(src) {
2234
return errors.Newf("pacman.conf file does not exist in %s", p.Path)
2335
}
@@ -102,7 +114,7 @@ func (p *Profile) GenArchisoProfile(outDir string) error {
102114
p.copyInjecter,
103115
p.copyAirootfs,
104116
p.generatePackagesFile,
105-
p.pacmanConf,
117+
p.copyPacmanConf,
106118
p.generateInfoFile,
107119
}
108120

0 commit comments

Comments
 (0)