diff options
| author | K900 <me@0upti.me> | 2023-01-19 11:02:49 +0300 |
|---|---|---|
| committer | K900 <me@0upti.me> | 2023-01-19 11:10:51 +0300 |
| commit | e2c7082c64ef93a668ccb3cdb56a3eefb2b8dfcb (patch) | |
| tree | 152127234b55f74dde1b3582742f5a0a5d296bfc /scripts | |
| parent | 217178edb1127fb41ac4fd534d8a513c3dd3d81b (diff) | |
fix: fix compatibility with latest WSL update
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/native-systemd-shim/src/main.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/native-systemd-shim/src/main.rs b/scripts/native-systemd-shim/src/main.rs index 1cfc90c..504335c 100644 --- a/scripts/native-systemd-shim/src/main.rs +++ b/scripts/native-systemd-shim/src/main.rs @@ -4,13 +4,13 @@ use nix::mount::{mount, MsFlags}; use nix::sys::wait::{waitid, Id, WaitPidFlag}; use nix::unistd::Pid; use std::env; -use std::fs::{create_dir_all, remove_dir_all, remove_file, OpenOptions}; +use std::fs::{create_dir_all, metadata, remove_dir_all, remove_file, OpenOptions}; use std::os::unix::io::{FromRawFd, IntoRawFd}; use std::os::unix::process::CommandExt; use std::path::Path; use std::process::{Command, Stdio}; -fn real_main() -> anyhow::Result<()> { +fn unscrew_dev_shm() -> anyhow::Result<()> { log::trace!("Unscrewing /dev/shm..."); let dev_shm = Path::new("/dev/shm"); @@ -39,6 +39,19 @@ fn real_main() -> anyhow::Result<()> { ) .context("When bind mounting /run/shm to /dev/shm")?; + Ok(()) +} + +fn real_main() -> anyhow::Result<()> { + if metadata("/dev/shm") + .context("When checking /dev/shm")? + .is_symlink() + { + unscrew_dev_shm()?; + } else { + log::trace!("/dev/shm is not a symlink, leaving as-is..."); + }; + log::trace!("Remounting / shared..."); mount( |
