47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
+
+
+
+
-
+
|
if (access("/dev/fuse", F_OK) != 0) {
fprintf(stderr, "This container needs to be run as: docker run --cap-add SYS_ADMIN --device /dev/fuse ...\n");
return(1);
}
mkdir("/bin", 0755);
mkdir("/lib", 0755);
mkdir("/opt", 0755);
mkdir("/opt/appfs", 0755);
mkdir("/var", 0755);
mkdir("/var/cache", 0755);
mkdir("/var/cache/appfs", 0755);
run("/bin/appfsd", "appfsd", "/var/cache/appfs", "/opt/appfs", NULL);
symlink(".", "/usr");
symlink("lib", "/lib64");
symlink("/opt/appfs/core.appfs.rkeene.org/bash/platform/latest/bin/bash", "/bin/bash");
symlink("/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin/env", "/bin/env");
symlink("/bin/bash", "/bin/sh");
setenv("PATH", "/bin:/opt/appfs/core.appfs.rkeene.org/coreutils/platform/latest/bin", 1);
run("/bin/appfs-cache", "appfs-cache", "install", "-lib", "core.appfs.rkeene.org", "glibc", NULL);
run("/bin/appfs-install-pkg", "appfs-install-pkg", "core.appfs.rkeene.org", "coreutils", NULL);
run("/bin/appfs-cache", "appfs-cache", "install", "core.appfs.rkeene.org", "coreutils", NULL);
setenv("PATH", "/bin", 1);
if (argc == 1) {
run("/bin/sh", "sh", NULL);
} else {
argv++;
execvp(argv[0], argv);
|