Mercurial > ec-dotfiles
comparison setup @ 143:719b0687d974
Merge.
| author | Edho Arief <edho@myconan.net> | 
|---|---|
| date | Thu, 03 Nov 2011 10:00:40 +0700 | 
| parents | fcef92b3f37f 6a110770a756 | 
| children | 4eeccee282b1 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 133:fcef92b3f37f | 143:719b0687d974 | 
|---|---|
| 42 ;; | 42 ;; | 
| 43 esac | 43 esac | 
| 44 } | 44 } | 
| 45 | 45 | 
| 46 _rc() { | 46 _rc() { | 
| 47 if test -z "${3}" || test -z "${2}" || test -z "${1}"; then | |
| 48 _echo "Invalid command." | |
| 49 return | |
| 50 fi | |
| 47 _srcfile="${rcdir}/${2}" | 51 _srcfile="${rcdir}/${2}" | 
| 48 _dstfile="${HOME}/${3}" | 52 _dstfile="${HOME}/${3}" | 
| 49 if test ! -h "${_dstfile}"; then | 53 if test ! -h "${_dstfile}"; then | 
| 50 _fexist=0 | |
| 51 if test -f "${_dstfile}"; then | 54 if test -f "${_dstfile}"; then | 
| 52 cp "${_dstfile}" "${_dstfile}.bak" | 55 cp "${_dstfile}" "${_dstfile}.bak" | 
| 53 _fexist=1 | 56 _echo "${_dstfile} backed up to ${_dstfile}.bak" | 
| 54 elif test -d "${_dstfile}"; then | 57 elif test -d "${_dstfile}"; then | 
| 55 cp -r "${_dstfile}" "${_dstfile}.bak" | 58 cp -r "${_dstfile}" "${_dstfile}.bak" | 
| 56 _fexist=1 | 59 _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak" | 
| 57 fi | 60 fi | 
| 58 test "${_fexist}" = 1 &&_echo "${_dstfile} backed up to ${_dstfile}.bak" | |
| 59 fi | 61 fi | 
| 60 rm -f "${_dstfile}" | 62 rm -rf "${_dstfile}" | 
| 61 case "${1}" in | 63 case "${1}" in | 
| 62 install) | 64 install) | 
| 63 ln -fs "${_srcfile}" "${_dstfile}" | 65 ln -fs "${_srcfile}" "${_dstfile}" | 
| 64 _echo "Installed ${_dstfile}" | 66 _echo "Installed ${_dstfile}" | 
| 65 ;; | 67 ;; | 
| 101 done | 103 done | 
| 102 _rc "${1}" "tmux" ".tmux.conf" | 104 _rc "${1}" "tmux" ".tmux.conf" | 
| 103 _rc "${1}" "hg" ".hgrc" | 105 _rc "${1}" "hg" ".hgrc" | 
| 104 _rc "${1}" "vim" ".vimrc" | 106 _rc "${1}" "vim" ".vimrc" | 
| 105 _rc "${1}" "inputrc" ".inputrc" | 107 _rc "${1}" "inputrc" ".inputrc" | 
| 106 _rc "${1}" "bin" ".ecos_bin" | 108 _rc "${1}" "../bin" ".ecos_bin" | 
| 107 ;; | 109 ;; | 
| 108 *) | 110 *) | 
| 109 _help | 111 _help | 
| 110 ;; | 112 ;; | 
| 111 esac | 113 esac | 
