diff setup @ 533:77c1f9e624a3

Rename prefix to `.ec.` instead of `.ecos_`.
author edogawaconan <me@myconan.net>
date Tue, 25 Nov 2014 15:03:54 +0900
parents cb4e2a6595ea
children 49235ac0891a
line wrap: on
line diff
--- a/setup	Thu Nov 20 16:06:07 2014 +0900
+++ b/setup	Tue Nov 25 15:03:54 2014 +0900
@@ -40,9 +40,9 @@
 _tcsh() {
   case "$1" in
     uninstall|install)
-      _rc "${1}" "cshrc" ".ecos_tcsh"
-      _init "${1}" 'test -r "${HOME}/.ecos_tcsh" && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' ".cshrc"
-      _init "${1}" 'test -r "${HOME}/.ecos_tcsh" && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' ".tcshrc"
+      _rc "${1}" "cshrc" ".ec.tcsh"
+      _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".cshrc"
+      _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".tcshrc"
     ;;
   esac
 }
@@ -50,9 +50,9 @@
 _bash() {
   case "${1}" in
     uninstall|install)
-      _rc "${1}" "bashrc" ".ecos_bash"
-     _init "${1}" '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' ".bash_profile"
-     _init "${1}" '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' ".bashrc"
+      _rc "${1}" "bashrc" ".ec.bash"
+     _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bash_profile"
+     _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bashrc"
     ;;
   esac
 }
@@ -69,8 +69,8 @@
 _zsh() {
   case "${1}" in
     uninstall|install)
-      _rc "${1}" "zshrc" ".ecos_zsh"
-      _init "${1}" '[ -r "${HOME}/.ecos_zsh" ] && . "${HOME}/.ecos_zsh" #ECCORE_ZSH' ".zshrc"
+      _rc "${1}" "zshrc" ".ec.zsh"
+      _init "${1}" '[ -r "${HOME}/.ec.zsh" ] && . "${HOME}/.ec.zsh" #ECCORE_ZSH' ".zshrc"
     ;;
   esac
 }
@@ -149,6 +149,17 @@
   _echo ...done
 }
 
+_upgrade() {
+  for i in bash bash.after bash.before bin tcsh tcsh.after tcsh.before zsh zsh.after zsh.before; do
+    src="${HOME}/.ecos_${i}"
+    tgt="${HOME}/.ec.${i}"
+    if test -h "${src}" && test ! -h "${tgt}"; then
+      _echo "Moving ${src} to ${tgt}"
+      mv -f "${src}" "${tgt}"
+    fi
+  done
+}
+
 _help() {
   cat <<EOF
 Usage: ${0} [install|uninstall]
@@ -157,12 +168,13 @@
 
 case "${1}" in
   install|uninstall)
+    _upgrade
     _tcsh "${1}"
     _bash "${1}"
     _ksh "${1}"
     _zsh "${1}"
     _rc "${1}" "shellinit-posix" ".ec.shellinit-posix"
-    _rc "${1}" "../bin" ".ecos_bin"
+    _rc "${1}" "../bin" ".ec.bin"
     _rc "${1}" "gemrc" ".gemrc"
     _rc "${1}" "gitconfig" ".gitconfig"
     _rc "${1}" "gitignore_global" ".gitignore_global"