diff setup @ 143:719b0687d974

Merge.
author Edho Arief <edho@myconan.net>
date Thu, 03 Nov 2011 10:00:40 +0700
parents fcef92b3f37f 6a110770a756
children 4eeccee282b1
line wrap: on
line diff
--- a/setup	Thu Oct 27 16:31:43 2011 +0700
+++ b/setup	Thu Nov 03 10:00:40 2011 +0700
@@ -44,20 +44,22 @@
 }
 
 _rc() {
+  if test -z "${3}" || test -z "${2}" || test -z "${1}"; then
+    _echo "Invalid command."
+    return
+  fi
   _srcfile="${rcdir}/${2}"
   _dstfile="${HOME}/${3}"
   if test ! -h "${_dstfile}"; then
-    _fexist=0
     if test -f "${_dstfile}"; then
       cp "${_dstfile}" "${_dstfile}.bak"
-      _fexist=1
+      _echo "${_dstfile} backed up to ${_dstfile}.bak"
     elif test -d "${_dstfile}"; then
       cp -r "${_dstfile}" "${_dstfile}.bak"
-      _fexist=1
+      _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak"
     fi
-    test "${_fexist}" = 1 &&_echo "${_dstfile} backed up to ${_dstfile}.bak"
   fi
-  rm -f "${_dstfile}"
+  rm -rf "${_dstfile}"
   case "${1}" in
     install)
       ln -fs "${_srcfile}" "${_dstfile}"
@@ -103,7 +105,7 @@
     _rc "${1}" "hg" ".hgrc"
     _rc "${1}" "vim" ".vimrc"
     _rc "${1}" "inputrc" ".inputrc"
-    _rc "${1}" "bin" ".ecos_bin"
+    _rc "${1}" "../bin" ".ecos_bin"
   ;;
   *)
     _help