#!/bin/sh # Yeah, my CSHENV Install script is written in Bourne shell. This is because # CSH isn't a great scripting language, but it is a nice interactive shell. export REALPATH=`realpath $0` export INSTALLER_LOCATION=`dirname ${REALPATH}` export CSHENV_LOCATION=`dirname ${INSTALLER_LOCATION}` export RELATIVE_CSHENV_LOCATION=`realpath --relative-to=${HOME} ${CSHENV_LOCATION}` if [ -v CSHENV_DEBUG_INSTALLER ] then echo $CSHENV_LOCATION echo $RELATIVE_CSHENV_LOCATION exit fi echo "Checking for ~/.login" if [ ! -e ~/.login ] then echo "Installing ~/.login" echo "setenv CSHENV_DIR ${CSHENV_LOCATION}" >> ~/.login echo 'source ${CSHENV_DIR}/startup_hooks/login' >> ~/.login fi echo "Checking for ~/.tcshrc" if [ ! -e ~/.tcshrc ] then echo "Installing ~/.tcshrc" echo "setenv CSHENV_DIR ${CSHENV_LOCATION}" >> ~/.tcshrc echo "setenv CSHENV_HIDE_SHELL_LEVEL_AT_ONE" >> ~/.tcshrc echo 'source ${CSHENV_DIR}/startup_hooks/tcshrc' >> ~/.tcshrc fi echo "Checking for vim setup" if [ -e ~/.vimrc ] then echo "Relocating vimrc" mv ~/.vimrc ~/.vim/vimrc.old fi if [ -e ~/.vim ] then echo "Relocating vim setup" mv ~/.vim ~/.vim.old fi echo "Installing vim setup" pushd ~ >& /dev/null ln -s `echo ${RELATIVE_CSHENV_LOCATION}`/vim .vim ln -s .vim/vimrc .vimrc popd >& /dev/null if [ -e ~/.gitconfig ] then echo "Relocating git setup" mv ~/.gitconfig ~/.gitconfig-old fi echo "Installing git configuration" echo "[include]" >> ~/.gitconfig echo " path = ${CSHENV_LOCATION}/git/gitconfig" >> ~/.gitconfig echo "" >> ~/.gitconfig echo "[user]" >> ~/.gitconfig echo " email = adam@recursive.engineer" >> ~/.gitconfig echo " name = ADAM David Alan Martin" >> ~/.gitconfig echo "" >> ~/.gitconfig echo " signingKey = \"`hostname` Git\"" >> ~/.gitconfig echo "" >> ~/.gitconfig echo "[commit]" >> ~/.gitconfig echo " gpgSign = true" >> ~/.gitconfig echo "Do not forget to add the following line at the top of your ssh config:" echo "Include ${CSHENV_LOCATION}/ssh/config"