Mercurial > ec-dotfiles
annotate setup @ 39:3a9d39d8805b
[tcsh] Safe rm
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Tue, 26 Apr 2011 12:51:54 +0700 |
parents | 5db1b912f66b |
children | 34818dfa7f36 |
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() { |
5
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
4 uninstall |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
5 #create symlinks |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
6 linker "tcsh" ".tcsh_init" |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
7 linker "tmux" ".tmux.conf" |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
8 linker "hg" ".hgrc" |
3 | 9 linker "vim" ".vimrc" |
6 | 10 linker "inputrc" ".inputrc" |
17 | 11 #originally bin-ec. Renamed to .ecos.bin for sanity when listing home |
12 linker "bin" ".ecos.bin" | |
1
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 #modify cshrc |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
15 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
|
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 linker() { |
5
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
19 echo "Creating symlink: ${1} => ~/${2}" |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
20 ln -fs "${PWD}/${1}" "${HOME}/${2}" |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
21 } |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
22 |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
23 uninstall_tcsh() { |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
24 if [ -e "${HOME}/.cshrc" ]; then |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
25 grep -v '#ECCORE_TCSH' "${HOME}/.cshrc" > .cleancshrc |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
26 mv .cleancshrc "${HOME}/.cshrc" |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
27 fi |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
28 } |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
29 |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
30 uninstall() { |
17 | 31 for i in .tcsh_init .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin; do |
5
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
32 if [ -e "${HOME}/${i}" ]; then |
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
33 echo "Removing file: ~/${i}" |
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
34 rm -f "${HOME}/${i}" |
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
35 fi |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
36 done |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
37 uninstall_tcsh |
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 |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
40 update() { |
29 | 41 if [ -f "${HOME}/.tcsh_exec" ]; then |
42 mv -f "${HOME}/.tcsh_exec" "${HOME}/.tcsh_init.after" | |
43 echo "Moved: ${HOME}/.tcsh_exec => ${HOME}/.tcsh_init.after" | |
44 fi | |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
45 } |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
46 |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
47 help() { |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
48 cat <<EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
49 Usage: ${0} [install|uninstall] |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
50 EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
51 } |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
52 |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
53 case "$1" in |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
54 install) |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
55 install |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
56 ;; |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
57 uninstall) |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
58 uninstall |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
59 ;; |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
60 update) |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
61 update |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
62 ;; |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
63 *) |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
64 help |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
65 ;; |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
66 esac |