Skip to content

Commit

Permalink
build: Might as well try building as "root"
Browse files Browse the repository at this point in the history
Keeping in mind that rootlesskit runs as the host 'solbuild' user, this
seems as good as anything; do note that this means that there will be
host permission issues that probably need fixing.

This commit is for @joebonrichie to work off of

Signed-off-by: Rune Morling <[email protected]>
  • Loading branch information
ermo committed Aug 29, 2024
1 parent 55ee9ff commit 28a5940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (p *Package) BuildYpkg(notif PidNotifier, usr *UserInfo, pman *EopkgManager
}

// need to properly quote the innner -c 'command' syntax
suCmd := fmt.Sprintf("strace /bin/su %s --command='%s'", BuildUser, buildCmd)
//suCmd := fmt.Sprintf("strace /bin/su %s --command='%s'", BuildUser, buildCmd)

Check failure on line 341 in builder/build.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)

if p.CanCCache {
// Start an sccache server to work around #87
Expand All @@ -352,9 +352,9 @@ func (p *Package) BuildYpkg(notif PidNotifier, usr *UserInfo, pman *EopkgManager
}

slog.Info("Now starting build", "package", p.Name)
slog.Info("Build", "command", suCmd)
slog.Info("Build", "command", buildCmd)

if err := RootlesskitExec(notif, overlay.MountPoint, suCmd); err != nil {
if err := RootlesskitExec(notif, overlay.MountPoint, buildCmd); err != nil {
return fmt.Errorf("Failed to start build of package, reason: %w\n", err)
}

Expand Down
3 changes: 2 additions & 1 deletion builder/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ func ChrootExec(notif PidNotifier, dir, command string) error {
// using the 'solbuild' user (expected to exist a priori and have /etc/sub{g,u}id files),
// such that we can store the PID for long running tasks.
func RootlesskitExec(notif PidNotifier, dir, command string) error {
rootlesskitCmd := fmt.Sprintf("-c rootlesskit chroot %s %s", dir, command)
rootlesskitCmd := fmt.Sprintf(
"-c rootlesskit --copy-up=/var/cache/eopkg/archives chroot %s %s", dir, command)
args := []string{"solbuild", rootlesskitCmd}
c := exec.Command("/bin/su", args...)
c.Stdout = os.Stdout
Expand Down

0 comments on commit 28a5940

Please sign in to comment.