-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·113 lines (95 loc) · 3.28 KB
/
deploy.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
set -e
if [ "$1" = "--install" ]; then
# identify package manager, upgrade and install OS specific packages
if hash pacman 2>/dev/null; then
# Arch linux
pacman -Syu --noconfirm --needed sudo || true
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm --needed base-devel zsh-completions git
# Yay
if ! hash yay 2>/dev/null; then ./bin/aur-install yay-bin --noconfirm --needed; fi
# Direnv
if ! hash direnv 2>/dev/null; then ./bin/aur-install direnv --noconfirm --needed; fi
pacman_bin="pacman -S --noconfirm --needed"
pynvim_pkg="python-pynvim"
elif hash dnf 2>/dev/null; then
# Fedora
dnf -y install sudo || true
sudo dnf -y upgrade
sudo dnf -y group install 'Development Tools'
sudo dnf -y install util-linux-user direnv
pacman_bin="dnf -y install"
pynvim_pkg="python3-neovim"
elif hash apt-get 2>/dev/null; then
# Debian/Ubuntu
export DEBIAN_FRONTEND=noninteractive
apt-get -y update || true
apt-get -y install sudo || true
sudo -E apt-get -y update
sudo -E apt-get -y upgrade
sudo -E apt-get -y install build-essential libpam-systemd direnv
pacman_bin="DEBIAN_FRONTEND=noninteractive apt-get -y install"
pynvim_pkg="python3-neovim"
else
pacman_bin=/bin/false
fi
# install basic packages
sudo $pacman_bin git neovim ${pynvim_pkg} zsh tmux htop zip unzip mc xsel curl trash-cli fzf ripgrep
fi
# get submodules
git submodule init
git submodule update --recursive
# copy neovim config
mkdir -vp ~/.config/nvim
ln -srfv _vimrc ~/.config/nvim/init.vim
# install vim-plug to neovim
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# copy vim config
ln -srfv _vimrc ~/.vimrc
# install vim-plug to vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# copy ideavim config
ln -srfv _vimrc ~/.ideavimrc
# copy terminator config
mkdir -vp ~/.config/terminator
ln -srfv _terminator_config ~/.config/terminator/config
# install oh-my-zsh
ln -srfTv oh-my-zsh ~/.oh-my-zsh
# install oh-my-zsh custom folder
ln -srfTv oh-my-zsh-custom ~/.oh-my-zsh-custom
# install powerlevel10k for zsh
ln -srfv _p10k.zsh ~/.p10k.zsh
# set zsh as the default shell
current_shell=$(expr "${SHELL:=/bin/false}" : '.*/\(.*\)')
if [ "$current_shell" != "zsh" ]; then
zsh_shell="$(grep /zsh$ /etc/shells | tail -1)"
echo "Changing default shell to ${zsh_shell}"
chsh -s "${zsh_shell}"
fi
# copy zsh config
ln -srfv _zshrc ~/.zshrc
ln -srfv _zprofile ~/.zprofile
ln -srfv _zshenv ~/.zshenv
# copy tmux config
ln -srfv _tmux.conf ~/.tmux.conf
# copy clang-format
ln -srfv _clang-format ~/.clang-format
# copy environment
mkdir -vp ~/.config/environment.d/
ln -srfv ssh-agent-env.conf ~/.config/environment.d/ssh-agent.conf
# copy binaries
mkdir -vp ~/bin
ln -srfv bin/* ~/bin/
# copy ssh config
mkdir -vp ~/.ssh
ln -srfv _ssh_config ~/.ssh/config
# copy ssh-key agent (if not in docker)
if [ ! -f /.dockerenv ]; then
mkdir -vp ~/.config/systemd/user
ln -srfv systemd-templates/ssh-agent.service ~/.config/systemd/user
systemctl --user enable ssh-agent.service
systemctl --user start ssh-agent.service
fi