-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·175 lines (143 loc) · 4.68 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env bash
set -xueo pipefail
_HERE=$(
cd $(dirname $0)
pwd
)
_ME=$(whoami)
source ${_HERE}/vcs.bash
_HUB_VER="2.14.2"
_GO_VER="1.22.6"
if [[ $(uname -s) == "Darwin" ]]; then
if ! brew list --formula | grep wget; then
brew install wget
fi
if [[ -d $HOME/Dropbox\ \(Persona\)/fonts/ ]]; then
cp $HOME/Dropbox\ \(Personal\)/fonts/Hack-v*/* $HOME/Library/Fonts/
fi
if [[ -d ~/external_src/prelude ]]; then
cd ~/external_src/prelude
git clean -fdx
git checkout init.el
git pull
else
mkdir -p ~/external_src/prelude
git clone https://github.com/bbatsov/prelude ~/external_src/prelude
fi
rm -rf ~/.emacs.d
ln -sf ~/external_src/prelude ~/.emacs.d
if ! brew list --formula | grep hub; then
brew install hub
fi
if ! brew list --formula | grep gnu-sed; then
brew install gnu-sed
fi
gsed -i '1s/^/(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")\n/' ~/.emacs.d/init.el
mkdir -p ~/.emacs.d/personal
cp ~/external_src/prelude/sample/prelude-modules.el ~/.emacs.d/personal/
cat >>~/.emacs.d/personal/prelude-modules.el <<'EOF'
;;(require 'prelude-helm)
;;(require 'prelude-helm-everywhere)
(require 'prelude-company)
(require 'prelude-ido)
(require 'prelude-go)
EOF
ln -sf ~/my_src/dotfiles/prelude/personal.el ~/.emacs.d/personal
mkdir -p ~/.config/karabiner/
cp ~/my_src/dotfiles/karabiner.json ~/.config/karabiner/karabiner.json || true
else
if ! which docker; then
curl -sSL https://get.docker.com/ | sudo sh
fi
sudo apt update
sudo apt -y dist-upgrade
sudo apt -y install autojump silversearcher-ag git emacs-nox vim htop curl wget tmux jq ruby build-essential strace locate tcpdump shellcheck mtr traceroute iftop reptyr zsh whois moreutils
sudo chsh -s /bin/zsh $_ME
sudo apt -y purge unattended-upgrades lxd snapd lxcfs
fi
if [[ $(uname -s) == "Darwin" ]]; then
_BASH_RC=~/.bash_profile
else
_BASH_RC=~/.bashrc
fi
ln -sf ${_HERE}/bashrc ${_BASH_RC}
mkdir -p ~/.gnupg
ln -sf ${_HERE}/gpg.conf ~/.gnupg/
ln -sf ${_HERE}/gpg-agent.conf ~/.gnupg/
git clone https://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh || (cd ~/.oh-my-zsh/ && git pull)
mkdir -p ~/.zsh/completion/ ~/external_src/
if [[ $(uname -s) == "Linux" ]]; then
if [[ $_ME == "root" ]]; then
ln -sf ${_HERE}/zshrc /etc/zsh/zshrc
else
ln -sf ${_HERE}/zshrc ~/.zshrc
fi
else
ln -sf ${_HERE}/zshrc ~/.zshrc
fi
ln -sf ${_HERE}/gitconfig ~/.gitconfig
ln -sf ${_HERE}/npmrc ~/.npmrc
ln -sf ${_HERE}/gitignore_global ~/.gitignore_global
ln -sf ${_HERE}/inputrc ~/.inputrc
ln -sf ${_HERE}/tmux.conf ~/.tmux.conf
mkdir -p ${_HERE}/vim/autoload
if [[ ! -f ${_HERE}/vim/autoload/pathogen.vim ]]; then
cd ${_HERE}/vim/autoload
wget https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
fi
if [[ ! -L ~/.vim ]]; then
ln -s ${_HERE}/vim ~/.vim
fi
ln -sf ${_HERE}/vimrc ~/.vimrc
cd ${_HERE}
git submodule update --init
mkdir -p ~/.vim/after/ftplugin/
echo 'setlocal textwidth=0' >~/.vim/after/ftplugin/gitcommit.vim
cat >~/.gemrc <<EOF
gem: --no-ri --no-rdoc
install: --no-rdoc --no-ri --no-document
EOF
if [[ $(uname -s) == "Darwin" ]]; then
ln -sf ${_HERE}/osx ~/.osx
ln -sf ${_HERE}/hyper.js ~/.hyper.js
fi
install_hub() {
wget "https://github.com/github/hub/releases/download/v${_HUB_VER}/hub-linux-amd64-${_HUB_VER}.tgz"
tar xf "hub-linux-amd64-${_HUB_VER}.tgz"
rm "hub-linux-amd64-${_HUB_VER}.tgz"
sudo mv "hub-linux-amd64-${_HUB_VER}/bin/hub" /usr/local/bin
rm -r "hub-linux-amd64-${_HUB_VER}"
}
if [[ $(uname -s) == "Linux" ]]; then
mkdir -p ~/.irssi
ln -sf ${_HERE}/irssi_config ~/.irssi/config
if ! which hub; then
install_hub
else
_installed_hub_ver=$(hub --version 2>&1 | /bin/grep hub | cut -d" " -f3)
if [[ ${_installed_hub_ver} != ${_HUB_VER} ]]; then
install_hub
fi
fi
if [[ -d $HOME/.go/bin ]]; then
export PATH=$HOME/.go/bin:$PATH
fi
if ! [[ $(go version) =~ go${_GO_VER} ]]; then
cd
curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer
fi
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg &&
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
sudo apt update &&
sudo apt install gh -y
cp /usr/share/zoneinfo/UTC /etc/localtime || true
if pgrep snapd >/dev/null 2>&1; then
sudo systemctl disable snapd
sudo systemctl stop snapd
fi
cd
sudo apt -y install cpanminus
cpanm App::dategrep
fi