view setup @ 28:9381a0c8f3f0

Better color setting.
author Edho Prima Arief <me@myconan.net>
date Sun, 06 Feb 2011 12:35:56 +0700
parents 175848778e77
children 5db1b912f66b
line wrap: on
line source

#!/bin/sh

install() {
  uninstall
  #create symlinks
  linker "tcsh" ".tcsh_init"
  linker "tmux" ".tmux.conf"
  linker "hg" ".hgrc"
  linker "vim" ".vimrc"
  linker "inputrc" ".inputrc"
  #originally bin-ec. Renamed to .ecos.bin for sanity when listing home
  linker "bin" ".ecos.bin"

  #modify cshrc
  echo '[ -r "${HOME}/.tcsh_init" ] && source "${HOME}/.tcsh_init" #ECCORE_TCSH' >> "${HOME}/.cshrc"
}

linker() {
  echo "Creating symlink: ${1} => ~/${2}"
  ln -fs "${PWD}/${1}" "${HOME}/${2}"
}

uninstall_tcsh() {
  if [ -e "${HOME}/.cshrc" ]; then
    grep -v '#ECCORE_TCSH' "${HOME}/.cshrc" > .cleancshrc
    mv .cleancshrc "${HOME}/.cshrc"
  fi
}

uninstall() {
  for i in .tcsh_init .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin; do
    if [ -e "${HOME}/${i}" ]; then
      echo "Removing file: ~/${i}"
      rm -f "${HOME}/${i}"
    fi
  done
  uninstall_tcsh
}

update() {
  [ -f "${HOME}/.tcsh_exec" ] && mv -f "${HOME}/.tcsh_exec" "${HOME}/.tcsh_init.after"
}

help() {
  cat <<EOF
Usage: ${0} [install|uninstall]
EOF
}

case "$1" in
  install)
    install
  ;;
  uninstall)
    uninstall
  ;;
  update)
    update
  ;;
  *)
    help
  ;;
esac