Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/initContainer: Avoid RPM failures due to unexpected file owners #640

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/cmd/initContainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,24 @@ func initContainer(cmd *cobra.Command, args []string) error {
}
}

if utils.PathExists("/usr/lib/rpm/macros.d") {
logrus.Debug("Configuring RPM to ignore bind mounts")

var builder strings.Builder
fmt.Fprintf(&builder, "# Written by Toolbox\n")
fmt.Fprintf(&builder, "# https://github.com/containers/toolbox\n")
fmt.Fprintf(&builder, "\n")
fmt.Fprintf(&builder, "%%_netsharedpath /dev:/media:/mnt:/proc:/sys:/tmp:/var/lib/flatpak:/var/lib/libvirt\n")

rpmConfigString := builder.String()
rpmConfigBytes := []byte(rpmConfigString)
if err := ioutil.WriteFile("/usr/lib/rpm/macros.d/macros.toolbox",
rpmConfigBytes,
0644); err != nil {
return fmt.Errorf("failed to configure RPM to ignore bind mounts: %w", err)
}
}

logrus.Debug("Setting up daily ticker")

daily, err := time.ParseDuration("24h")
Expand Down