-
Notifications
You must be signed in to change notification settings - Fork 1
/
install
executable file
·134 lines (107 loc) · 3 KB
/
install
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
set -e
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$HOME/bin
# lnk "file here" "file in home"
lnk(){
FROM=$2
TO=$1
echo "Linking $HOME/$FROM to $PWD/$TO"
ln -snf "$PWD/$TO" "$HOME/$FROM"
}
content(){
FILE=$1
CONTENT=$2
echo "Ensure content in: $FILE"
grep -q "$CONTENT" "$FILE" || ( echo "$CONTENT" >> "$FILE" && echo "content updated in $FILE" )
}
i(){
if ! [ -x "$(command -v pacman)" ]; then
echo "pacman not found. skipping install of " "$@"
return
fi
sudo pacman --noconfirm -S --needed "$@"
}
echo "Git pull"
git pull --autostash
mkdir -p ~/bin
DIST=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
if [[ "$DIST" == *"Ubuntu"* ]]; then
./install-ubuntu
fi
echo "Install arch pacman deps"
i go
i i3lock
i neovim python-pynvim
i noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-bitstream-vera ttf-croscore ttf-dejavu ttf-hack ttf-roboto ttf-hack #fonts
i vint # ale linter for vim config
i extra/php-intl # deps for phpactor
i prettier # json js tsx formatter
i yarn
i ansible-lint
i alacritty
i ripgrep fd
i bash-language-server
i lua-language-server
i rust
echo "Install stuff with cargo"
cargo install cargo-update # update all with cargo install-update -a
cargo install git-delta
cargo install fnm
cargo install --git https://github.com/Icelk/clipcat.git
echo "setting up ssh-agent systemd user service"
mkdir -p "$HOME/.config/systemd/user"
content "$HOME/.config/systemd/user/ssh-agent.service" "$(cat <<-END
[Unit]
Description=SSH key agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -D -a \$SSH_AUTH_SOCK
[Install]
WantedBy=default.target
END
)"
content "$HOME/.config/systemd/user/clipcatd.service" "$(cat <<-END
[Unit]
Description=Starts the clipboard daemon
[Service]
Type=simple
ExecStart=sh -c "PATH=~/.cargo/bin:\$PATH clipcatd --no-daemon"
Restart=on-failure
[Install]
WantedBy=default.target
END
)"
systemctl enable --user --now ssh-agent
systemctl enable --user --now clipcatd
echo "Setting up bashrc"
git config --global credential.helper 'cache --timeout 3600'
content ~/.bashrc ". $PWD/bashrc"
if [ ! -f ~/bin/kube-ps1.sh ]; then
echo "Install kube-ps1"
curl -s -o ~/bin/kube-ps1.sh https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh
fi
mkdir -p ~/.vim/bundle
if [ ! -d ~/.fzf ]; then
git clone https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
fi
lnk "jshintrc" ".jshintrc"
lnk "lockFuzzy" "bin/lockFuzzy"
lnk "phpmd-ruleset.xml" ".phpmd-ruleset.xml"
lnk "dir_colors" ".dir_colors"
lnk "nvim" ".config/nvim"
lnk "alacritty" ".config/alacritty"
lnk "i3exit" "bin/i3exit"
lnk "clipcat" ".config/clipcat"
echo "Installing plugins into vim"
nvim +PlugInstall +qall
#must be after PlugInstall since we want newer golangci-lint than :GoInstallBinaries provide
if [ ! -f ~/go/bin/golangci-lint ]; then
echo "Install golangci-lint"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)"/bin
fi
./common
echo "done"