Add hyper-v route helper script

This commit is contained in:
Philip Henning 2022-09-24 13:47:07 +02:00
parent bde464034c
commit 066af88bf1
2 changed files with 24 additions and 0 deletions

View file

@ -18,6 +18,9 @@ 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 ]] && 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 [[ ! -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: dotfiles:
f_addhypervroute:
dst: ~/.bin/addhypervroute
src: bin/addhypervroute
d_bspwm: d_bspwm:
dst: ~/.config/bspwm dst: ~/.config/bspwm
src: config/bspwm src: config/bspwm
@ -128,6 +131,8 @@ profiles:
- f_c3check - f_c3check
- f_zprofile - f_zprofile
- f_start_systemd_shell.sh - f_start_systemd_shell.sh
- f_dotdrop.sh
- f_addhypervroute
AINCRAD-wsl: AINCRAD-wsl:
dotfiles: dotfiles:
- d_fonts - d_fonts
@ -147,6 +152,8 @@ profiles:
- f_c3check - f_c3check
- f_zprofile - f_zprofile
- f_start_systemd_shell.sh - f_start_systemd_shell.sh
- f_dotdrop.sh
- f_addhypervroute
yoetunheimr: yoetunheimr:
dotfiles: dotfiles:
- d_bspwm - d_bspwm
@ -173,6 +180,8 @@ profiles:
- f_c3kdenlive - f_c3kdenlive
- f_c3mpv - f_c3mpv
- f_c3check - f_c3check
- f_dotdrop.sh
- f_addhypervroute
YOETUNHEIMR-wsl: YOETUNHEIMR-wsl:
dotfiles: dotfiles:
- d_fonts - d_fonts
@ -192,6 +201,8 @@ profiles:
- f_c3check - f_c3check
- f_zprofile - f_zprofile
- f_start_systemd_shell.sh - f_start_systemd_shell.sh
- f_dotdrop.sh
- f_addhypervroute
ymir: ymir:
dotfiles: dotfiles:
- f_zshrc - f_zshrc
@ -209,6 +220,7 @@ profiles:
- f_c3mpv - f_c3mpv
- f_c3check - f_c3check
- f_dotdrop.sh - f_dotdrop.sh
- f_addhypervroute
workspace: workspace:
dotfiles: dotfiles:
- d_fonts - d_fonts

12
dotfiles/bin/addhypervroute Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# {{@@ header() @@}}
#
HYPER_V_SWITCH_ADDRESS=$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (Default Switch)" -AddressFamily IPv4 | Select -ExpandProperty IPAddress')
HYPER_V_SWITCH_ADDRESS="${HYPER_V_SWITCH_ADDRESS%.*}.0"
HYPER_V_SWITCH_PREFIX_LENGTH=$(echo "$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (Default Switch)" -AddressFamily IPv4 | Select -ExpandProperty PrefixLength')" | tr -d '\r')
WSL_SWITCH_ADDRESS=$( echo "$(powershell.exe 'Get-NetIPAddress -ifAlias "vEthernet (WSL)" -AddressFamily IPv4 | Select -ExpandProperty IPAddress')" | tr -d '\r')
sudo ip r add ${HYPER_V_SWITCH_ADDRESS}/${HYPER_V_SWITCH_PREFIX_LENGTH} via ${WSL_SWITCH_ADDRESS}