Monorepo for Aesthetic.Computer aesthetic.computer
at main 43 lines 1.4 kB view raw
1#!/usr/bin/env fish 2# Enable Windows interop for calling PowerShell from WSL2 3 4echo "🪟 Setting up Windows interop..." 5 6# Check if running in WSL2 7if not test -d /run/WSL 8 echo "⚠️ Not running in WSL2, skipping Windows interop setup" 9 exit 0 10end 11 12# Enable binfmt_misc if not already enabled 13if not test -f /proc/sys/fs/binfmt_misc/WSLInterop 14 echo " Enabling WSL interop in binfmt_misc..." 15 sudo sh -c 'echo :WSLInterop:M::MZ::/init:PF > /proc/sys/fs/binfmt_misc/register 2>/dev/null' || true 16end 17 18# Create symlinks for Windows executables if they exist 19set windows_bins powershell.exe cmd.exe wsl.exe wslpath 20 21for bin in $windows_bins 22 if test -f /mnt/c/Windows/System32/$bin 23 and not test -f /usr/local/bin/$bin 24 echo " Linking $bin..." 25 sudo ln -sf /mnt/c/Windows/System32/$bin /usr/local/bin/$bin 26 end 27end 28 29# Create symlink for PowerShell 7+ if available 30if test -f "/mnt/c/Program Files/PowerShell/7/pwsh.exe" 31 and not test -f /usr/local/bin/pwsh.exe 32 echo " Linking pwsh.exe (PowerShell 7+)..." 33 sudo ln -sf "/mnt/c/Program Files/PowerShell/7/pwsh.exe" /usr/local/bin/pwsh.exe 34end 35 36# Test if it works 37if type -q powershell.exe 38 echo "✅ Windows interop enabled!" 39 echo " You can now run: powershell.exe, cmd.exe, etc." 40else 41 echo "⚠️ Windows interop setup complete but PowerShell not found" 42 echo " Make sure /mnt/c is properly mounted" 43end