Skip to content

Commit

Permalink
Fix rootless file ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsIrl committed Aug 14, 2024
1 parent 8558480 commit 598df9f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/dockerc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub fn main() !void {
const offset_arg = try std.fmt.allocPrintZ(allocator, "{}", .{runtime_content.len});
defer allocator.free(offset_arg);

const mksquashfs_args = [_:null]?[*:0]const u8{
var mksquashfs_args = [_:null]?[*:0]const u8{
"mksquashfs",
bundle_destination,
output_path,
Expand All @@ -172,8 +172,17 @@ pub fn main() !void {
"-offset",
offset_arg,
"-noappend",
"-force-uid",
"0",
"-force-gid",
"0",
};

// in rootfull, do not force uid/gid to 0,0
if (res.args.rootfull != 0) {
mksquashfs_args[mksquashfs_args.len - 4] = null;
}

mksquashfs_main(
mksquashfs_args.len,
&mksquashfs_args,
Expand Down

0 comments on commit 598df9f

Please sign in to comment.