2019-12-06 16:31:10 -05:00
|
|
|
#!/bin/bash
|
2020-05-25 13:36:22 -04:00
|
|
|
readonly HOMESHICK_DIR="${HOME}/.homesick/repos/homeshick"
|
|
|
|
|
2019-12-06 16:31:10 -05:00
|
|
|
check_required_cmds() {
|
|
|
|
local -r REQUIRED_CMDS=(
|
|
|
|
'curl'
|
|
|
|
'git'
|
|
|
|
'sha256sum'
|
|
|
|
'tar'
|
|
|
|
'tmux'
|
|
|
|
'vim'
|
|
|
|
'zsh'
|
|
|
|
)
|
|
|
|
|
|
|
|
local RETURN=0
|
|
|
|
local REQUIRED_CMD
|
|
|
|
for REQUIRED_CMD in ${REQUIRED_CMDS[*]}; do
|
|
|
|
if ! command -v "${REQUIRED_CMD}" &> /dev/null; then
|
|
|
|
>&2 echo "Missing '${REQUIRED_CMD}' from PATH"
|
|
|
|
RETURN=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return "${RETURN}"
|
|
|
|
}
|
|
|
|
|
|
|
|
install_homeshick() {
|
|
|
|
if [ -d "${HOMESHICK_DIR}" ]; then
|
|
|
|
echo 'homeshick is already installed'
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
git clone https://github.com/andsens/homeshick.git "${HOMESHICK_DIR}"
|
|
|
|
}
|
|
|
|
|
|
|
|
install_ohmyzsh() {
|
|
|
|
if [ -d "${HOME}/.oh-my-zsh" ]; then
|
|
|
|
echo 'oh-my-zsh is already installed'
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
|
|
|
}
|
|
|
|
|
2020-05-25 13:36:22 -04:00
|
|
|
install_custom_ohmyzsh_plugins() {
|
|
|
|
local REPOS=(
|
|
|
|
https://github.com/zsh-users/zsh-autosuggestions
|
2020-05-25 13:56:17 -04:00
|
|
|
https://github.com/zsh-users/zsh-syntax-highlighting
|
2020-05-25 13:36:22 -04:00
|
|
|
)
|
2019-12-06 16:31:10 -05:00
|
|
|
|
2020-05-25 13:36:22 -04:00
|
|
|
local REPO
|
2020-05-25 13:56:17 -04:00
|
|
|
local ZSH_CUSTOM_DEST
|
2020-05-25 13:36:22 -04:00
|
|
|
for REPO in ${REPOS[*]}; do
|
2020-05-25 13:56:17 -04:00
|
|
|
ZSH_CUSTOM_DEST="${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/$(basename "${REPO}")"
|
|
|
|
|
|
|
|
if [ -d "${ZSH_CUSTOM_DEST}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2020-05-25 13:36:22 -04:00
|
|
|
git clone \
|
|
|
|
"${REPO}" \
|
2020-05-25 13:56:17 -04:00
|
|
|
"${ZSH_CUSTOM_DEST}" || exit $?
|
2020-05-25 13:36:22 -04:00
|
|
|
done
|
2019-12-06 16:31:10 -05:00
|
|
|
}
|
|
|
|
|
2020-05-25 13:36:22 -04:00
|
|
|
install_tmux_conf() {
|
|
|
|
if [ -d "${HOME}/.tmux" ]; then
|
|
|
|
echo '.tmux already exists'
|
2019-12-06 16:31:10 -05:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
(
|
2020-05-25 13:36:22 -04:00
|
|
|
set -e
|
|
|
|
cd
|
|
|
|
git clone https://github.com/gpakosz/.tmux.git
|
2020-05-25 13:56:17 -04:00
|
|
|
ln -s .tmux/.tmux.conf ./
|
2020-05-25 13:36:22 -04:00
|
|
|
)
|
2019-12-06 16:31:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
check_required_cmds || exit $?
|
|
|
|
|
|
|
|
echo 'installing homeshick'
|
2020-05-25 13:36:22 -04:00
|
|
|
install_homeshick || exit $?
|
2019-12-06 16:31:10 -05:00
|
|
|
echo 'installing oh-my-zsh'
|
|
|
|
install_ohmyzsh || exit $?
|
2020-05-25 13:36:22 -04:00
|
|
|
echo 'installing custom ohmyzsh plugins'
|
|
|
|
install_custom_ohmyzsh_plugins || exit $?
|
|
|
|
echo 'installing tmux config'
|
|
|
|
install_tmux_conf || exit $?
|
|
|
|
|
|
|
|
source "${HOMESHICK_DIR}/homeshick.sh"
|
|
|
|
|
|
|
|
homeshick clone https://github.com/tblyler/tb-dotfiles
|
2019-12-06 16:31:10 -05:00
|
|
|
|
|
|
|
echo 'now in zsh, run "upgrade_system"'
|