-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·150 lines (120 loc) · 5.85 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
#!/usr/bin/env bash
# This ensures that the entire script is downloaded before execution
{
if ! which git >>/dev/null ; then
echo "Error: git is not installed"
exit 1
fi
# Exit the script if any errors are encountered
#set -e
# Change this url to point to your repo if you made customizations
GIT_REPO="https://c0de.dev/c0de/dotfiles.git"
DOTFILES=${HOME}/dotfiles
DF_HOME=${DOTFILES}/home
DF_CONFIG=${DF_HOME}/.config
POSTINSTALL_SCRIPT=${HOME}/.dotfiles.postinst
if [ ! -e "${POSTINSTALL_SCRIPT}" ]; then
echo "No post install script found."
echo "Optionally create one at ${POSTINSTALL_SCRIPT} and rerun this script"
fi
# Attempts to safely install the configs as symlinks (backing up existing ones)
function symlink() {
src=$1
dest=$2
if [ -e "${dest}" ]; then
if [ -L "${dest}" ]; then
# Already symlinked -- I'll assume correctly.
return
else
# Rename files with a ".old" extension.
echo "${dest} already exists, renaming to ${dest}.old"
backup="${dest}.old"
if [ -e "${backup}" ]; then
echo "Error: $backup already exists. Please delete or rename it."
exit 1
fi
mv -v "${dest}" "${backup}"
fi
fi
echo "Linking $(basename "${src}")..."
ln -sf "${src}" "${dest}"
}
read -p "Press enter to install dotfiles " WAIT_FOR_INPUT
# If the update script exists, try to do a normal update
if [ -x "${DOTFILES}/check_for_upgrade.sh" ]; then
source "${DF_HOME}/.environment"
env _DOTFILES="${DOTFILES}" DISABLE_UPDATE_PROMPT=false zsh -f "${DOTFILES}/check_for_upgrade.sh"
else
echo "Cloning to ${DOTFILES}"
rm -rf "${DOTFILES}"
git clone --recurse-submodules -j$(nproc) "${GIT_REPO}" "${DOTFILES}"
fi
echo "Installing user binary directory to ~/bin"
symlink "${DF_HOME}/bin" "${HOME}/bin"
echo "Creating needed directories"
mkdir -p "${HOME}/.tmux"
mkdir -p "${HOME}/.vim/{autoload,bundle}"
mkdir -p "${HOME}/dev"
echo "Linking Configuration files..."
# All the dotfiles that live in the home dir directly
symlink "${DOTFILES}/.editorconfig" "${HOME}/.editorconfig"
symlink "${DF_HOME}/.aliases" "${HOME}/.aliases"
symlink "${DF_HOME}/.bashrc" "${HOME}/.bashrc"
symlink "${DF_HOME}/.dmrc" "${HOME}/.dmrc"
symlink "${DF_HOME}/.environment" "${HOME}/.environment"
symlink "${DF_HOME}/.functions" "${HOME}/.functions"
symlink "${DF_HOME}/.gitconfig" "${HOME}/.gitconfig"
symlink "${DF_HOME}/.gtkrc.mine" "${HOME}/.gtkrc.mine"
symlink "${DF_HOME}/.gtkrc-2.0" "${HOME}/.gtkrc-2.0"
symlink "${DF_HOME}/.tmux.conf" "${HOME}/.tmux.conf"
symlink "${DF_HOME}/.vimrc" "${HOME}/.vimrc"
symlink "${DF_HOME}/.zshrc" "${HOME}/.zshrc"
# Install ~/.config stuff
symlink "${DF_CONFIG}/rofi" "${HOME}/.config/rofi"
symlink "${DF_CONFIG}/compton" "${HOME}/.config/compton"
symlink "${DF_CONFIG}/dunst" "${HOME}/.config/dunst"
symlink "${DF_CONFIG}/gtk-2.0" "${HOME}/.config/gtk-2.0"
symlink "${DF_CONFIG}/gtk-3.0" "${HOME}/.config/gtk-3.0"
symlink "${DF_CONFIG}/htop" "${HOME}/.config/htop"
symlink "${DF_CONFIG}/i3" "${HOME}/.config/i3"
symlink "${DF_CONFIG}/morc_menu" "${HOME}/.config/morc_menu"
symlink "${DF_CONFIG}/nitrogen" "${HOME}/.config/nitrogen"
symlink "${DF_CONFIG}/terminator" "${HOME}/.config/terminator"
symlink "${DF_CONFIG}/ranger" "${HOME}/.config/ranger"
symlink "${DF_CONFIG}/viewnior" "${HOME}/.config/viewnior"
symlink "${DF_CONFIG}/mimeapps.list" "${HOME}/.config/mimeapps.list"
symlink "${DF_CONFIG}/Code/User/settings.json" "${HOME}/.config/Code/User/settings.json"
echo "Installing Nord rofi theme"
wget https://raw.githubusercontent.com/undiabler/nord-rofi-theme/master/nord.rasi -O "${HOME}/.config/rofi/themes/nord.rasi"
echo "Installing Iceberg Icon pack..."
# symlink "${DF_HOME}/.themes/oomox-iceberg" "${HOME}/.themes/oomox-iceberg"
symlink "${DF_HOME}/.icons/oomox-iceberg" "${HOME}/.icons/oomox-iceberg"
echo "Installing Nord GTK theme"
mkdir -p "${HOME}/.themes/Nordic"
wget https://github.com/EliverLara/Nordic/releases/download/v2.2.0/Nordic.tar.xz -O "${HOME}/.themes/Nordic.tar.xz"
tar -xf "${HOME}/.themes/Nordic.tar.xz" -C "${HOME}/.themes/Nordic"
echo "Building i3 configuration..."
"${DF_HOME}/bin/build-i3-config"
echo "Changing default shell to ZSH..."
chsh -s /usr/bin/zsh
echo "Installing Oh-My-ZSH..."
CHSH='no' RUNZSH='no' KEEP_ZSHRC='yes' sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#echo "Installing VSCode Extensions..."
#cat "${DOTFILES}/vs_code_extensions.lst" | xargs -n 1 code --install-extension --force
echo "Installing VIM Pathogen..."
curl -LSs https://tpo.pe/pathogen.vim -o "${HOME}/.vim/autoload/pathogen.vim"
echo "Installing VIM Nord theme"
curl -fLo "${HOME}/.vim/colors/nord.vim" --create-dirs https://raw.githubusercontent.com/arcticicestudio/nord-vim/main/colors/nord.vim
echo "Installing VIM Sensible..."
git clone git://github.com/tpope/vim-sensible.git "${HOME}/.vim/bundle/vim-sensible"
echo "Installing VIM Better Whitespace..."
git clone https://github.com/ntpeters/vim-better-whitespace.git "${HOME}/.vim/bundle/vim-better-whitespace"
echo "Installing VIM Indent Guides..."
git clone https://github.com/thaerkh/vim-indentguides.git "${HOME}/.vim/bundle/vim-indentguides"
if [ -e "${POSTINSTALL_SCRIPT}" ]; then
echo "Running post install..."
"${POSTINSTALL_SCRIPT}"
fi
echo "Install done."
echo "Log out and back in again for everything to take effect."
} # Ensures that the whole script is downloaded before execution