Skip to content

Commit

Permalink
Initial support for rootlesskit to replace fakeroot
Browse files Browse the repository at this point in the history
Less overhead and less stupid fucking bugs.
  • Loading branch information
joebonrichie committed May 28, 2024
1 parent c5da1d1 commit 9812abe
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (p *Package) BuildYpkg(notif PidNotifier, usr *UserInfo, pman *EopkgManager
ymlFile := filepath.Join(wdir, filepath.Base(p.Path))

// Now build the package
cmd := fmt.Sprintf("/bin/su %s -- fakeroot ypkg-build -D %s %s", BuildUser, wdir, ymlFile)
cmd := fmt.Sprintf("/bin/su %s -- rootlesskit ypkg-build -D %s %s", BuildUser, wdir, ymlFile)
if DisableColors {
cmd += " -n"
}
Expand Down
1 change: 1 addition & 0 deletions builder/eopkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (e *EopkgManager) Upgrade() error {
"abi-wizard",
"iproute2",
"sccache",
"rootlesskit",
}

if err := ChrootExec(e.notif, e.root, eopkgCommand("eopkg upgrade -y")); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions builder/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ func AddBuildUser(rootfs string) error {
return fmt.Errorf("Failed to add build user to system, reason: %w\n", err)
}

if err := commands.AddUserSubUserRange(rootfs, BuildUser, 100000, 65536); err != nil {
return fmt.Errorf("Failed to write /etc/subuid file, reason: %w\n", err)
}

if err := commands.AddUserSubGroupRange(rootfs, BuildUser, 100000, 65536); err != nil {
return fmt.Errorf("Failed to write /etc/subgid file, reason: %w\n", err)
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/cavaliergopher/grab/v3 v3.0.1
github.com/cheggaaa/pb/v3 v3.1.5
github.com/coreos/go-systemd/v22 v22.5.0
github.com/getsolus/libosdev v0.0.0-20181023041421-9ab0f4b463fd
github.com/getsolus/libosdev v0.0.0-20240528220548-d3601e826637
github.com/go-git/go-billy/v5 v5.5.0
github.com/go-git/go-git/v5 v5.12.0
gitlab.com/slxh/go/powerline v0.1.0
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/getsolus/libosdev v0.0.0-20181023041421-9ab0f4b463fd h1:QZoSqUIKIFeqhImxNk1cdY7M4n8JVZxTzuhP+Y0DaK8=
github.com/getsolus/libosdev v0.0.0-20181023041421-9ab0f4b463fd/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/getsolus/libosdev v0.0.0-20240528214822-149f538ed58e h1:JrNEMklhvmy4K2h4/BQRwBHus8hOlufn/qH9BJi2V94=
github.com/getsolus/libosdev v0.0.0-20240528214822-149f538ed58e/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/getsolus/libosdev v0.0.0-20240528215907-24e15ca78130 h1:g0h6vYDvuSrKPGRn5JT2dCnfYnJfE4MYNrG3CJWKNcE=
github.com/getsolus/libosdev v0.0.0-20240528215907-24e15ca78130/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/getsolus/libosdev v0.0.0-20240528220039-4fcbaac5230a h1:nuFqvm/ULwyboMbjJ9g1W5Oa4MJZx8CM0jglVtVi7FQ=
github.com/getsolus/libosdev v0.0.0-20240528220039-4fcbaac5230a/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/getsolus/libosdev v0.0.0-20240528220436-ab5b63433a1e h1:/eYKDYO0GAgqcCY3llivHcjXf0Sa22YNGy0N/B56YAE=
github.com/getsolus/libosdev v0.0.0-20240528220436-ab5b63433a1e/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/getsolus/libosdev v0.0.0-20240528220548-d3601e826637 h1:suWW+9urtrRHInhn6dRNFEFtmrKrDXh1GbyHGYLMrKU=
github.com/getsolus/libosdev v0.0.0-20240528220548-d3601e826637/go.mod h1:8P4U+IYO8T6nRPLlC6qv1wMFcc0vK0vMVDCuyiFTTLg=
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
Expand Down

0 comments on commit 9812abe

Please sign in to comment.