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