Quidquid latine dictum sit, altum videtur
This commit is contained in:
parent
80bf80d416
commit
3f9ab2fffd
@ -8,80 +8,78 @@ SCRIPTNAME=`basename "${SCRIPT}"`
|
|||||||
SCRIPTDIR=`dirname "${SCRIPT}"`
|
SCRIPTDIR=`dirname "${SCRIPT}"`
|
||||||
REPODIR=`realpath ${SCRIPTDIR}/..`
|
REPODIR=`realpath ${SCRIPTDIR}/..`
|
||||||
|
|
||||||
msg() {
|
refere() {
|
||||||
echo "`tput bold`${*}`tput sgr0`"
|
echo "`tput bold`${*}`tput sgr0`"
|
||||||
}
|
}
|
||||||
|
|
||||||
info() {
|
indica() {
|
||||||
echo "[`tput bold``tput setaf 2`INFO`tput sgr0`] `msg ${*}`"
|
echo "[`tput bold``tput setaf 2`INFO`tput sgr0`] `refere ${*}`"
|
||||||
}
|
}
|
||||||
|
|
||||||
warn() {
|
admone() {
|
||||||
echo "[`tput bold``tput setaf 3`WARN`tput sgr0`] `msg ${*}`"
|
echo "[`tput bold``tput setaf 3`WARN`tput sgr0`] `refere ${*}`"
|
||||||
}
|
}
|
||||||
|
|
||||||
err() {
|
erra() {
|
||||||
echo "[`tput bold``tput setaf 1`ERROR`tput sgr0`] `msg ${*}`"
|
echo "[`tput bold``tput setaf 1`ERROR`tput sgr0`] `refere ${*}`"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_file() {
|
persiste() {
|
||||||
src="${1}"
|
src="${1}"
|
||||||
dst="${2}"
|
dst="${2}"
|
||||||
if [ ! -e "${dst}" ] ; then
|
if [ ! -e "${dst}" ] ; then
|
||||||
mkdir -p "`dirname ${dst}`"
|
mkdir -p "`dirname ${dst}`"
|
||||||
ln -s "${src}" "${dst}"
|
ln -s "${src}" "${dst}"
|
||||||
elif [ -d "${dst}" ] ; then
|
|
||||||
err "${dst} is a directory, expected a file, skipping"
|
|
||||||
elif [ -h "${dst}" ] && [ `realpath "${src}"` == `realpath "$dst"` ] ; then
|
elif [ -h "${dst}" ] && [ `realpath "${src}"` == `realpath "$dst"` ] ; then
|
||||||
info "`basename ${src}` already installed, skipping"
|
indica "=> `basename ${src}` already installed, skipping"
|
||||||
else
|
else
|
||||||
warn "${dst} is already present but it is not managed by `basename "${0}"`, skipping"
|
admone "=> ${dst} is already present but it is not managed by `basename "${0}"`, skipping"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
checkout_repo() {
|
inspice() {
|
||||||
url="${1}"
|
url="${1}"
|
||||||
dst="${2}"
|
dst="${2}"
|
||||||
if [ ! -e "${dst}" ] ; then
|
if [ ! -e "${dst}" ] ; then
|
||||||
mkdir -p "`realpath ${dst}/..`"
|
mkdir -p "`realpath ${dst}/..`"
|
||||||
${git} clone "${url}" "$dst"
|
${git} clone "${url}" "$dst"
|
||||||
else
|
else
|
||||||
info "${dst} already present, skipping"
|
indica "${dst} already present, skipping"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# basic
|
# basic
|
||||||
info "Initializing new submodules"
|
indica "Initializing new submodules"
|
||||||
"${git}" -C "${REPODIR}" submodule init
|
"${git}" -C "${REPODIR}" submodule init
|
||||||
|
|
||||||
# scripts
|
# scripts
|
||||||
info "Deploying scripts to ~/bin"
|
indica "Deploying scripts to ~/bin"
|
||||||
for script in `find "${SCRIPTDIR}" -mindepth 1 -maxdepth 1 -type f` ; do
|
for script in `find "${SCRIPTDIR}" -mindepth 1 -maxdepth 1 -type f` ; do
|
||||||
scriptname="`basename "${script}"`"
|
scriptname="`basename "${script}"`"
|
||||||
install_file "${script}" "${HOME}/bin/${scriptname}"
|
persiste "${script}" "${HOME}/bin/${scriptname}"
|
||||||
done
|
done
|
||||||
unset scriptname
|
unset scriptname
|
||||||
|
|
||||||
# bash
|
# bash
|
||||||
info "Deploying bash configuration"
|
indica "Deploying bash configuration"
|
||||||
install_file "${REPODIR}/.bashrc" "${HOME}"
|
persiste "${REPODIR}/.bashrc" "${HOME}/.bashrc"
|
||||||
|
|
||||||
# terminal colors
|
# terminal colors
|
||||||
info "Configuring terminal colors"
|
indica "Configuring terminal colors"
|
||||||
checkout_repo https://github.com/chriskempson/base16-shell.git "${HOME}/.config/base16-shell"
|
inspice https://github.com/chriskempson/base16-shell.git "${HOME}/.config/base16-shell"
|
||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
info "Configuring tmux"
|
indica "Configuring tmux"
|
||||||
install_file "${REPODIR}/.tmux.conf" "${HOME}/.tmux.conf"
|
persiste "${REPODIR}/.tmux.conf" "${HOME}/.tmux.conf"
|
||||||
checkout_repo https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
|
inspice https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
|
||||||
|
|
||||||
# vim
|
# vim
|
||||||
info "Configuring vim"
|
indica "Configuring vim"
|
||||||
ln -s "${REPODIR}/.vim/" "${HOME}/.vim/"
|
persiste "${REPODIR}/.vim" "${HOME}/.vim"
|
||||||
install_file "${REPODIR}/.vimrc" "${HOME}/.vimrc"
|
persiste "${REPODIR}/.vimrc" "${HOME}/.vimrc"
|
||||||
|
|
||||||
# Update submodules
|
# Update submodules
|
||||||
info "Updating all submodules"
|
indica "Updating all submodules"
|
||||||
"${git}" -C "${REPODIR}" submodule update --init --recursive --merge --remote
|
"${git}" -C "${REPODIR}" submodule update --init --recursive --merge --remote
|
||||||
|
|
||||||
info "Done: verba volant, scripta manent"
|
indica "Factum est: verba volant, scripta manent"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user