-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_minimum.sh
executable file
·131 lines (115 loc) · 5.47 KB
/
install_minimum.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
#!/bin/bash
################################################################################
# Packages & Directories {{{1
################################################################################
declare -A dotfiles_packages
dotfiles_packages["vim"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["latex"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["bash"]=${HOME}
dotfiles_packages["bash_support"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["common_aliases"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["git"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["readline"]=${XDG_CONFIG_HOME:-${HOME}/.config}
dotfiles_packages["ipython"]=${XDG_CONFIG_HOME:-${HOME}/.config}/ipython/profile_default
dotfiles_packages["urlview"]=${HOME}
dotfiles_packages["ssh"]=${HOME}/.ssh
dotfiles_packages["wget"]=${XDG_CONFIG_HOME:-${HOME}/.config}
# 1}}}
################################################################################
################################################################################
# Create Package Directories {{{1
################################################################################
mkdir -p "${XDG_CONFIG_HOME:-${HOME}/.config}/ipython/profile_default"
# 1}}}
################################################################################
################################################################################
# Backup Dotfiles {{{1
################################################################################
dotfiles_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
dotfiles_backup_dir="${dotfiles_dir}.bak"
# Create backup directory to store the old dotfiles
echo "Create backup directory ${dotfiles_backup_dir}"
mkdir -p ${dotfiles_backup_dir}
echo "The following files will be backup-ed:"
for package in ${!dotfiles_packages[@]}; do
for file in $(ls -1A ${dotfiles_dir}/packages/${package}); do
full_file_name="${dotfiles_packages[$package]}/${file}"
if [[ -e "$full_file_name" ]]; then
echo "${full_file_name} -> ${dotfiles_backup_dir}/${file}"
mv ${full_file_name} ${dotfiles_backup_dir}/${file}
fi
done
done
# 1}}}
################################################################################
################################################################################
# Gitconfig {{{1
################################################################################
cat "${dotfiles_dir}/.gitconfiglocal" >> "${dotfiles_dir}/.git/config"
# 1}}}
################################################################################
################################################################################
# GNU Stow {{{1
################################################################################
echo "Install GNU Stow"
if type "stow" > /dev/null; then
echo "GNU Stow is already installed"
else
sudo apt-get update && sudo apt-get install -y stow
fi
echo "Symlink dotfiles using GNU Stow:"
cd "${dotfiles_dir}/packages"
for package in ${!dotfiles_packages[@]}; do
stow --verbose --restow --target=${dotfiles_packages[$package]} --ignore=.md ${package}
done
# 1}}}
################################################################################
################################################################################
# Nerd Fonts {{{1
################################################################################
# Download Desired Nerd Fonts
echo "Download Nerd Fonts"
fonts_dir="${XDG_DATA_HOME:-${HOME}/.local/share}/fonts"
mkdir -p "${fonts_dir}"
fonts_version="2.1.0"
fonts_repo="https://github.com/ryanoasis/nerd-fonts/raw/${fonts_version}/patched-fonts/"
curl -fLo "${fonts_dir}/Fira Code Medium Nerd Font Complete.otf" \
"${fonts_repo}/FiraCode/Medium/complete/Fira%20Code%20Medium%20Nerd%20Font%20Complete.otf"
curl -fLo "${fonts_dir}/Fira Code Bold Nerd Font Complete.otf" \
"${fonts_repo}/FiraCode/Bold/complete/Fira%20Code%20Bold%20Nerd%20Font%20Complete.otf"
echo "Done!"
# 1}}}
################################################################################
###############################################################################
Vim Plugins {{{1
###############################################################################
# Clone Vundle first
VIM_CONFIG_HOME="${dotfiles_dir}/vim/.vim"
git clone https://github.com/VundleVim/Vundle.vim.git ${VIM_CONFIG_HOME}/bundle/Vundle.vim
# Install all plugins
vim +PluginInstall +qall
# Compile YouCompleteMe
if [ -e ${VIM_CONFIG_HOME}/bundle/YouCompleteMe/install.py ]; then
echo "Compiling YouCompleteMe!"
${VIM_CONFIG_HOME}/bundle/YouCompleteMe/install.py
fi
mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/vim"
1}}}
###############################################################################
################################################################################
# Create Directories {{{1
################################################################################
# Less History
mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/less"
# 1}}}
################################################################################
################################################################################
# Diff-so-fancy {{{1
################################################################################
mkdir -p ${HOME}/.local
git clone git@github.com:so-fancy/diff-so-fancy.git ${HOME}/.local/diff-so-fancy
# 1}}}
################################################################################
unset dotfiles_packages
echo "Installation completed successfully!"
# vim:foldmethod=marker:foldlevel=0:foldenable