Changeset 120 for trunk/confman/confmanlib.sh
- Timestamp:
- 12/04/2006 01:32:20 (5 years ago)
- File:
-
- 1 edited
-
trunk/confman/confmanlib.sh (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/confman/confmanlib.sh
r117 r120 55 55 # Commits module $1 with message $2 56 56 function conf_commit { 57 local module =$157 local modules=$(echo $modules | tr ' ' ',') 58 58 local msg="$2" 59 svn commit -F "$msg" ${WORK_PATH}/$module 59 60 # $modules is in the form foo,bar,baz. This eval trick forces 61 # curly brace expansion. 62 svn commit -F "$msg" $(eval echo foo/{$modules}) 63 } 64 65 function conf_fetch { 66 local tmpfile=`mktemp -t confman` 67 local proto="${CONF_EXPORT_URI%:/*}" 68 local remote 69 70 case $proto in 71 sftp|scp) 72 remote="${CONF_EXPORT_URI#*://}" 73 remote="${remote/\//:/}" 74 scp $remote $tmpfile 75 ;; 76 http|https|ftp) 77 fetch -o $tmpfile $remote 78 ;; 79 file) 80 remote="${CONF_EXPORT_URI#*://}" 81 cp $remote $tmpfile 82 ;; 83 *) 84 echo "Unsupported Protocol in conf_fetch" >&2 85 return 1 86 ;; 87 esac 88 echo $tmpfile 89 return 0 60 90 } 61 91 … … 63 93 function conf_status { 64 94 svn status $* 95 } 96 97 # This exports a working copy of the repository to a tarball 98 function conf_export { 99 local tmpdir=`mktemp -d -t confman` 100 local tarball="$1" 101 svn checkout "${REPO_URI}" "${tmpdir}/conf" 102 tar -czf "$tarball" -C "$tmpdir" conf 103 rm -rf "$tmpdir" 65 104 } 66 105 … … 400 439 } 401 440 441 # Accepts log messages on stdin until EOF 442 function conf_logger { 443 cat | logger -t "$MYNAME[$$]: $USER" -s 444 } 445 402 446 # WARNING: If you refer to fd 2 in this code, this function will silently 403 447 # fail when called by trap. DO NOT ATTEMPT TO LOG TO fd 2 IN THIS FUNCTION! … … 405 449 # process, which is receiving its input from our fd 2. 406 450 function conf_cleanexit { 451 echo "Confman received a signal. Exiting cleanly." | conf_logger 407 452 echo "Abort, Abort! Patience is a virtue." >&4 408 453 echo "Please wait until I finish cleaning up after you." >&4 409 410 echo "Removing leftover temp files..." >&4411 find /tmp -maxdepth 1 -user `whoami` -name 'confman*' -exec rm -f {} \;412 454 413 455 # And in case we got an interrupt during a rollout, we still want the … … 415 457 chmod 700 ${WORK_PATH} 416 458 459 echo "Removing leftover temp files..." >&4 460 find /tmp -maxdepth 1 -user `whoami` -name 'confman*' -exec rm -rf {} \; 461 417 462 # And this clears any locks we may have created on our working copy: 418 463 echo "Undoing damage to your working copy..." >&4 419 svn cleanup ${WORK_PATH}464 [ -d "${WORK_PATH}" ] && svn cleanup ${WORK_PATH} 420 465 echo "All clean. Terminating." >&4 421 466
Note: See TracChangeset
for help on using the changeset viewer.
