@@ -46,11 +46,11 @@ int main(int argc, char **argv) { /* * Remount root filesystem read-write */ - mount("/dev/vda2", "/", "ext2", MS_REMOUNT, NULL); + mount("/dev/vda2", "/", "ext4", MS_REMOUNT, NULL); /* * Mount needed filesystems */ mkdir("/dev", 0755); @@ -69,10 +69,11 @@ * Setup networking */ run("/bin/init-networking", "init-networking", NULL); run("/bin/init-fuse", "init-fuse", NULL); + mkdir("/etc", 0755); mkdir("/bin", 0755); mkdir("/lib", 0755); mkdir("/opt", 0755); mkdir("/opt/appfs", 0755); mkdir("/var", 0755); @@ -80,10 +81,12 @@ mkdir("/var/cache/appfs", 0755); run("/bin/appfsd", "appfsd", "/var/cache/appfs", "/opt/appfs", NULL); symlink(".", "/usr"); symlink("lib", "/lib64"); + + symlink("/proc/self/mounts", "/etc/mtab"); 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"); @@ -93,7 +96,18 @@ run("/bin/appfs-cache", "appfs-cache", "install", "core.appfs.rkeene.org", "coreutils", NULL); setenv("PATH", "/bin", 1); run("/bin/sh", "sh", NULL); + /* + * Remount root filesystem read-only + */ + umount("/dev"); + umount("/tmp"); + umount("/proc"); + umount("/sys"); + umount("/opt/appfs"); + mount("/dev/vda2", "/", "ext4", MS_REMOUNT | MS_RDONLY, NULL); + sync(); + return(0); }