-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·38 lines (33 loc) · 1.11 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# shell profile
if [[ "$(uname)" == 'Windows_NT' ]]; then
cp "Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1" \
"$HOME/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1"
cp .wslconfig "$HOME/.wslconfig"
else
if [[ "$SHELL" =~ 'bash' ]]; then
cp .profile "$HOME/.bashrc"
elif [[ "$SHELL" =~ 'zsh' ]]; then
cp .profile "$HOME/.zshrc"
fi
fi
# gitconfig && gitexcludes
cat .gitconfig | sed 's/\#/\@/g' > "$HOME/.gitconfig"
cp .gitexcludes "$HOME/.gitexcludes"
# configs
cp -rf .config "$HOME/"
# symbolic link for neovim on Windows
if [[ "$(uname)" == 'Windows_NT' && ! -h "$HOME/AppData/Local/nvim" ]]; then
ln -s "$HOME/.config/nvim" "$HOME/AppData/Local/nvim"
fi
# wsl setup
if [[ "$(uname)" == 'Linux' ]]; then
if [[ $(grep -i Microsoft /proc/version) ]]; then
/mnt/c/Windows/System32/where.exe /Q git-credential-manager
if [[ $? == 0 ]]; then
gcm_win_path=$(/mnt/c/Windows/System32/where.exe git-credential-manager)
gcm_path=$(echo $gcm_win_path | sed 's|\\|/|g; s|C:|/mnt/c|' | sed 's/ /\\ /g')
git config --global credential.helper "$gcm_path"
fi
fi
fi