-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·99 lines (76 loc) · 3.05 KB
/
install.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
set -e
SCRIPT_HOME="$(dirname $0)"
echo "For current user ${USERNAME}"
echo "Setting up IDE..."
if command -v code &>/dev/null; then
while IFS= read -r extension || [ -n "$extension" ]; do
code --install-extension "$extension"
done < "$SCRIPT_HOME/vscode/extensions"
code --install-extension alireza94.theme-gotham
code --install-extension PKief.material-icon-theme
fi
if [ $(uname) = Darwin ]; then
echo "(mac)"
VSCODE_SETTINGS_DIR=$HOME/Library/Application\ Support/Code/User
mkdir -p "$VSCODE_SETTINGS_DIR" && cp -f $SCRIPT_HOME/vscode/settings.json "$VSCODE_SETTINGS_DIR"/settings.json
elif [ $(uname) = Linux ]; then
if [ -n "$WSL_DISTRO_NAME" ]; then
echo "(wsl)"
WINDOWS_HOME=$(wslpath $(powershell.exe '$env:UserProfile') | sed -e 's/\r//g')
VSCODE_SETTINGS_DIR=$WINDOWS_HOME/AppData/Roaming/Code/User
mkdir -p $VSCODE_SETTINGS_DIR && cp -f $SCRIPT_HOME/vscode/settings.json $VSCODE_SETTINGS_DIR/settings.json
# https://github.com/microsoft/vscode/issues/1022
# https://github.com/microsoft/vscode/issues/166680
elif [ -n "$CODESPACES" ]; then
echo "(github codespaces)"
else
echo "(native linux)"
VSCODE_SETTINGS_DIR=$HOME/.config/Code/User
mkdir -p $VSCODE_SETTINGS_DIR && cp -f $SCRIPT_HOME/vscode/settings.json $VSCODE_SETTINGS_DIR/settings.json
fi
fi
echo "Setting up terminal emulator..."
if [ $(uname) = Darwin ]; then
echo "(mac)"
# Terminal
curl -L https://raw.githubusercontent.com/whatyouhide/gotham-contrib/master/terminal.app/Gotham.terminal --create-dirs -o $HOME/.local/share/themes/"Gotham.terminal"
# ~/Library/Preferences/com.apple.Terminal.plist
# iTerm2
curl -L https://raw.githubusercontent.com/whatyouhide/gotham-contrib/master/iterm2/Gotham.itermcolors --create-dirs -o $HOME/.local/share/themes/"Gotham.itermcolors"
# ~/Library/Application Support/iTerm2/DynamicProfiles
elif [ $(uname) = Linux ]; then
if [ -n "$WSL_DISTRO_NAME" ]; then
echo "(wsl)"
WINDOWS_HOME=$(wslpath $(powershell.exe '$env:UserProfile') | sed -e 's/\r//g')
# Windows Terminal
# ${WINDOWS_HOME}/AppData/Local/Packages/Microsoft.WindowsTerminal*/LocalState/settings.json
elif [ -n "$CODESPACES" ]; then
echo "(github codespaces)"
else
echo "(native linux)"
fi
fi
echo "Setting up initial files & permissions..."
configs=(
.gitconfig
.vimrc
.zshrc
)
for config in "${configs[@]}"; do
cp $SCRIPT_HOME/$config $HOME/
done;
if [ -n "$WINDOWS_HOME" ]; then
ln -sf $HOME $WINDOWS_HOME/$HOME
fi
if [ -z "$CODESPACES" ] && [ -d "$HOME/.ssh/" ]; then
find $HOME/.ssh/ -type f -exec chmod 600 {} \;
find $HOME/.ssh/ -type d -exec chmod 700 {} \;
find $HOME/.ssh/ -type f -name "*.pub" -exec chmod 644 {} \;
fi
#gh auth login -h 'github.com' -p 'ssh' --skip-ssh-key -w
mkdir -p "$HOME/Source" && curl -sfSL "https://gist.githubusercontent.com/ridhwaans/08f2fc5e9b3614a3154cef749a43a568/raw/scripts.sh" -o "$HOME/Source/scripts.sh" && chmod +x "$HOME/Source/scripts.sh"
# Moving to end because it lapses trailing code
echo "Installing vim plugins..."
vim +silent! +PlugInstall +PlugClean +qall
exit $?