annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
1 #!/bin/sh
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
2
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
3 install() {
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
4 #create symlinks
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
5 linker "tcsh" ".tcsh_init"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
6 linker "tmux" ".tmux.conf"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
7 linker "hg" ".hgrc"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
8
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
9 #modify cshrc
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
10 uninstall_tcsh
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
11 echo '[ -r "${HOME}/.tcsh_init" ] && source "${HOME}/.tcsh_init" #ECCORE_TCSH' >> "${HOME}/.cshrc"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
12 }
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
13
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
14 linker() {
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
15 ln -fs "${PWD}/${1}" "${HOME}/${2}"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
16 }
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
17
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
18 uninstall_tcsh() {
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
19 if [ -e "${HOME}/.cshrc" ]; then
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
20 grep -v '#ECCORE_TCSH' "${HOME}/.cshrc" > .cleancshrc
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
21 mv .cleancshrc "${HOME}/.cshrc"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
22 fi
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
23 }
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
24
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
25 uninstall() {
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
26 for i in .tcsh_init .tmux_conf .hgrc; do
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
27 [ -e "${HOME}/${i}" ] && rm -f "${HOME}/${i}"
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
28 done
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
29 uninstall_tcsh
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
30 }
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
31
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
32 case "$1" in
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
33 install)
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
34 install
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
35 ;;
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
36 uninstall)
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
37 uninstall
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
38 ;;
ddd721f10cb8 Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
39 esac