comparison setup @ 125:7c01fc6f7460

Better install script.
author Edho Prima Arief <edho@myconan.net>
date Wed, 26 Oct 2011 16:52:34 +0700
parents 54a82956bb11
children 9a15f3d1b5b0
comparison
equal deleted inserted replaced
124:5bafb912837e 125:7c01fc6f7460
26 linker() { 26 linker() {
27 echo "Creating symlink: ${1} => ~/${2}" 27 echo "Creating symlink: ${1} => ~/${2}"
28 ln -fs "${PWD}/${1}" "${HOME}/${2}" 28 ln -fs "${PWD}/${1}" "${HOME}/${2}"
29 } 29 }
30 30
31 uninstall_tcsh() { 31 uninstall_init() {
32 if [ -f "${HOME}/.cshrc" ]; then 32 script="${1}"
33 grep -v '#ECCORE_TCSH' "${HOME}/.cshrc" > .cleancshrc 33 scripttmp="${1}.new.tmp"
34 mv .cleancshrc "${HOME}/.cshrc" 34 hashdata="${2}"
35 if [ -f "${script}" ]; then
36 grep -v "${hashdata}" "${script}" > "${scripttmp}"
37 mv "${scripttmp}" "${script}"
35 fi 38 fi
36 } 39 }
37 40
38 uninstall() { 41 uninstall() {
39 for i in .ecos_tcsh .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin .ecos_bin .ecos_bash .ecos_zsh; do 42 for i in .ecos_tcsh .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin .ecos_bin .ecos_bash .ecos_zsh; do
40 if [ -f "${HOME}/${i}" ]; then 43 if [ -f "${HOME}/${i}" ]; then
41 echo "Removing file: ~/${i}" 44 echo "Removing file: ~/${i}"
42 rm -f "${HOME}/${i}" 45 rm -f "${HOME}/${i}"
43 fi 46 fi
44 done 47 done
45 uninstall_tcsh 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"
46 } 52 }
47 53
48 update() { 54 update() {
49 if [ -f "${HOME}/.tcsh_exec" ]; then 55 if [ -f "${HOME}/.tcsh_exec" ]; then
50 mv -f "${HOME}/.tcsh_exec" "${HOME}/.ecos_tcsh.after" 56 mv -f "${HOME}/.tcsh_exec" "${HOME}/.ecos_tcsh.after"