dotfiles/install
2021-10-30 13:33:42 -05:00

65 lines
2.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
INSTALL_DIR=${HOME}/.dotfiles
OH_MY_ZSH_DIR=${HOME}/.oh-my-zsh
ZSH_CUSTOM=${OH_MY_ZSH_DIR}/custom
LOCAL_BIN_DIR=${HOME}/.local/bin
if [[ ! -d ${INSTALL_DIR} ]]; then
echo "Cloning dotfiles in to ${INSTALL_DIR}"
mkdir -p ${INSTALL_DIR}
git clone https://github.com/joshuadavidthomas/dotfiles.git ${INSTALL_DIR}
else
echo "Updating dotfiles"
cd ${INSTALL_DIR}
git pull
fi
if [[ ! -d $OH_MY_ZSH_DIR ]]; then
echo "Cloning oh-my-zsh in to ${OH_MY_ZSH_DIR}"
umask g-w,o-w
git clone -c core.eol=lf -c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
--depth=1 --branch master https://github.com/ohmyzsh/ohmyzsh ${OH_MY_ZSH_DIR}
else
echo "Updating oh-my-zsh"
cd ${OH_MY_ZSH_DIR}
git pull
fi
[[ -d "${ZSH_CUSTOM}/plugins/zsh-autosuggestions" ]] || git clone --depth 1 -- https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
[[ -d "${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting" ]] || git clone --depth 1 -- https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
[[ -d "${HOME}/.tmux/plugins/tpm" ]] || git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
[[ -d ${LOCAL_BIN_DIR} ]] || mkdir -p ${LOCAL_BIN_DIR}
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --force --bin-dir ${LOCAL_BIN_DIR}
curl -sfL https://direnv.net/install.sh | bash
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --force --to ${LOCAL_BIN_DIR}
ln -sf ${INSTALL_DIR}/.aliases ${HOME}/.aliases
ln -sf ${INSTALL_DIR}/.functions ${HOME}/.functions
ln -sf ${INSTALL_DIR}/.gitconfig ${HOME}/.gitconfig
ln -sf ${INSTALL_DIR}/.npmrc ${HOME}/.npmrc
ln -sf ${INSTALL_DIR}/.pythonrc ${HOME}/.pythonrc
ln -sf ${INSTALL_DIR}/.tmux.conf ${HOME}/.tmux.conf
ln -sf ${INSTALL_DIR}/.zprofile ${HOME}/.zprofile
ln -sf ${INSTALL_DIR}/.zshenv ${HOME}/.zshenv
ln -sf ${INSTALL_DIR}/.zshrc ${HOME}/.zshrc
for binary in ${INSTALL_DIR}/bin/*
do
ln -sf ${binary} ${HOME}/.local/bin
done
for config in ${INSTALL_DIR}/.config/*
do
ln -sf ${config} ${HOME}/.config
done