Skip to content

Commit 63beb15

Browse files
committed
add support for absolute mount
1 parent c9d500a commit 63beb15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main.zig

+7-3
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ fn processArgs(file: std.fs.File, parentAllocator: std.mem.Allocator) !void {
118118
try mount.put("options", std.json.Value{ .array = options });
119119

120120
const separator = std.mem.indexOfScalar(u8, volume_syntax, ':') orelse @panic("no volume destination specified");
121-
122-
try mount.put("source", std.json.Value{ .string = volume_syntax[0..separator] });
121+
122+
if (volume_syntax[0] == '/') {
123+
try mount.put("source", std.json.Value{ .string = volume_syntax[0..separator] });
124+
} else {
125+
try mount.put("source", std.json.Value{ .string = try std.fs.cwd().realpathAlloc(allocator, volume_syntax[0..separator])} );
126+
}
123127
try mount.put("destination", std.json.Value{ .string = volume_syntax[separator + 1..] });
124128

125129
try mounts_json.append(std.json.Value{ .object = mount });
@@ -174,7 +178,7 @@ pub fn main() !void {
174178
var mountProcess = std.ChildProcess.init(&args_buf, allocator);
175179
_ = try mountProcess.spawnAndWait();
176180

177-
const overlayfs_options = try std.fmt.allocPrint(allocator, "lowerdir={s},upperdir={s}/upper,workdir={s}/upper", .{
181+
const overlayfs_options = try std.fmt.allocPrint(allocator, "lowerdir={s},upperdir={s}/upper,workdir={s}/work", .{
178182
filesystem_bundle_dir_null,
179183
temp_dir_path,
180184
temp_dir_path,

0 commit comments

Comments
 (0)