Changeset 543
- Timestamp:
- 12/15/2011 16:59:40 (5 months ago)
- Location:
- branches/confman-1.9
- Files:
-
- 4 edited
-
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
-
branches/confman-1.9/confaudit.in
r483 r543 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 -
branches/confman-1.9/confman.in
r502 r543 189 189 190 190 function commit { 191 local msg status modules module symlink abswork files 191 local msg status modules module symlink abswork files statefile 192 192 local nocommit=true 193 193 local opt OPTIND OPTARG … … 212 212 abswork=$(conf_abswork) 213 213 214 for module in $(conf_get_re cipe); do214 for module in $(conf_get_reverse_recipe); do 215 215 modules=${modules:+${modules} }${module} 216 216 for symlink in $(find ${WORK_PATH}/${module} \ … … 236 236 echo "Commit operation started" >&2 237 237 $nocommit || conf_commit_file $msg $files || return $? 238 for layer in $(conf_get_recipe) ; do 238 statefile=$(conf_tmp_file) 239 for layer in $(conf_get_reverse_recipe) ; do 239 240 echo "Rolling on $layer..." 240 conf_rollout $layer || return $?241 conf_rollout $layer $statefile || return $? 241 242 done 242 243 for file in $SINGULARITIES ; do … … 259 260 local opt OPTIND OPTARG 260 261 local module 262 local statefile 261 263 262 264 while getopts ":m:F:" opt ; do … … 292 294 $nocommit || conf_commit_file "$msg" "$files" || return $? 293 295 294 for layer in $(conf_get_re cipe) ; do296 for layer in $(conf_get_reverse_recipe) ; do 295 297 for file in "$@"; do 296 298 module=$(conf_wfile_module $file) 297 299 if conf_wfile_is_singularity $file; then 298 conf_install $layer "${file%-$module}-${layer}"300 conf_install $layer $statefile "${file%-$module}-${layer}" 299 301 else 300 conf_install $layer "$file"302 conf_install $layer $statefile "$file" 301 303 fi 302 304 done … … 761 763 local checkpoint=$2 762 764 local clock=$3 763 local wcopy_lock system_lock 765 local wcopy_lock system_lock statefile 764 766 765 767 if [ -z "$2" ] ; then … … 771 773 echo "Rolling $module back to $checkpoint $clock" >&2 772 774 conf_rollback $module $checkpoint $clock || conf_cleanExit 773 for layer in $(conf_get_recipe) ; do 775 statefile=$(conf_tmp_file) 776 for layer in $(conf_get_reverse_recipe) ; do 774 777 echo "Rolling on $layer..." 775 conf_rollout $layer || conf_cleanExit778 conf_rollout $layer $statefile || conf_cleanExit 776 779 done 777 780 … … 925 928 local tmproot=$(conf_tmp_dir) 926 929 local live_root="${LIVE_ROOT}" 930 local statefile 927 931 928 932 # Override LIVE_ROOT to commit into our tmporary directory. … … 932 936 933 937 echo "Audit operation started" >&2 934 for layer in $(conf_get_re cipe) ; do938 for layer in $(conf_get_reverse_recipe) ; do 935 939 echo "Rolling on $layer..." 936 conf_rollout $layer || return $?940 conf_rollout $layer $statefile || return $? 937 941 done >/dev/null 938 942 for file in $SINGULARITIES ; do -
branches/confman-1.9/confmanlib.sh.in
r516 r543 414 414 } 415 415 416 # Test to see if the pathname has been added to a statefile yet 417 function conf_beenthere { 418 local statefile="$1" 419 local pathname="$2" 420 fgrep -q "$pathname" "$statefile" 421 } 422 423 # Record this file in the given statefile 424 function conf_gothere { 425 local statefile="$1" 426 local pathname="$2" 427 echo "$pathname" >> $statefile 428 } 429 416 430 # Roll out the specified module, optionally at the specified checkpoint 417 # eg: conf_rollout MODULE [checkpoint] 431 # A statefile is a place to record the files that have been rolled out to 432 # prevent a lower-priority module from installing a committed file. 433 # eg: conf_rollout MODULE STATEFILE [checkpoint] 418 434 function conf_rollout { 419 435 local module="$1" 420 if [ -z $2 ] ; then 436 local statefile="$2" 437 if [ -z $3 ] ; then 421 438 local moduledir="${WORK_PATH}/$module" 422 439 else … … 436 453 local livedir=`echo $directory | ${sed_cmd} -e "s:$moduledir::"` 437 454 livedir="${LIVE_ROOT}${livedir}" 438 local owner=`conf_get_prop ${directory} owner` 439 local group=`conf_get_prop ${directory} group` 440 local mode=`conf_get_prop ${directory} mode` 441 local opts="-d -o $owner -g $group -m $mode" 442 local cmd="$SUDO $install_cmd $opts $livedir" 443 echo $cmd 444 $cmd 445 done 455 if ! conf_beenthere $statefile "$livedir" ; then 456 local owner=`conf_get_prop ${directory} owner` 457 local group=`conf_get_prop ${directory} group` 458 local mode=`conf_get_prop ${directory} mode` 459 local opts="-d -o $owner -g $group -m $mode" 460 local cmd="$SUDO $install_cmd $opts $livedir" 461 echo $cmd 462 conf_gothere $statefile "$livedir" 463 $cmd 464 fi 465 done 446 466 for file in `find -L $moduledir -type f | grep -v "\.svn"` ; do 447 467 local livefile=`echo "$file" | ${sed_cmd} -e "s:$moduledir::"` … … 450 470 local mode=`conf_get_prop ${file} mode` 451 471 local symlink="`conf_get_prop ${file} symlink`" 452 file=`$readlink_cmd -m $file` 453 if [ -n "$symlink" ]; then 454 local cmd="$SUDO ln -snf $symlink ${LIVE_ROOT}$livefile" 455 echo $cmd 456 $cmd 457 else 458 local opts="-o $owner -g $group -m $mode" 459 local cmd="$SUDO $install_cmd $opts $file ${LIVE_ROOT}$livefile" 472 livefile="${LIVE_ROOT}${livefile}" 473 if ! conf_beenthere $statefile "$livefile" ; then 474 file=`$readlink_cmd -m $file` 475 if [ -n "$symlink" ]; then 476 local cmd="$SUDO ln -snf $symlink $livefile" 477 else 478 local opts="-o $owner -g $group -m $mode" 479 local cmd="$SUDO $install_cmd $opts $file $livefile" 480 fi 460 481 echo $cmd 482 conf_gothere $statefile "$livefile" 461 483 $cmd 462 484 fi … … 539 561 ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 540 562 local module="$1" 541 local file="$2" 563 local statefile="$2" 564 local file="$3" 542 565 shift 2 543 566 local livefile … … 553 576 livefile="/${file#*/}" 554 577 file="${ABS_WORK}/${module}${livefile}" 578 livefile="${LIVE_ROOT}${livefile}" 555 579 556 580 # See if it even exists 557 581 if [ ! -e "$file" ] ; then 558 582 conf_debug "$file" does not appear to exist 559 conf_install $module "$@"583 conf_install $module $statefile "$@" 560 584 return 1 561 585 fi … … 574 598 575 599 if [ -n "$symlink" ] ; then 576 local cmd="$SUDO ln -snf $symlink ${LIVE_ROOT}$livefile" 577 else 578 local cmd="$SUDO $install_cmd $opts $file ${LIVE_ROOT}$livefile" 579 fi 580 581 ${NFS_HACK:-false} && chmod o+rx ${ABS_WORK} 582 echo $cmd 583 $cmd || failures=true 584 ${NFS_HACK:-false} && chmod o-rx ${ABS_WORK} 600 local cmd="$SUDO ln -snf $symlink $livefile" 601 else 602 local cmd="$SUDO $install_cmd $opts $file $livefile" 603 fi 604 605 if ! conf_beenthere $statefile "$livefile" ; then 606 ${NFS_HACK:-false} && chmod o+rx ${ABS_WORK} 607 echo $cmd 608 conf_gothere $statefile "$lifefile" 609 $cmd || failures=true 610 ${NFS_HACK:-false} && chmod o-rx ${ABS_WORK} 611 fi 585 612 586 613 if [ -d "$file" ] ; then 587 614 conf_debug "conf_install encountered a directory. Recursing." 588 conf_install $module $ (find "$file" \615 conf_install $module $statefile $(find "$file" \ 589 616 -mindepth 1 -maxdepth 1 -not -name '.svn') || failures=true 590 617 fi 591 618 conf_debug "conf_install recursing" 592 conf_install $module "$@" || failures=true619 conf_install $module $statefile "$@" || failures=true 593 620 conf_debug "conf_install returning" 594 621 if $failures ; then … … 1013 1040 } 1014 1041 1042 # Gets a reversed copy of the recipe 1043 function conf_get_reverse_recipe { 1044 local fwd_recipe=$(conf_get_recipe "$@") 1045 local rev_recipe 1046 for module in $fwd_recipe ; do 1047 rev_recipe="$module $rev_recipe" 1048 done 1049 echo $rev_recipe 1050 } 1051 1015 1052 # Spits the recipe, modules separated by whitespace, out on stdout 1016 1053 function conf_get_recipe { -
branches/confman-1.9/confsync.in
r486 r543 116 116 sys_revision=`conf_sysrev` 117 117 last_action=$(conf_lastact) 118 statefile=$(conf_tmp_file) 118 119 119 120 if [ "x$last_action" = "xinstall" ] && [ $tar_revision -lt $sys_revision ] … … 139 140 for layer in $(conf_get_recipe) ; do 140 141 echo "Rolling on $layer..." 141 conf_rollout $layer || conf_cleanExit142 conf_rollout $layer $statefile || conf_cleanExit 142 143 done 143 144 for file in $SINGULARITIES ; do
Note: See TracChangeset
for help on using the changeset viewer.
