Mercurial > ec-dotfiles
annotate setup @ 126:9a15f3d1b5b0
Incorrect test - should test for any existence instead of file.
author | Edho Prima Arief <edho@myconan.net> |
---|---|
date | Wed, 26 Oct 2011 16:54:25 +0700 |
parents | 7c01fc6f7460 |
children | a7484f2c9616 |
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 |
74
54a82956bb11
[tcsh,setup] updated tcsh to new naming scheme.
Edho Prima Arief <me@myconan.net>
parents:
65
diff
changeset
|
6 linker "tcsh" ".ecos_tcsh" |
47
684a22aeb675
[setup] .blah.hur => .blah_hur
Edho Prima Arief <me@myconan.net>
parents:
46
diff
changeset
|
7 linker "bash" ".ecos_bash" |
64 | 8 linker "zsh" ".ecos_zsh" |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
9 linker "tmux" ".tmux.conf" |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
10 linker "hg" ".hgrc" |
3 | 11 linker "vim" ".vimrc" |
6 | 12 linker "inputrc" ".inputrc" |
17 | 13 #originally bin-ec. Renamed to .ecos.bin for sanity when listing home |
47
684a22aeb675
[setup] .blah.hur => .blah_hur
Edho Prima Arief <me@myconan.net>
parents:
46
diff
changeset
|
14 #and replaced . with _ for more sanity |
684a22aeb675
[setup] .blah.hur => .blah_hur
Edho Prima Arief <me@myconan.net>
parents:
46
diff
changeset
|
15 linker "bin" ".ecos_bin" |
1
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 #modify cshrc |
74
54a82956bb11
[tcsh,setup] updated tcsh to new naming scheme.
Edho Prima Arief <me@myconan.net>
parents:
65
diff
changeset
|
18 echo '[ -r "${HOME}/.ecos_tcsh" ] && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' >> "${HOME}/.cshrc" |
44
1f1af28f36e9
[bash] Bashrc, c-style ifdef.
Edho Prima Arief <me@myconan.net>
parents:
40
diff
changeset
|
19 #modify bash_profile and bashrc |
47
684a22aeb675
[setup] .blah.hur => .blah_hur
Edho Prima Arief <me@myconan.net>
parents:
46
diff
changeset
|
20 echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bash_profile" |
684a22aeb675
[setup] .blah.hur => .blah_hur
Edho Prima Arief <me@myconan.net>
parents:
46
diff
changeset
|
21 echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bashrc" |
65 | 22 #modify zshrc |
23 echo '[ -r "${HOME}/.ecos_zsh" ] && . "${HOME}/.ecos_zsh" #ECCORE_ZSH' >> "${HOME}/.zshrc" | |
1
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 |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
26 linker() { |
5
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
27 echo "Creating symlink: ${1} => ~/${2}" |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
28 ln -fs "${PWD}/${1}" "${HOME}/${2}" |
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 |
125 | 31 uninstall_init() { |
32 script="${1}" | |
33 scripttmp="${1}.new.tmp" | |
34 hashdata="${2}" | |
35 if [ -f "${script}" ]; then | |
36 grep -v "${hashdata}" "${script}" > "${scripttmp}" | |
37 mv "${scripttmp}" "${script}" | |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
38 fi |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
39 } |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
40 |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
41 uninstall() { |
74
54a82956bb11
[tcsh,setup] updated tcsh to new naming scheme.
Edho Prima Arief <me@myconan.net>
parents:
65
diff
changeset
|
42 for i in .ecos_tcsh .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin .ecos_bin .ecos_bash .ecos_zsh; do |
126
9a15f3d1b5b0
Incorrect test - should test for any existence instead of file.
Edho Prima Arief <edho@myconan.net>
parents:
125
diff
changeset
|
43 if [ -e "${HOME}/${i}" ]; then |
5
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
44 echo "Removing file: ~/${i}" |
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
45 rm -f "${HOME}/${i}" |
de6ce93d40fc
Added action message. Fixed missed files.
Edho Prima Arief <me@myconan.net>
parents:
4
diff
changeset
|
46 fi |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
47 done |
125 | 48 uninstall_init "${HOME}/.cshrc" "#ECCORE_TCSH" |
49 uninstall_init "${HOME}/.bashrc" "#ECCORE_BASH" | |
50 uninstall_init "${HOME}/.bash_profile" "#ECCORE_BASH" | |
51 uninstall_init "${HOME}/.zshrc" "#ECCORE_ZSH" | |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
52 } |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
53 |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
54 update() { |
29 | 55 if [ -f "${HOME}/.tcsh_exec" ]; then |
74
54a82956bb11
[tcsh,setup] updated tcsh to new naming scheme.
Edho Prima Arief <me@myconan.net>
parents:
65
diff
changeset
|
56 mv -f "${HOME}/.tcsh_exec" "${HOME}/.ecos_tcsh.after" |
54a82956bb11
[tcsh,setup] updated tcsh to new naming scheme.
Edho Prima Arief <me@myconan.net>
parents:
65
diff
changeset
|
57 echo "Moved: ${HOME}/.tcsh_exec => ${HOME}/.ecos_tcsh.after" |
29 | 58 fi |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
59 } |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
60 |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
61 help() { |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
62 cat <<EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
63 Usage: ${0} [install|uninstall] |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
64 EOF |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
65 } |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
66 |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
67 case "$1" in |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
68 install) |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
69 install |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
70 ;; |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
71 uninstall) |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
72 uninstall |
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
73 ;; |
26
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
74 update) |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
75 update |
175848778e77
Added initial upgrade support.
Edho Prima Arief <me@myconan.net>
parents:
23
diff
changeset
|
76 ;; |
23
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
77 *) |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
78 help |
738a2da8b79c
Added usage information for setup script.
Edho Prima Arief <me@myconan.net>
parents:
17
diff
changeset
|
79 ;; |
1
ddd721f10cb8
Unified installer/uninstaller.
Edho Prima Arief <me@myconan.net>
parents:
diff
changeset
|
80 esac |