(src_runtime: &Path, paths: &PglitePaths)
| 1931 | } |
| 1932 | |
| 1933 | fn prepare_shared_runtime_upper_root(src_runtime: &Path, paths: &PglitePaths) -> Result<()> { |
| 1934 | let _phase = timing::phase("runtime.mountfs_upper_root"); |
| 1935 | let dest_runtime = paths.runtime_root(); |
| 1936 | |
| 1937 | { |
| 1938 | let _phase = timing::phase("runtime.mountfs_upper_dirs"); |
| 1939 | for path in [ |
| 1940 | dest_runtime.to_path_buf(), |
| 1941 | dest_runtime.join("home"), |
| 1942 | dest_runtime.join("dev"), |
| 1943 | ] { |
| 1944 | fs::create_dir_all(&path).with_context(|| format!("create {}", path.display()))?; |
| 1945 | } |
| 1946 | } |
| 1947 | |
| 1948 | { |
| 1949 | let _phase = timing::phase("runtime.mountfs_upper_reset"); |
| 1950 | reset_dir(&dest_runtime.join("tmp"))?; |
| 1951 | reset_dir(&dest_runtime.join("dev/shm"))?; |
| 1952 | } |
| 1953 | |
| 1954 | { |
| 1955 | let _phase = timing::phase("runtime.mountfs_upper_identity"); |
| 1956 | copy_runtime_file_if_exists(src_runtime.join("password"), dest_runtime.join("password"))?; |
| 1957 | } |
| 1958 | |
| 1959 | fs::write(dest_runtime.join(MOUNTFS_RUNTIME_MARKER), b"mountfs\n").with_context(|| { |
| 1960 | format!( |
| 1961 | "write {}", |
| 1962 | dest_runtime.join(MOUNTFS_RUNTIME_MARKER).display() |
| 1963 | ) |
| 1964 | })?; |
| 1965 | write_runtime_layout_manifest( |
| 1966 | &dest_runtime, |
| 1967 | RuntimeLayoutKind::SharedRuntimeOverlay, |
| 1968 | &runtime_cache_key()?, |
| 1969 | )?; |
| 1970 | Ok(()) |
| 1971 | } |
| 1972 | |
| 1973 | fn reset_dir(path: &Path) -> Result<()> { |
| 1974 | if path.exists() { |
no test coverage detected