diff options
author | Toby Vincent <tobyv13@gmail.com> | 2021-07-05 10:35:45 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2021-07-05 10:35:45 -0500 |
commit | bef6cd33cf9b5dbaa7ee9393d12f850eb7de68a7 (patch) | |
tree | 67f6d33d31bd4529a5f3695f3a6c0949f76499c9 | |
parent | 188007ec17e0fd2e361f23791b24d0a589cda507 (diff) |
fix: fixed gpg trust import and added error checking
-rwxr-xr-x | wsl.install | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/wsl.install b/wsl.install index 3ebfcaa..6e1b1c3 100755 --- a/wsl.install +++ b/wsl.install @@ -1,21 +1,20 @@ #!/usr/bin/env bash - -DOTFILES="$(dirname "$(readlink -fm "$0")")" +DOTFILES="${DOTFILES:-${BASEDIR:-${HOME}/dotfiles}}" WINHOME="$(wslpath "$(powershell.exe -NoProfile -c \$HOME)")" force=1 function mkln() { - dirname="$(dirname $2)" - filename="$(basename $2)" + dir="$(dirname $2)" + file="$(basename $2)" source=$(wslpath -w $DOTFILES/$1) - target=$(wslpath -w $dirname)\\$filename + target=$(wslpath -w $dir)\\$file cmd="cd ~; cmd /c mklink $target $source" - if ls -la $dirname/ 2>/dev/null | grep -q $filename; then + if ls -la $dir/ 2>/dev/null | grep -q $file; then if [ $force = 1 ]; then cmd="cd ~; rm $target; cmd /c mklink $target $source" else - echo "$filename already exists. Use -f to overwrite." + echo "$file already exists. Use -f to overwrite." return fi fi @@ -50,5 +49,14 @@ 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 -gpg.exe --keyserver hkps://keys.openpgp.org --recv-key 0xC8F6E06F5C8E2634 -gpg.exe --import-ownertrust gnupg/trustfile.txt
\ No newline at end of file +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 |