- Timestamp:
- 12/15/2011 17:11:55 (5 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
confaudit.in (modified) (2 diffs)
-
confman.in (modified) (9 diffs)
-
confmanlib.sh.in (modified) (7 diffs)
-
confsync.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/confman-1.9 merged: 543
- Property svn:mergeinfo changed
-
trunk/confaudit.in
r508 r545 109 109 tmproot=$(conf_tmp_dir) 110 110 live_root="${LIVE_ROOT}" 111 statefile=$(conf_tmp_file) 111 112 112 113 # Override LIVE_ROOT to commit into our temporary directory. … … 116 117 for layer in $(conf_get_recipe) ; do 117 118 echo "Rolling on $layer..." 118 conf_rollout $layer || conf_cleanExit119 conf_rollout $layer $statefile || conf_cleanExit 119 120 done 120 121 for file in $SINGULARITIES ; do -
trunk/confman.in
r541 r545 248 248 249 249 function commit_full { 250 local msg status modules module symlink abswork files 250 local msg status modules module symlink abswork files statefile 251 251 local nocommit=true 252 252 local opt OPTIND OPTARG … … 271 271 abswork=$(conf_abswork) 272 272 273 for module in $(conf_get_re cipe); do273 for module in $(conf_get_reverse_recipe); do 274 274 modules=${modules:+${modules} }${module} 275 275 for symlink in $(find ${WORK_PATH}/${module} \ … … 294 294 echo "Commit operation started" >&2 295 295 $nocommit || conf_commit_file $msg $files || return $? 296 297 296 update 298 297 299 for layer in $(conf_get_recipe) ; do 298 statefile=$(conf_tmp_file) 299 for layer in $(conf_get_reverse_recipe) ; do 300 300 echo "Rolling on $layer..." 301 conf_rollout $layer || return $?301 conf_rollout $layer $statefile || return $? 302 302 done 303 303 for file in $SINGULARITIES ; do … … 328 328 local opt OPTIND OPTARG 329 329 local module 330 local statefile 330 331 331 332 while getopts ":m:F:" opt ; do … … 362 363 update 363 364 364 for layer in $(conf_get_re cipe) ; do365 for layer in $(conf_get_reverse_recipe) ; do 365 366 for file in "$@"; do 366 367 module=$(conf_wfile_module $file) 367 368 if conf_wfile_is_singularity $file; then 368 conf_install $layer "${file%-$module}-${layer}"369 conf_install $layer $statefile "${file%-$module}-${layer}" 369 370 else 370 conf_install $layer "$file"371 conf_install $layer $statefile "$file" 371 372 fi 372 373 done … … 831 832 local checkpoint=$2 832 833 local clock=$3 833 local wcopy_lock system_lock 834 local wcopy_lock system_lock statefile 834 835 835 836 if [ -z "$2" ] ; then … … 841 842 echo "Rolling $module back to $checkpoint $clock" >&2 842 843 conf_rollback $module $checkpoint $clock || conf_cleanExit 843 for layer in $(conf_get_recipe) ; do 844 statefile=$(conf_tmp_file) 845 for layer in $(conf_get_reverse_recipe) ; do 844 846 echo "Rolling on $layer..." 845 conf_rollout $layer || conf_cleanExit847 conf_rollout $layer $statefile || conf_cleanExit 846 848 done 847 849 … … 995 997 local tmproot=$(conf_tmp_dir) 996 998 local live_root="${LIVE_ROOT}" 999 local statefile 997 1000 998 1001 # Override LIVE_ROOT to commit into our tmporary directory. … … 1002 1005 1003 1006 echo "Audit operation started" >&2 1004 for layer in $(conf_get_re cipe) ; do1007 for layer in $(conf_get_reverse_recipe) ; do 1005 1008 echo "Rolling on $layer..." 1006 conf_rollout $layer || return $?1009 conf_rollout $layer $statefile || return $? 1007 1010 done >/dev/null 1008 1011 for file in $SINGULARITIES ; do -
trunk/confmanlib.sh.in
r542 r545 523 523 } 524 524 525 # Test to see if the pathname has been added to a statefile yet 526 function conf_beenthere { 527 local statefile="$1" 528 local pathname="$2" 529 fgrep -q "$pathname" "$statefile" 530 } 531 532 # Record this file in the given statefile 533 function conf_gothere { 534 local statefile="$1" 535 local pathname="$2" 536 echo "$pathname" >> $statefile 537 } 538 525 539 # Roll out the specified module, optionally at the specified checkpoint 526 # eg: conf_rollout MODULE [checkpoint] 540 # A statefile is a place to record the files that have been rolled out to 541 # prevent a lower-priority module from installing a committed file. 542 # eg: conf_rollout MODULE STATEFILE [checkpoint] 527 543 function conf_rollout { 528 544 local module="$1" 529 if [ -z $2 ] ; then 545 local statefile="$2" 546 if [ -z $3 ] ; then 530 547 local moduledir="${WORK_PATH}/$module" 531 548 else … … 545 562 local livedir=`echo $directory | ${sed_cmd} -e "s:$moduledir::"` 546 563 livedir="${LIVE_ROOT}${livedir}" 547 local owner=`conf_get_prop ${directory} owner` 548 local group=`conf_get_prop ${directory} group` 549 local mode=`conf_get_prop ${directory} mode` 550 local opts="-d -o $owner -g $group -m $mode" 551 local cmd="$SUDO $install_cmd $opts $livedir" 552 echo $cmd 553 $cmd 554 done 564 if ! conf_beenthere $statefile "$livedir" ; then 565 local owner=`conf_get_prop ${directory} owner` 566 local group=`conf_get_prop ${directory} group` 567 local mode=`conf_get_prop ${directory} mode` 568 local opts="-d -o $owner -g $group -m $mode" 569 local cmd="$SUDO $install_cmd $opts $livedir" 570 echo $cmd 571 conf_gothere $statefile "$livedir" 572 $cmd 573 fi 574 done 555 575 for file in `find -L $moduledir -type f | grep -v "\.svn"` ; do 556 576 local livefile=`echo "$file" | ${sed_cmd} -e "s:$moduledir::"` … … 559 579 local mode=`conf_get_prop ${file} mode` 560 580 local symlink="`conf_get_prop ${file} symlink`" 561 file=`$readlink_cmd -m $file` 562 if [ -n "$symlink" ]; then 563 local cmd="$SUDO ln -snf $symlink ${LIVE_ROOT}$livefile" 564 echo $cmd 565 $cmd 566 else 567 local opts="-o $owner -g $group -m $mode" 568 local cmd="$SUDO $install_cmd $opts $file ${LIVE_ROOT}$livefile" 581 livefile="${LIVE_ROOT}${livefile}" 582 if ! conf_beenthere $statefile "$livefile" ; then 583 file=`$readlink_cmd -m $file` 584 if [ -n "$symlink" ]; then 585 local cmd="$SUDO ln -snf $symlink $livefile" 586 else 587 local opts="-o $owner -g $group -m $mode" 588 local cmd="$SUDO $install_cmd $opts $file $livefile" 589 fi 569 590 echo $cmd 591 conf_gothere $statefile "$livefile" 570 592 $cmd 571 593 fi … … 648 670 ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 649 671 local module="$1" 650 local file="$2" 672 local statefile="$2" 673 local file="$3" 651 674 shift 2 652 675 local livefile … … 662 685 livefile="/${file#*/}" 663 686 file="${ABS_WORK}/${module}${livefile}" 687 livefile="${LIVE_ROOT}${livefile}" 664 688 665 689 # See if it even exists 666 690 if [ ! -e "$file" ] ; then 667 691 conf_debug "$file" does not appear to exist 668 conf_install $module "$@"692 conf_install $module $statefile "$@" 669 693 return 1 670 694 fi … … 683 707 684 708 if [ -n "$symlink" ] ; then 685 local cmd="$SUDO ln -snf $symlink $ {LIVE_ROOT}$livefile"709 local cmd="$SUDO ln -snf $symlink $livefile" 686 710 else 687 local cmd="$SUDO $install_cmd $opts $file ${LIVE_ROOT}$livefile" 688 fi 689 690 ${NFS_HACK:-false} && chmod o+rx ${ABS_WORK} 691 echo $cmd 692 $cmd || failures=true 693 ${NFS_HACK:-false} && chmod o-rx ${ABS_WORK} 711 local cmd="$SUDO $install_cmd $opts $file $livefile" 712 fi 713 714 if ! conf_beenthere $statefile "$livefile" ; then 715 ${NFS_HACK:-false} && chmod o+rx ${ABS_WORK} 716 echo $cmd 717 conf_gothere $statefile "$lifefile" 718 $cmd || failures=true 719 ${NFS_HACK:-false} && chmod o-rx ${ABS_WORK} 720 fi 694 721 695 722 if [ -d "$file" ] ; then 696 723 conf_debug "conf_install encountered a directory. Recursing." 697 conf_install $module $ (find "$file" \724 conf_install $module $statefile $(find "$file" \ 698 725 -mindepth 1 -maxdepth 1 -not -name '.svn') || failures=true 699 726 fi 700 727 conf_debug "conf_install recursing" 701 conf_install $module "$@" || failures=true728 conf_install $module $statefile "$@" || failures=true 702 729 conf_debug "conf_install returning" 703 730 if $failures ; then … … 1152 1179 } 1153 1180 1181 # Gets a reversed copy of the recipe 1182 function conf_get_reverse_recipe { 1183 local fwd_recipe=$(conf_get_recipe "$@") 1184 local rev_recipe 1185 for module in $fwd_recipe ; do 1186 rev_recipe="$module $rev_recipe" 1187 done 1188 echo $rev_recipe 1189 } 1190 1154 1191 # Spits the recipe, modules separated by whitespace, out on stdout 1155 1192 function conf_get_recipe { -
trunk/confsync.in
r540 r545 116 116 sys_revision=`conf_sysrev` 117 117 last_action=$(conf_lastact) 118 statefile=$(conf_tmp_file) 118 119 119 120 if [ -n "${sys_revision}" ] ; then … … 133 134 for layer in $(conf_get_recipe) ; do 134 135 echo "Rolling on $layer..." 135 conf_rollout $layer || conf_cleanExit136 conf_rollout $layer $statefile || conf_cleanExit 136 137 done 137 138 for file in $SINGULARITIES ; do
Note: See TracChangeset
for help on using the changeset viewer.
