diff --git a/config.yaml b/config.yaml index 410e9f5..7a721f2 100644 --- a/config.yaml +++ b/config.yaml @@ -18,9 +18,6 @@ actions: [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes ]] && mkdir -p ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes || echo "do nothing" >/dev/null [[ ! -d ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel10k ]] && git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${{ZSH_CUSTOM:-${{HOME}}/.oh-my-zsh/custom}}/themes/powerlevel10k || echo "do nothing" >/dev/null dotfiles: - f_addhypervroute: - dst: ~/.bin/addhypervroute - src: bin/addhypervroute d_bspwm: dst: ~/.config/bspwm src: config/bspwm @@ -111,6 +108,12 @@ dotfiles: f_kite: src: local/bin/kite dst: ~/.local/bin/kite + f_addhypervroute: + dst: ~/.bin/addhypervroute + src: bin/addhypervroute + f_enablewslhypervforwarding: + dst: ~/.bin/enablewslhypervforwarding + src: bin/enablewslhypervforwarding profiles: AINCRAD: dotfiles: @@ -133,6 +136,7 @@ profiles: - f_start_systemd_shell.sh - f_dotdrop.sh - f_addhypervroute + - f_enablewslhypervforwarding AINCRAD-wsl: dotfiles: - d_fonts @@ -154,6 +158,7 @@ profiles: - f_start_systemd_shell.sh - f_dotdrop.sh - f_addhypervroute + - f_enablewslhypervforwarding yoetunheimr: dotfiles: - d_bspwm @@ -182,6 +187,7 @@ profiles: - f_c3check - f_dotdrop.sh - f_addhypervroute + - f_enablewslhypervforwarding YOETUNHEIMR-wsl: dotfiles: - d_fonts @@ -203,6 +209,7 @@ profiles: - f_start_systemd_shell.sh - f_dotdrop.sh - f_addhypervroute + - f_enablewslhypervforwarding ymir: dotfiles: - f_zshrc @@ -221,6 +228,7 @@ profiles: - f_c3check - f_dotdrop.sh - f_addhypervroute + - f_enablewslhypervforwarding workspace: dotfiles: - d_fonts diff --git a/dotfiles/bin/enablewslhypervforwarding b/dotfiles/bin/enablewslhypervforwarding new file mode 100755 index 0000000..0f86b5a --- /dev/null +++ b/dotfiles/bin/enablewslhypervforwarding @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# +# {{@@ header() @@}} +# + +WINHOME="$(echo "$(cmd.exe /C "echo %USERPROFILE%")" | tr -d '\r')" +WINHOMEWSL="$(wslpath ${WINHOME})" + +cat < "${WINHOMEWSL}/enablewslhypervforwarding.ps1" +#at top of script +if (! + #current role + (New-Object Security.Principal.WindowsPrincipal( + [Security.Principal.WindowsIdentity]::GetCurrent() + #is admin? + )).IsInRole( + [Security.Principal.WindowsBuiltInRole]::Administrator + ) +) { + #elevate script and exit current non-elevated runtime + Start-Process \` + -FilePath 'powershell' \` + -ArgumentList ( + #flatten to single array + '-File', \$MyInvocation.MyCommand.Source, \$args \` + | %{ \$_ } + ) \` + -Verb RunAs + exit +} + +Set-NetIPInterface -ifAlias "vEthernet (Default Switch)" -Forwarding Enabled +Set-NetIPInterface -ifAlias "vEthernet (WSL)" -Forwarding Enabled + +EOF + +powershell.exe "${WINHOME}\enablewslhypervforwarding.ps1" +powershell.exe "Get-NetIPInterface | select ifIndex,InterfaceAlias,AddressFamily,ConnectionState,Forwarding | Sort-Object -Property IfIndex | Format-Table" + + +rm ${WINHOMEWSL}/enablewslhypervforwarding.ps1