Mercurial > ec-dotfiles
comparison setup @ 133:fcef92b3f37f
Forgot to check whether the file actually exists.
| author | Edho Prima Arief <edho@myconan.net> |
|---|---|
| date | Thu, 27 Oct 2011 16:31:43 +0700 |
| parents | 66a1d79c4161 |
| children | 719b0687d974 |
comparison
equal
deleted
inserted
replaced
| 128:66a1d79c4161 | 133:fcef92b3f37f |
|---|---|
| 45 | 45 |
| 46 _rc() { | 46 _rc() { |
| 47 _srcfile="${rcdir}/${2}" | 47 _srcfile="${rcdir}/${2}" |
| 48 _dstfile="${HOME}/${3}" | 48 _dstfile="${HOME}/${3}" |
| 49 if test ! -h "${_dstfile}"; then | 49 if test ! -h "${_dstfile}"; then |
| 50 _fexist=0 | |
| 50 if test -f "${_dstfile}"; then | 51 if test -f "${_dstfile}"; then |
| 51 cp "${_dstfile}" "${_dstfile}.bak" | 52 cp "${_dstfile}" "${_dstfile}.bak" |
| 53 _fexist=1 | |
| 52 elif test -d "${_dstfile}"; then | 54 elif test -d "${_dstfile}"; then |
| 53 cp -r "${_dstfile}" "${_dstfile}.bak" | 55 cp -r "${_dstfile}" "${_dstfile}.bak" |
| 56 _fexist=1 | |
| 54 fi | 57 fi |
| 55 _echo "${_dstfile} backed up to ${_dstfile}.bak" | 58 test "${_fexist}" = 1 &&_echo "${_dstfile} backed up to ${_dstfile}.bak" |
| 56 fi | 59 fi |
| 57 rm -f "${_dstfile}" | 60 rm -f "${_dstfile}" |
| 58 case "${1}" in | 61 case "${1}" in |
| 59 install) | 62 install) |
| 60 ln -fs "${_srcfile}" "${_dstfile}" | 63 ln -fs "${_srcfile}" "${_dstfile}" |
