#!/usr/bin/env bash DOTFILES="${DOTFILES:-${BASEDIR:-${HOME}/dotfiles}}" # BUG Has issues with a return character? # WINHOME="$(wslpath "$(powershell.exe -NoProfile -c \$HOME)")" WINHOME=$(wslpath "c:\Users\\${USER}") mkln="${DOTFILES}/scripts/mkln.sh -f" function show-warning() { gpgpath=$(wslpath -w "$(command -v gpg.exe)") gitgpg=$(git.exe config --system --get gpg.program) if [ "$gitgpg" = "$gpgpath" ]; then return fi printf "\n" printf "In order to use gpg with git for windows \n" printf "(and still share gitconfigs), you need to run\n" printf "the following command from an admin terminal:\n" printf "\n" printf "git.exe config --system gpg.program '%s' \n" "$(wslpath -w "$(command -v gpg.exe)")" printf "\n" } sed -r 's|(RemoteForward\s+.+\s+)\/home\/tobyv\/\.gnupg\/S\.gpg-agent\.extra|\1127.0.0.1:4444|' ${DOTFILES}/ssh/config >${DOTFILES}/ssh/win.config ln -sf $WINHOME ~/win cd $DOTFILES $mkln ssh/win.config ~/win/.ssh/config $mkln gitconfig ~/win/.gitconfig $mkln gnupg/gpg.conf ~/win/AppData/Roaming/gnupg/gpg.conf $mkln gnupg/gpg-agent.conf ~/win/AppData/Roaming/gnupg/gpg-agent.conf $mkln gnupg/scdaemon.conf ~/win/AppData/Roaming/gnupg/scdaemon.conf $mkln wt.json ~/win/AppData/Local/Packages/Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe/LocalState/settings.json $mkln winget.json ~/win/AppData/Local/Packages/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/LocalState/settings.json if gpg.exe --keyserver hkps://keys.openpgp.org --recv-key 0xC8F6E06F5C8E2634 &>/dev/null; then echo "gpg key imported" else echo "Failed to import gpg key" fi if gpg.exe --import-ownertrust $DOTFILES/gnupg/trustfile.txt; then echo "gpg trust imported" else echo "Failed to import gpg trust" fi