chore: update install script

This commit is contained in:
Joe Fleming
2026-03-07 13:58:24 -07:00
parent 6748e2ee7b
commit fa74d1c802
5 changed files with 55 additions and 454 deletions

View File

@@ -1,97 +1,84 @@
#!/bin/bash
# configure vim bundles
VIM_BUNDLES=(
'git://github.com/msanders/snipmate.vim.git'
'git://github.com/scrooloose/syntastic.git'
'git://github.com/altercation/vim-colors-solarized.git'
'git://github.com/tpope/vim-surround.git'
)
# check for git
GIT=$(which git)
if [ ! $? == 0 ]; then
echo "You must install git and add it to you PATH"
exit 1
fi
ROOT=`pwd`
ROOT="$(pwd)"
# pre-run cleanup
rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc
###
# bash
# shell
###
# clone bash_magic repo
if [ ! -d bash/bash_magic ]; then
$GIT clone git://github.com/w33ble/bash_magic.git bash/bash_magic
fi
# install select bash magic scripts
mkdir -p "${HOME}/bin" "${HOME}/.bash_aliases.d" "${HOME}/.bash_completion.d" "${HOME}/.bash_functions.d"
# check for zsh, perform setup if it exists
ZSH="$(which zsh)"
if [ ! $? == 0 ]; then
echo "Zsh not found, skipping shell setup"
else
echo "Zsh found, setting it as default shell"
chsh -s $ZSH
cd "${ROOT}/bash/bash_magic/bash_aliases.d";
for i in color refresh git less dev sublime docker misc; do cp "${i}.sh" "${HOME}/.bash_aliases.d"; done
cd "${ROOT}/bash/bash_magic/bash_completion.d";
for i in etc; do cp "${i}.sh" "${HOME}/.bash_completion.d"; done
cd "${ROOT}/bash/bash_magic/bash_functions.d";
for i in completion extract lsbytes lsnew vim; do cp "${i}.sh" "${HOME}/.bash_functions.d"; done
# install custom bash scripts
# cp "${ROOT}/bash/bash_aliases.d/"*.sh "${HOME}/.bash_aliases.d"
# cp "${ROOT}/bash/bash_completion.d/"*.sh "${HOME}/.bash_completion.d"
# cp "${ROOT}/bash/bash_functions.d/"*.sh "${HOME}/.bash_functions.d"
# set up the bash_profile file
cp "${ROOT}/bash/bash_profile" "${HOME}"/.bash_profile
# add bash_magic logic to bash profile
cat "${ROOT}/bash/bash_magic/bashrc" >> "${HOME}"/.bash_profile
if [ ! -f "${HOME}"/.bashrc ]; then
ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc
# install zimfw
echo "Install zimfw?"
read zfw
if [ "$zfw" == "y" ]; then
curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
fi
fi
###
# dotfiles
###
cd "${ROOT}/dotfiles"
for i in *; do
cp "${i}" "${HOME}/.${i}"
done
cd "${ROOT}"
# check for dotfiles, copy them to home
if [ -d "${ROOT}/dotfiles" ]; then
cd "${ROOT}/dotfiles" || exit
for i in *; do
# check if file exists, if so skip the copy
if [ -f "${HOME}/.${i}" ]; then
echo "File ${HOME}/.${i} already exists, skipping copy"
else
cp "${i}" "${HOME}/.${i}"
fi
done
cd "${ROOT}" || exit
fi
###
# git
###
# collect git user info, create config file
echo -n "Enter your git name: "
read NAME
echo -n "Enter you git email: "
read EMAIL
echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig
# check for git
GIT=$(which git)
if [ ! $? == 0 ]; then
echo "git not found, skipping git setup"
else
# add custom config and helpers
cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig
cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers
# add custom config and helpers
cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig
cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers
# collect git user info, create config file
echo "Enter you git auth details?"
read GIT_AUTH
if [ "$GIT_AUTH" == "y" ]; then
echo -n "Enter your git name: "
read NAME
echo -n "Enter you git email: "
read EMAIL
git config --global user.name "${NAME}"
git config --global user.email "${EMAIL}"
fi
fi
###
# vim
###
# clone bundle repos
echo "${ROOT}/vim/bundle"
cd "${ROOT}/vim/bundle"
pwd
for b in ${VIM_BUNDLES[@]}; do
$GIT clone "${b}"
done
cd "${ROOT}"
# install
cp -R vim "${HOME}"/.vim
ln -s "${HOME}"/.vim/vimrc "${HOME}"/.vimrc
if [ -d "${HOME}/.vimrc" ]; then
echo "Vim config already exists, skipping copy"
else
cp "${HOME}"/.vim/vimrc "${HOME}"/.vimrc
fi
echo Install complete, run the following: source \"${HOME}\"/.bashrc
echo Install complete, restart your terminal