comparison setup @ 1:ddd721f10cb8

Unified installer/uninstaller.
author Edho Prima Arief <me@myconan.net>
date Sat, 10 Jul 2010 12:11:03 +0000
parents
children 39ef7f7236fc
comparison
equal deleted inserted replaced
0:cd87be0968d9 1:ddd721f10cb8
1 #!/bin/sh
2
3 install() {
4 #create symlinks
5 linker "tcsh" ".tcsh_init"
6 linker "tmux" ".tmux.conf"
7 linker "hg" ".hgrc"
8
9 #modify cshrc
10 uninstall_tcsh
11 echo '[ -r "${HOME}/.tcsh_init" ] && source "${HOME}/.tcsh_init" #ECCORE_TCSH' >> "${HOME}/.cshrc"
12 }
13
14 linker() {
15 ln -fs "${PWD}/${1}" "${HOME}/${2}"
16 }
17
18 uninstall_tcsh() {
19 if [ -e "${HOME}/.cshrc" ]; then
20 grep -v '#ECCORE_TCSH' "${HOME}/.cshrc" > .cleancshrc
21 mv .cleancshrc "${HOME}/.cshrc"
22 fi
23 }
24
25 uninstall() {
26 for i in .tcsh_init .tmux_conf .hgrc; do
27 [ -e "${HOME}/${i}" ] && rm -f "${HOME}/${i}"
28 done
29 uninstall_tcsh
30 }
31
32 case "$1" in
33 install)
34 install
35 ;;
36 uninstall)
37 uninstall
38 ;;
39 esac