Changeset 568
- Timestamp:
- 12/16/2011 18:27:12 (5 months ago)
- Location:
- branches/confman-1.9
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
confaudit.in (modified) (2 diffs)
-
confman.in (modified) (9 diffs)
-
confmanlib.sh.in (modified) (6 diffs)
-
confsync.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/confman-1.9
-
branches/confman-1.9/confaudit.in
r556 r568 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. … … 114 115 115 116 echo "Audit operation started" | conf_logger 116 for layer in $(conf_get_re cipe) ; do117 for layer in $(conf_get_reverse_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 -
branches/confman-1.9/confman.in
r567 r568 249 249 250 250 function commit_full { 251 local msg status modules module symlink abswork files 251 local msg status modules module symlink abswork files statefile 252 252 local nocommit=true 253 253 local opt OPTIND OPTARG … … 272 272 abswork=$(conf_abswork) 273 273 274 for module in $(conf_get_re cipe); do274 for module in $(conf_get_reverse_recipe); do 275 275 modules=${modules:+${modules} }${module} 276 276 for symlink in $(find ${WORK_PATH}/${module} \ … … 295 295 echo "Commit operation started" >&2 296 296 $nocommit || conf_commit_file $msg $files || return $? 297 298 297 update 299 298 300 for layer in $(conf_get_recipe) ; do 299 statefile=$(conf_tmp_file) 300 for layer in $(conf_get_reverse_recipe) ; do 301 301 echo "Rolling on $layer..." 302 conf_rollout $layer || return $?302 conf_rollout $layer $statefile || return $? 303 303 done 304 304 for file in $SINGULARITIES ; do … … 329 329 local opt OPTIND OPTARG 330 330 local module 331 local statefile 331 332 332 333 while getopts ":m:F:" opt ; do … … 363 364 update 364 365 365 for layer in $(conf_get_recipe) ; do 366 statefile=$(conf_tmp_file) 367 for layer in $(conf_get_reverse_recipe) ; do 366 368 for file in "$@"; do 367 369 module=$(conf_wfile_module $file) 368 370 if conf_wfile_is_singularity $file; then 369 conf_install $layer "${file%-$module}-${layer}"371 conf_install $layer $statefile "${file%-$module}-${layer}" 370 372 else 371 conf_install $layer "$file"373 conf_install $layer $statefile "$file" 372 374 fi 373 375 done … … 832 834 local checkpoint=$2 833 835 local clock=$3 834 local wcopy_lock system_lock 836 local wcopy_lock system_lock statefile 835 837 836 838 if [ -z "$2" ] ; then … … 842 844 echo "Rolling $module back to $checkpoint $clock" >&2 843 845 conf_rollback $module $checkpoint $clock || conf_cleanExit 844 for layer in $(conf_get_recipe) ; do 846 statefile=$(conf_tmp_file) 847 for layer in $(conf_get_reverse_recipe) ; do 845 848 echo "Rolling on $layer..." 846 conf_rollout $layer || conf_cleanExit849 conf_rollout $layer $statefile || conf_cleanExit 847 850 done 848 851 … … 996 999 local tmproot=$(conf_tmp_dir) 997 1000 local live_root="${LIVE_ROOT}" 1001 local statefile 998 1002 999 1003 # Override LIVE_ROOT to commit into our tmporary directory. … … 1003 1007 1004 1008 echo "Audit operation started" >&2 1005 for layer in $(conf_get_recipe) ; do 1009 statefile=$(conf_tmp_file) 1010 for layer in $(conf_get_reverse_recipe) ; do 1006 1011 echo "Rolling on $layer..." 1007 conf_rollout $layer || return $?1012 conf_rollout $layer $statefile || return $? 1008 1013 done >/dev/null 1009 1014 for file in $SINGULARITIES ; do -
branches/confman-1.9/confmanlib.sh.in
r565 r568 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 -xq "$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 else 574 conf_debug "Ignoring directory ${livedir} in module ${module}" 575 fi 576 done 555 577 for file in `find -L $moduledir -type f | grep -v "\.svn"` ; do 556 578 local livefile=`echo "$file" | ${sed_cmd} -e "s:$moduledir::"` 557 local owner=`conf_get_prop ${file} owner` 558 local group=`conf_get_prop ${file} group` 559 local mode=`conf_get_prop ${file} mode` 560 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 579 livefile="${LIVE_ROOT}${livefile}" 580 if ! conf_beenthere $statefile "$livefile" ; then 581 local owner=`conf_get_prop ${file} owner` 582 local group=`conf_get_prop ${file} group` 583 local mode=`conf_get_prop ${file} mode` 584 local symlink="`conf_get_prop ${file} symlink`" 585 file=`$readlink_cmd -m $file` 586 if [ -n "$symlink" ]; then 587 local cmd="$SUDO ln -snf $symlink $livefile" 588 else 589 local opts="-o $owner -g $group -m $mode" 590 local cmd="$SUDO $install_cmd $opts $file $livefile" 591 fi 592 echo $cmd 593 conf_gothere $statefile "$livefile" 594 $cmd 566 595 else 567 local opts="-o $owner -g $group -m $mode" 568 local cmd="$SUDO $install_cmd $opts $file ${LIVE_ROOT}$livefile" 569 echo $cmd 570 $cmd 596 conf_debug "Ignoring file ${livefile} in module ${module}" 571 597 fi 572 598 done … … 648 674 ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 649 675 local module="$1" 650 local file="$2" 651 shift 2 676 local statefile="$2" 677 local file="$3" 678 shift 3 652 679 local livefile 653 680 local failures=false … … 662 689 livefile="/${file#*/}" 663 690 file="${ABS_WORK}/${module}${livefile}" 691 livefile="${LIVE_ROOT}${livefile}" 664 692 665 693 # See if it even exists 666 694 if [ ! -e "$file" ] ; then 667 695 conf_debug "$file" does not appear to exist 668 conf_install $module "$@"696 conf_install $module $statefile "$@" 669 697 return 1 670 698 fi … … 683 711 684 712 if [ -n "$symlink" ] ; then 685 local cmd="$SUDO ln -snf $symlink ${LIVE_ROOT}$livefile" 686 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} 713 local cmd="$SUDO ln -snf $symlink $livefile" 714 else 715 local cmd="$SUDO $install_cmd $opts $file $livefile" 716 fi 717 718 if ! conf_beenthere $statefile "$livefile" ; then 719 ${NFS_HACK:-false} && chmod o+rx ${ABS_WORK} 720 echo $cmd 721 conf_gothere $statefile "$livefile" 722 $cmd || failures=true 723 ${NFS_HACK:-false} && chmod o-rx ${ABS_WORK} 724 else 725 conf_debug "Ignoring file ${livefile} in module ${module}" 726 fi 694 727 695 728 if [ -d "$file" ] ; then 696 729 conf_debug "conf_install encountered a directory. Recursing." 697 conf_install $module $ (find "$file" \730 conf_install $module $statefile $(find "$file" \ 698 731 -mindepth 1 -maxdepth 1 -not -name '.svn') || failures=true 699 732 fi 700 733 conf_debug "conf_install recursing" 701 conf_install $module "$@" || failures=true734 conf_install $module $statefile "$@" || failures=true 702 735 conf_debug "conf_install returning" 703 736 if $failures ; then … … 1152 1185 } 1153 1186 1187 # Gets a reversed copy of the recipe 1188 function conf_get_reverse_recipe { 1189 local fwd_recipe=$(conf_get_recipe "$@") 1190 local rev_recipe 1191 for module in $fwd_recipe ; do 1192 rev_recipe="$module $rev_recipe" 1193 done 1194 echo $rev_recipe 1195 } 1196 1154 1197 # Spits the recipe, modules separated by whitespace, out on stdout 1155 1198 function conf_get_recipe { -
branches/confman-1.9/confsync.in
r564 r568 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 … … 131 132 132 133 echo "Sync operation started" | conf_logger 133 for layer in $(conf_get_re cipe) ; do134 for layer in $(conf_get_reverse_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.
