mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-18 00:48:10 +01:00
build: better way to handle libexec.
This commit is contained in:
parent
c53049293b
commit
fdc5839dd9
1 changed files with 8 additions and 8 deletions
|
@ -108,20 +108,17 @@ func Merge() error {
|
||||||
func Configure() error {
|
func Configure() error {
|
||||||
switch Distribution {
|
switch Distribution {
|
||||||
case "arch":
|
case "arch":
|
||||||
aa.Tunables["libexec"] = []string{"/{usr/,}lib"}
|
if err := setLibexec("/{usr/,}lib"); err != nil {
|
||||||
if err := setLibexec(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case "opensuse":
|
case "opensuse":
|
||||||
aa.Tunables["libexec"] = []string{"/{usr/,}libexec"}
|
if err := setLibexec("/{usr/,}libexec"); err != nil {
|
||||||
if err := setLibexec(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case "debian", "ubuntu", "whonix":
|
case "debian", "ubuntu", "whonix":
|
||||||
aa.Tunables["libexec"] = []string{"/{usr/,}libexec"}
|
if err := setLibexec("/{usr/,}libexec"); err != nil {
|
||||||
if err := setLibexec(); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,16 +159,19 @@ func Configure() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setLibexec() error {
|
func setLibexec(libexec string) error {
|
||||||
|
aa.Tunables["libexec"] = []string{libexec}
|
||||||
file, err := RootApparmord.Join("tunables", "multiarch.d", "apparmor.d").Append()
|
file, err := RootApparmord.Join("tunables", "multiarch.d", "apparmor.d").Append()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
_, err = file.WriteString(`@{libexec}=` + aa.Tunables["libexec"][0])
|
_, err = file.WriteString(`@{libexec}=` + libexec)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Set flags on some profiles according to manifest defined in `dists/flags/`
|
// Set flags on some profiles according to manifest defined in `dists/flags/`
|
||||||
func SetFlags() error {
|
func SetFlags() error {
|
||||||
for _, name := range []string{"main.flags", Distribution + ".flags"} {
|
for _, name := range []string{"main.flags", Distribution + ".flags"} {
|
||||||
|
|
Loading…
Reference in a new issue