From 066af88bf1366a81c95b1b3d582a109c4b263932 Mon Sep 17 00:00:00 2001 From: shokinn Date: Sat, 24 Sep 2022 13:47:07 +0200 Subject: [PATCH] Add hyper-v route helper script --- config.yaml | 12 ++++++++++++ dotfiles/bin/addhypervroute | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 dotfiles/bin/addhypervroute diff --git a/config.yaml b/config.yaml index 5325065..410e9f5 100644 --- a/config.yaml +++ b/config.yaml @@ -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/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 @@ -128,6 +131,8 @@ profiles: - f_c3check - f_zprofile - f_start_systemd_shell.sh + - f_dotdrop.sh + - f_addhypervroute AINCRAD-wsl: dotfiles: - d_fonts @@ -147,6 +152,8 @@ profiles: - f_c3check - f_zprofile - f_start_systemd_shell.sh + - f_dotdrop.sh + - f_addhypervroute yoetunheimr: dotfiles: - d_bspwm @@ -173,6 +180,8 @@ profiles: - f_c3kdenlive - f_c3mpv - f_c3check + - f_dotdrop.sh + - f_addhypervroute YOETUNHEIMR-wsl: dotfiles: - d_fonts @@ -192,6 +201,8 @@ profiles: - f_c3check - f_zprofile - f_start_systemd_shell.sh + - f_dotdrop.sh + - f_addhypervroute ymir: dotfiles: - f_zshrc @@ -209,6 +220,7 @@ profiles: - f_c3mpv - f_c3check - f_dotdrop.sh + - f_addhypervroute workspace: dotfiles: - d_fonts diff --git a/dotfiles/bin/addhypervroute b/dotfiles/bin/addhypervroute new file mode 100755 index 0000000..fa22722 --- /dev/null +++ b/dotfiles/bin/addhypervroute @@ -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}