Changeset 76


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

Coded the install function for installing a single file.

Location:
confman
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • confman/confman

    r75 r76  
    108108        if [ -z $* ] ; then 
    109109                for layer in $LAYERS ; do 
    110                         conf_update_module $layer || return $? 
    111                 done 
     110                        conf_update_module $layer || cleanexit 
     111                done 
     112                conf_update_module ${REPO_CHECKPTS} || cleanexit 
    112113        else 
    113114                print_usage 1 
     
    118119        if [ -z $* ] ; then 
    119120                local msg=`mktemp -t confman` 
    120                 update || return $? 
     121                # Moved up per Ian's request. 
    121122                echo "Change this file to your log message." > $msg 
    122123                ${EDITOR} $msg 
     124                update || cleanexit 
    123125 
    124126                for layer in $LAYERS ; do 
     
    138140        fi 
    139141} 
     142 
     143# Short name intentional, don't want collision with real install. 
     144function inst { 
     145        local file 
     146 
     147        if [ -z $* ] ; then 
     148                print_usage 1 
     149        else 
     150                local msg=`mktemp -t confman` 
     151                # Moved up per Ian's request. 
     152                echo "Change this file to your log message." > $msg 
     153                ${EDITOR} $msg 
     154                update || cleanexit 
     155 
     156                for layer in $LAYERS ; do 
     157                        conf_commit $layer $msg || return $? 
     158                done 
     159 
     160                for file in $* ; do 
     161                        file=`abspath $file` 
     162 
     163                        for layer in $LAYERS ; do 
     164                                conf_install $layer $file 
     165                        done 
     166                         
     167                        if [[ "$SINGULARITIES" =~ "$file" ]] ; then 
     168                                conf_assemble_file $file 
     169                        fi 
     170                done 
     171        fi 
     172} 
     173         
    140174 
    141175function import { 
     
    494528                        conf_rollout $layer 
    495529                done 
     530 
     531                for file in $SINGULARITIES ; do 
     532                        conf_assemble_sing $file 
     533                done 
    496534        fi 
    497535} 
     
    564602                commit $* 
    565603                ;; 
    566         import|i* ) 
     604        import|im* ) 
    567605                import $* 
     606                ;; 
     607        install|in* ) 
     608                inst $* 
    568609                ;; 
    569610        remove|re*|rm ) 
  • confman/confmandoc.sh

    r75 r76  
    2626  $MYNAME rmmod module 
    2727  $MYNAME import module livefile 
     28  $MYNAME install working_copy 
    2829  $MYNAME rm workingfile 
    2930  $MYNAME cp src_working_copy dest_working_copy 
     
    181182EOF 
    182183;; 
    183           i* ) 
     184          im* ) 
    184185cat <<EOF 
    185186$MYNAME provides a command-line interface to Rescomp's server 
     
    191192The import subcommand adds the specified file to your working copy of the 
    192193repository.  
     194 
     195EOF 
     196;; 
     197          in* ) 
     198cat <<EOF 
     199$MYNAME provides a command-line interface to Rescomp's server 
     200configuration management system. 
     201 
     202Usage: 
     203  $MYNAME install working_file [ working_file ... ] 
     204 
     205The install subcommand allows you to roll out a single file from your working 
     206copy. 
    193207 
    194208EOF 
  • confman/confmanlib.sh

    r68 r76  
    9595          $cmd 
    9696  done 
    97   for file in $SINGULARITIES ; do 
    98           conf_assemble_sing ${module} ${file} 
    99   done 
    10097  # This is a hack to work around NFS home dirs, for now: 
    10198  chmod o-rx ${WORK_PATH} 
    10299} 
     100 
     101function conf_install { 
     102  local module="$1" 
     103  local file="$2" 
     104  local moduledir="${WORK_PATH}/$module" 
     105  local livefile=`echo "$file" | sed -E "s:${WORK_PATH}/[^/]+::"` 
     106 
     107  # See if it even exists 
     108  file="${moduledir}${livefile}" 
     109  if [ ! -f $file ] ; then 
     110          return 0 
     111  fi 
     112 
     113  # If we got here, figure it out 
     114  local owner=`conf_get_prop ${file} owner` 
     115  local group=`conf_get_prop ${file} group` 
     116  local mode=`conf_get_prop ${file} mode` 
     117  local opts="-Sp -o $owner -g $group -m $mode" 
     118  local cmd="sudo install $opts $file ${LIVE_ROOT}$livefile" 
     119 
     120  chmod o+rx ${WORK_PATH} 
     121  echo $cmd 
     122  $cmd 
     123  chmod o-rx ${WORK_PATH} 
     124} 
     125 
    103126 
    104127function conf_list { 
Note: See TracChangeset for help on using the changeset viewer.