Mercurial > ec-dotfiles
comparison setup @ 135:6a110770a756
A bit more sanity testing.
| author | Edho Prima Arief <edho@myconan.net> |
|---|---|
| date | Tue, 01 Nov 2011 22:40:21 +0700 |
| parents | 70928bbbd6cb |
| children | 719b0687d974 |
comparison
equal
deleted
inserted
replaced
| 134:cf328bd06078 | 135:6a110770a756 |
|---|---|
| 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 if test -f "${_dstfile}"; then | 54 if test -f "${_dstfile}"; then |
| 51 cp "${_dstfile}" "${_dstfile}.bak" | 55 cp "${_dstfile}" "${_dstfile}.bak" |
| 56 _echo "${_dstfile} backed up to ${_dstfile}.bak" | |
| 52 elif test -d "${_dstfile}"; then | 57 elif test -d "${_dstfile}"; then |
| 53 cp -r "${_dstfile}" "${_dstfile}.bak" | 58 cp -r "${_dstfile}" "${_dstfile}.bak" |
| 59 _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak" | |
| 54 fi | 60 fi |
| 55 _echo "${_dstfile} backed up to ${_dstfile}.bak" | |
| 56 fi | 61 fi |
| 57 rm -f "${_dstfile}" | 62 rm -rf "${_dstfile}" |
| 58 case "${1}" in | 63 case "${1}" in |
| 59 install) | 64 install) |
| 60 ln -fs "${_srcfile}" "${_dstfile}" | 65 ln -fs "${_srcfile}" "${_dstfile}" |
| 61 _echo "Installed ${_dstfile}" | 66 _echo "Installed ${_dstfile}" |
| 62 ;; | 67 ;; |
