refractor: move default systemd drop in files.

This commit is contained in:
Alexandre Pujol 2023-11-19 14:20:14 +00:00
parent d1c8471b1d
commit f564347580
Failed to generate hash of commit
11 changed files with 12 additions and 0 deletions

View file

@ -47,6 +47,8 @@ func aaPrebuild() error {
if full { if full {
prebuild.Prepares = append(prebuild.Prepares, prebuild.SetFullSystemPolicy) prebuild.Prepares = append(prebuild.Prepares, prebuild.SetFullSystemPolicy)
} else {
prebuild.Prepares = append(prebuild.Prepares, prebuild.SetDefaultSystemd)
} }
if complain { if complain {
prebuild.Builds = append(prebuild.Builds, prebuild.BuildComplain) prebuild.Builds = append(prebuild.Builds, prebuild.BuildComplain)

View file

@ -173,6 +173,11 @@ func SetFlags() error {
return nil return nil
} }
// Set systemd unit drop in files to ensure some service start after apparmor
func SetDefaultSystemd() error {
return copyTo(paths.New("systemd/default/"), Root.Join("systemd"))
}
// Set AppArmor for (experimental) full system policy. // Set AppArmor for (experimental) full system policy.
// See https://apparmor.pujol.io/development/structure/#full-system-policy // See https://apparmor.pujol.io/development/structure/#full-system-policy
func SetFullSystemPolicy() error { func SetFullSystemPolicy() error {

View file

@ -71,6 +71,9 @@ func copyTo(src *paths.Path, dst *paths.Path) error {
return err return err
} }
destination = dst.JoinPath(destination) destination = dst.JoinPath(destination)
if err := destination.Parent().MkdirAll(); err != nil {
return err
}
if err := file.CopyTo(destination); err != nil { if err := file.CopyTo(destination); err != nil {
return err return err
} }

View file

@ -0,0 +1,2 @@
[Unit]
After=apparmor.service