-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathinstall.sh
executable file
·127 lines (112 loc) · 3.97 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
#!/bin/bash
set -euo pipefail
function create-link {
local -r SRC=$1
local -r DEST=$2
mkdir -p "$(dirname "$DEST")"
if ! [ -L "$DEST" ]; then
ln -ivs "$SRC" "$DEST"
else
echo "Skipping, link already exists: $DEST"
fi
}
function install-from-git-repo {
local -r name="$1"
local -r repo="$2"
local -r dest="$3"
echo "Installing $name..."
if [ -d "$dest" ]; then
(cd "$dest" && git pull --progress)
else
rm -rf "$dest"
git clone --progress "$repo" "$dest"
fi
}
function create-links {
echo "Creating links..."
# directories
create-link "$PWD/bin" "$HOME/bin"
create-link "$PWD/vim" "$HOME/.vim"
create-link "$PWD/zsh" "$HOME/.zsh"
# files
create-link "$PWD/bashrc" "$HOME/.bashrc"
create-link "$PWD/gitconfig" "$HOME/.gitconfig"
create-link "$PWD/gitignore" "$HOME/.gitignore"
create-link "$PWD/imwheelrc" "$HOME/.imwheelrc"
create-link "$PWD/libinput-gestures.conf" "$HOME/.config/libinput-gestures.conf"
create-link "$PWD/npmrc" "$HOME/.npmrc"
create-link "$PWD/profile" "$HOME/.profile"
create-link "$PWD/pythonstartup" "$HOME/.pythonstartup"
create-link "$PWD/ripgreprc" "$HOME/.ripgreprc"
create-link "$PWD/safe-rm" "$HOME/.safe-rm"
create-link "$PWD/terminator.conf" "$HOME/.config/terminator/config"
create-link "$PWD/vimrc" "$HOME/.vimrc"
create-link "$PWD/zshenv" "$HOME/.zshenv"
create-link "$PWD/zshrc" "$HOME/.zshrc"
for file in $PWD/desktop-shortcuts/*
do
create-link "$file" "$HOME/.local/share/applications/$(basename "$file")"
done
}
function install-vim-plugins {
echo "Installing Vim plugins..."
vim +PluginInstall +qall
}
function install-dircolors {
echo "Installing dircolors..."
curl -sl "https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-dark" > ~/.dircolors
}
function install-asdf-plugins {
echo "Installing Direnv through asdf..."
source $HOME/.asdf/asdf.sh
asdf plugin add direnv || true
asdf plugin add golang || true
asdf plugin add nodejs || true
asdf plugin add python || true
asdf plugin add ruby || true
asdf install direnv 2.32.1
asdf global direnv 2.32.1
asdf global python system
}
function install-homebrew {
echo "Installing Home Brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
}
function install-homebrew-apps {
echo "Installing Home Brew apps..."
brew install bat
brew install eza # exa is unmaintained
brew install fd
brew install fzf
brew install httpie
brew install jump
brew install ripgrep
brew install starship
}
function install-terminator-editor-plugin {
echo "Installing Terminator Editor plugin..."
mkdir -p ~/.config/terminator/plugins
curl -sl "https://raw.githubusercontent.com/mchelem/terminator-editor-plugin/master/editor_plugin.py" > ~/.config/terminator/plugins/editor_plugin.py
}
function copy-sysctl-conf {
echo "Copying sysctl config files..."
for file in $PWD/sysctl.d/*
do
sudo cp "$file" "/etc/sysctl.d/$(basename "$file")"
done
}
function install-all {
create-links
install-from-git-repo "Zgen" "https://github.com/tarjoilija/zgen" "$HOME/.zgen"
install-from-git-repo "Bash-Sensible" "https://github.com/mrzool/bash-sensible" "$HOME/.bash-sensible"
install-from-git-repo "Vim Vundle" "https://github.com/VundleVim/Vundle.vim" "$HOME/.vundle"
install-from-git-repo "Asdf-vm" "https://github.com/asdf-vm/asdf" "$HOME/.asdf"
install-vim-plugins
install-dircolors
install-asdf-plugins
install-homebrew
install-homebrew-apps
install-terminator-editor-plugin
copy-sysctl-conf
}
install-all