Changeset 90


Ignore:
Timestamp:
04/19/2006 14:01:22 (6 years ago)
Author:
ccowart
Message:

Singularity support for the inst function. See Bug #4204

Location:
confman
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • confman/confman

    r89 r90  
    8080 
    8181# And we'll set a trap: 
    82 trap "cleanexit" SIGINT SIGTERM 
     82trap "conf_cleanexit" SIGINT SIGTERM 
    8383 
    8484 
     
    118118        if [ -z $* ] ; then 
    119119                for layer in $LAYERS ; do 
    120                         conf_update_module $layer || cleanexit 
    121                 done 
    122                 conf_update_module ${REPO_CHECKPTS} || cleanexit 
     120                        conf_update_module $layer || conf_cleanexit 
     121                done 
     122                conf_update_module ${REPO_CHECKPTS} || conf_cleanexit 
    123123        else 
    124124                print_usage 1 
     
    140140                echo "Change this file to your log message." > $msg 
    141141                ${EDITOR} $msg 
    142                 update || cleanexit 
     142                update || conf_cleanexit 
    143143 
    144144                echo "Commit operation started" >&2 
     
    163163# Short name intentional, don't want collision with real install. 
    164164function inst { 
    165         local file 
     165        local file livefile 
    166166 
    167167        if [ -z $* ] ; then 
     
    172172                echo "Change this file to your log message." > $msg 
    173173                ${EDITOR} $msg 
    174                 update || cleanexit 
     174                update || conf_cleanexit 
    175175 
    176176                echo "Installation operation started." >&2 
    177177                for layer in $LAYERS ; do 
     178                        echo "Layer: $layer" 
    178179                        conf_commit $layer $msg || return $? 
    179                 done 
    180  
    181                 for file in $* ; do 
    182                         file=`abspath $file` 
    183  
    184                         for layer in $LAYERS ; do 
    185                                 conf_install $layer $file || return $? 
    186                         done 
    187                          
    188                         if [[ "$SINGULARITIES" =~ "$file" ]] ; then 
    189                                 conf_assemble_file $file || return $? 
    190                         fi 
     180                        conf_install $layer $* 
     181                done 
     182                for file in $SINGULARITIES ; do 
     183                        conf_assemble_sing $file || conf_cleanexit 
    191184                done 
    192185                echo "Installation operation succeeded." >&2 
     
    241234        if sudo [ -L $file ] ; then 
    242235                echo "$MYNAME: Error: $file is a symbolic link!" >&2 
    243                 cleanexit 
     236                conf_cleanexit 
    244237        fi 
    245238 
     
    247240                echo "$MYNAME: Error: $file already exists in your working" \ 
    248241                     "copy of $module." 
    249                 cleanexit 
     242                conf_cleanexit 
    250243        fi 
    251244 
     
    256249                                     "the ${layer} module." >&2 
    257250                                echo "Did you mean -f ?" >&2 
    258                                 cleanexit 
     251                                conf_cleanexit 
    259252                        fi 
    260253                done 
     
    546539        else 
    547540                echo "Rolling $module back to $checkpoint $clock" >&2 
    548                 conf_rollback $module $checkpoint $clock || cleanexit 
     541                conf_rollback $module $checkpoint $clock || conf_cleanexit 
    549542                for layer in $LAYERS ; do 
    550543                        echo "Rolling on $layer..." 
    551                         conf_rollout $layer || cleanexit 
     544                        conf_rollout $layer || conf_cleanexit 
    552545                done 
    553546 
    554547                for file in $SINGULARITIES ; do 
    555                         conf_assemble_sing $file || cleanexit 
     548                        conf_assemble_sing $file || conf_cleanexit 
    556549                done 
    557550                echo "Rollback succeeded." >&2 
     
    593586} 
    594587 
    595 function cleanexit { 
    596   rm -f /tmp/confman* 
    597  
    598   # And in case we got an interrupt during a rollout, we still want the 
    599   # permissions here to be in a consistent state. 
    600   chmod 700 ${WORK_PATH} 
    601  
    602   exit 1 
    603 } 
     588 
    604589 
    605590# Dispatch the subcommand. This must happen last and in the global context. 
  • confman/confmanlib.sh

    r78 r90  
    106106function conf_install { 
    107107  local module="$1" 
    108   local file="$2" 
     108  local file=`abspath $2` 
    109109  local moduledir="${WORK_PATH}/$module" 
    110110  local livefile=`echo "$file" | sed -E "s:${WORK_PATH}/[^/]+::"` 
     111  local pathmodule=`echo "$file" | sed -E "s:${WORK_PATH}/([^/]+).*:\1:"` 
     112  local suffix 
     113  livefile=`echo "$livefile" | sed -E "s:-${pathmodule}$::"` 
     114  if [[ $SINGULARITIES =~ $livefile ]] ; then 
     115          suffix="-${module}" 
     116  fi 
     117  livefile="${livefile}${suffix}" 
     118 
    111119 
    112120  # See if it even exists 
     
    319327} 
    320328 
    321    
    322  
     329function conf_cleanexit { 
     330  rm -f /tmp/confman* 
     331 
     332  # And in case we got an interrupt during a rollout, we still want the 
     333  # permissions here to be in a consistent state. 
     334  chmod 700 ${WORK_PATH} 
     335 
     336  # And this clears any locks we may have created on our working copy: 
     337  svn cleanup ${WORK_PATH} 
     338 
     339  if [ -z $1 ] ; then 
     340        exit 1 
     341  else 
     342        exit $1 
     343  fi 
     344 
     345 
     346 
Note: See TracChangeset for help on using the changeset viewer.