Skip to content

Commit

Permalink
Try creating 'Temp' dir for wine
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst committed Aug 5, 2024
1 parent 746adb2 commit 17c1f7f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/coreapp/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Dict, List, Optional, Union
import getpass

from django.conf import settings

Expand Down Expand Up @@ -46,17 +47,23 @@ def sandbox_command(self, mounts: List[Path], env: Dict[str, str]) -> List[str]:
return []

settings.SANDBOX_CHROOT_PATH.mkdir(parents=True, exist_ok=True)
settings.WINEPREFIX.mkdir(parents=True, exist_ok=True)

assert ":" not in str(self.path)
assert ":" not in str(settings.WINEPREFIX)

wine_temp_dir = (
settings.WINEPREFIX / "drive_c" / "users" / getpass.getuser() / "Temp"
)
wine_temp_dir.mkdir(parents=True, exist_ok=True)

# fmt: off
wrapper = [
str(settings.SANDBOX_NSJAIL_BIN_PATH),
"--mode", "o",
"--chroot", str(settings.SANDBOX_CHROOT_PATH),
"--bindmount", f"{self.path}:/tmp",
"--bindmount", f"{self.path}:/run/user/{os.getuid()}",
"--bindmount", f"{self.path}:{wine_temp_dir}",
"--bindmount_ro", "/dev",
"--bindmount_ro", "/bin",
"--bindmount_ro", "/etc/alternatives",
Expand Down

0 comments on commit 17c1f7f

Please sign in to comment.