-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathas_user_install.sh
executable file
·91 lines (74 loc) · 2.31 KB
/
as_user_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
#!/bin/bash
if [[ "$USE_DEBUG" == "1" ]]; then
set -x
fi
if [[ `id -u` == 0 ]]; then
echo Error: Run as NON-ROOT user
exit 1
fi
if [[ "$USER" == root ]]; then
echo Error: Run as NON-ROOT user
exit 1
fi
# Exit when some error happened
set -e
# Determine OS
if [[ "$(uname)" = Darwin ]]; then
OS='Mac'
echo Installing for MacOS
elif [[ "$(expr substr $(uname -s) 1 5)" = Linux ]]; then
OS='Linux'
echo Installing for Linux
else
OS=''
fi
# Link gitconfig
# ln -nfs $PWD/shell/gitconfig $HOME/.gitconfig
touch $HOME/.gitconfig
grep -q "Custom preference" $HOME/.gitconfig || cat shell/gitconfig >> $HOME/.gitconfig
# Install tmux and zsh settigns
mkdir -p $HOME/.config/tmux
ln -nfs $PWD/tmux/tmux.conf $HOME/.config/tmux/tmux.conf
ln -nfs $PWD/shell/zshrc $HOME/.zshrc
# Configure nvim
mkdir -p $HOME/.config/nvim
ln -nfs $PWD/nvim/init.lua $HOME/.config/nvim/init.lua
ln -nfs $PWD/nvim/lua $HOME/.config/nvim/lua
nvim --headless "+Lazy! sync" +qa | true
# Install fzf if it is not exist
if [ ! -d "$HOME/.fzf" ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf
yes | $HOME/.fzf/install
fi
# Place zsh setup it not yet
if [ ! -f "$HOME/.fzf.zsh" ]; then
yes | zsh -c "$HOME/.fzf/install"
fi
# Install powerlevel10k
if [[ $OS = Mac ]]; then
ln -nfs $PWD/shell/p10k_mac.zsh $HOME/.p10k.zsh
elif [[ $OS = Linux ]]; then
ln -nfs $PWD/shell/p10k_ubuntu.zsh $HOME/.p10k.zsh
fi
if [[ ! -d "$HOME/powerlevel10k" ]]; then
echo "powerlevel10k have not been initialized. Installing..."
git clone --depth 1 https://github.com/romkatv/powerlevel10k.git $HOME/powerlevel10k
export XDG_CACHE_HOME=$HOME/.cache/p10k
$HOME/powerlevel10k/gitstatus/install
echo "powerlevel10k installation complete."
fi
# Install tqm (tmux plugin manager)
if [[ ! -e $HOME/.tmux ]];then
mkdir -p $HOME/.tmux/plugins
git clone https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm
fi
# Install pyenv
if [[ ! -d "$HOME/.pyenv" ]]
then
git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv
fi
export PIP_BREAK_SYSTEM_PACKAGES=1
PIP_INSTALL_CMD="pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org"
python3 -m $PIP_INSTALL_CMD --upgrade pip
python3 -m $PIP_INSTALL_CMD setuptools
python3 -m $PIP_INSTALL_CMD neovim