- Timestamp:
- 12/15/2011 17:04:10 (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
r543 r544 109 109 tmproot=$(conf_tmp_dir) 110 110 live_root="${LIVE_ROOT}" 111 statefile=$(conf_tmp_file)112 111 113 112 # Override LIVE_ROOT to commit into our temporary directory. … … 117 116 for layer in $(conf_get_recipe) ; do 118 117 echo "Rolling on $layer..." 119 conf_rollout $layer $statefile|| conf_cleanExit118 conf_rollout $layer || conf_cleanExit 120 119 done 121 120 for file in $SINGULARITIES ; do -
branches/confman-1.9/confman.in
r543 r544 189 189 190 190 function commit { 191 local msg status modules module symlink abswork files statefile191 local msg status modules module symlink abswork files 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 verse_recipe); do214 for module in $(conf_get_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 statefile=$(conf_tmp_file) 239 for layer in $(conf_get_reverse_recipe) ; do 238 for layer in $(conf_get_recipe) ; do 240 239 echo "Rolling on $layer..." 241 conf_rollout $layer $statefile|| return $?240 conf_rollout $layer || return $? 242 241 done 243 242 for file in $SINGULARITIES ; do … … 260 259 local opt OPTIND OPTARG 261 260 local module 262 local statefile263 261 264 262 while getopts ":m:F:" opt ; do … … 294 292 $nocommit || conf_commit_file "$msg" "$files" || return $? 295 293 296 for layer in $(conf_get_re verse_recipe) ; do294 for layer in $(conf_get_recipe) ; do 297 295 for file in "$@"; do 298 296 module=$(conf_wfile_module $file) 299 297 if conf_wfile_is_singularity $file; then 300 conf_install $layer $statefile"${file%-$module}-${layer}"298 conf_install $layer "${file%-$module}-${layer}" 301 299 else 302 conf_install $layer $statefile"$file"300 conf_install $layer "$file" 303 301 fi 304 302 done … … 763 761 local checkpoint=$2 764 762 local clock=$3 765 local wcopy_lock system_lock statefile763 local wcopy_lock system_lock 766 764 767 765 if [ -z "$2" ] ; then … … 773 771 echo "Rolling $module back to $checkpoint $clock" >&2 774 772 conf_rollback $module $checkpoint $clock || conf_cleanExit 775 statefile=$(conf_tmp_file) 776 for layer in $(conf_get_reverse_recipe) ; do 773 for layer in $(conf_get_recipe) ; do 777 774 echo "Rolling on $layer..." 778 conf_rollout $layer $statefile|| conf_cleanExit775 conf_rollout $layer || conf_cleanExit 779 776 done 780 777 … … 928 925 local tmproot=$(conf_tmp_dir) 929 926 local live_root="${LIVE_ROOT}" 930 local statefile931 927 932 928 # Override LIVE_ROOT to commit into our tmporary directory. … … 936 932 937 933 echo "Audit operation started" >&2 938 for layer in $(conf_get_re verse_recipe) ; do934 for layer in $(conf_get_recipe) ; do 939 935 echo "Rolling on $layer..." 940 conf_rollout $layer $statefile|| return $?936 conf_rollout $layer || return $? 941 937 done >/dev/null 942 938 for file in $SINGULARITIES ; do -
branches/confman-1.9/confmanlib.sh.in
r543 r544 414 414 } 415 415 416 # Test to see if the pathname has been added to a statefile yet417 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 statefile424 function conf_gothere {425 local statefile="$1"426 local pathname="$2"427 echo "$pathname" >> $statefile428 }429 430 416 # Roll out the specified module, optionally at the specified 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] 417 # eg: conf_rollout MODULE [checkpoint] 434 418 function conf_rollout { 435 419 local module="$1" 436 local statefile="$2" 437 if [ -z $3 ] ; then 420 if [ -z $2 ] ; then 438 421 local moduledir="${WORK_PATH}/$module" 439 422 else … … 453 436 local livedir=`echo $directory | ${sed_cmd} -e "s:$moduledir::"` 454 437 livedir="${LIVE_ROOT}${livedir}" 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 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 466 446 for file in `find -L $moduledir -type f | grep -v "\.svn"` ; do 467 447 local livefile=`echo "$file" | ${sed_cmd} -e "s:$moduledir::"` … … 470 450 local mode=`conf_get_prop ${file} mode` 471 451 local symlink="`conf_get_prop ${file} symlink`" 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 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" 481 460 echo $cmd 482 conf_gothere $statefile "$livefile"483 461 $cmd 484 462 fi … … 561 539 ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 562 540 local module="$1" 563 local statefile="$2" 564 local file="$3" 541 local file="$2" 565 542 shift 2 566 543 local livefile … … 576 553 livefile="/${file#*/}" 577 554 file="${ABS_WORK}/${module}${livefile}" 578 livefile="${LIVE_ROOT}${livefile}"579 555 580 556 # See if it even exists 581 557 if [ ! -e "$file" ] ; then 582 558 conf_debug "$file" does not appear to exist 583 conf_install $module $statefile"$@"559 conf_install $module "$@" 584 560 return 1 585 561 fi … … 598 574 599 575 if [ -n "$symlink" ] ; then 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 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} 612 585 613 586 if [ -d "$file" ] ; then 614 587 conf_debug "conf_install encountered a directory. Recursing." 615 conf_install $module $ statefile $(find "$file" \588 conf_install $module $(find "$file" \ 616 589 -mindepth 1 -maxdepth 1 -not -name '.svn') || failures=true 617 590 fi 618 591 conf_debug "conf_install recursing" 619 conf_install $module $statefile"$@" || failures=true592 conf_install $module "$@" || failures=true 620 593 conf_debug "conf_install returning" 621 594 if $failures ; then … … 1040 1013 } 1041 1014 1042 # Gets a reversed copy of the recipe1043 function conf_get_reverse_recipe {1044 local fwd_recipe=$(conf_get_recipe "$@")1045 local rev_recipe1046 for module in $fwd_recipe ; do1047 rev_recipe="$module $rev_recipe"1048 done1049 echo $rev_recipe1050 }1051 1052 1015 # Spits the recipe, modules separated by whitespace, out on stdout 1053 1016 function conf_get_recipe { -
branches/confman-1.9/confsync.in
r543 r544 116 116 sys_revision=`conf_sysrev` 117 117 last_action=$(conf_lastact) 118 statefile=$(conf_tmp_file)119 118 120 119 if [ "x$last_action" = "xinstall" ] && [ $tar_revision -lt $sys_revision ] … … 140 139 for layer in $(conf_get_recipe) ; do 141 140 echo "Rolling on $layer..." 142 conf_rollout $layer $statefile|| conf_cleanExit141 conf_rollout $layer || conf_cleanExit 143 142 done 144 143 for file in $SINGULARITIES ; do
Note: See TracChangeset
for help on using the changeset viewer.
