Changeset 37 for confman/confman


Ignore:
Timestamp:
03/29/2006 02:29:23 (6 years ago)
Author:
ccowart
Message:

Some syntax touchups, a couple extra wrappers to svn. Business.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • confman/confman

    r36 r37  
    11#! /usr/local/bin/bash 
    22 
    3 # $Rev$ 
    4 # $Author$ 
    5 # $Date$ 
     3# $Id$ 
    64 
    75# Some global definitions. Defaults that can be overriden by options. 
    8 GCONF="/home/ccowart/src/confman/confman.conf" 
     6GCONF="/usr/local/rescomp/etc/confman.conf" 
    97UCONF="${HOME}/.confmanrc" 
    108MYNAME=`basename $0` 
     
    5452  $MYNAME setup 
    5553  $MYNAME update 
     54  $MYNAME commit 
     55  $MYNAME diff [ working_copy ] 
     56  $MYNAME log [ working_copy ] 
    5657  $MYNAME create module 
    57   $MYNAME commit 
    5858  $MYNAME rmmod module 
    59   $MYNAME import module file 
    60   $MYNAME remove module file 
    61   $MYNAME mkdir module directory 
    62   $MYNAME ls [ file | directory ] 
    63   $MYNAME chown module [ file | directory ] owner 
    64   $MYNAME chgrp module [ file | directory ] group 
    65   $MYNAME chmod module [ file | directory ] mode 
    66   $MYNAME chcom module [ file | directory ] comment-character 
     59  $MYNAME import module livefile 
     60  $MYNAME rm workingfile 
     61  $MYNAME cp src_working_copy dest_working_copy 
     62  $MYNAME mv src_working_copy dest_working_copy 
     63  $MYNAME mkdir workingdirectory 
     64  $MYNAME ls [ workingfile | workingdirectory ] 
     65  $MYNAME chown owner [ workingfile | workingdirectory ]  
     66  $MYNAME chgrp group [ workingfile | workingdirectory ]  
     67  $MYNAME chmod mode  [ workingfile | workingdirectory ]  
     68  $MYNAME chcom comment-character [ workingfile | workingdirectory ]  
    6769  $MYNAME checklook module 
    6870  $MYNAME checknew module name 
    6971  $MYNAME checkclear module name 
    70   $MYNAME rollback module name 
     72  $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ] 
    7173 
    7274For specific information on a particular $MYNAME subcommand, please run 
     
    132134the repository. 
    133135 
     136EOF 
     137;; 
     138          diff ) 
     139cat <<EOF 
     140$MYNAME provides a command-line interface to Rescomp's server 
     141configuration management system. 
     142 
     143Usage: 
     144  $MYNAME diff [ working_copy ] 
     145 
     146Look at the changes you've made to your working copy of a file or directory. 
     147EOF 
     148;; 
     149          log ) 
     150cat <<EOF 
     151$MYNAME provides a command-line interface to Rescomp's server 
     152configuration management system. 
     153 
     154Usage: 
     155  $MYNAME log [ working_copy ] 
     156 
     157Look at the log entries for the file or directory specified by working_copy. 
     158EOF 
     159;; 
     160          cp ) 
     161cat <<EOF 
     162$MYNAME provides a command-line interface to Rescomp's server 
     163configuration management system. 
     164 
     165Usage: 
     166  $MYNAME cp src_working_copy dest_working_copy 
     167 
     168Copy source to destination. Arguments must be working copies. 
     169EOF 
     170;; 
     171          mv ) 
     172cat <<EOF 
     173$MYNAME provides a command-line interface to Rescomp's server 
     174configuration management system. 
     175 
     176Usage: 
     177  $MYNAME mv src_working_copy dest_working_copy 
     178 
     179Move source to destination. Arguments must be working copies. 
    134180EOF 
    135181;; 
     
    328374;; 
    329375esac 
     376exit $2 
    330377} 
    331378 
     
    378425                update || return $? 
    379426                echo "Change this file to your log message." > $msg 
    380                 ${EDITOR} msg 
    381                 local msg="${msg} --`whoami`" 
     427                ${EDITOR} $msg 
     428                #local msg="${msg} --`whoami`" 
    382429                for layer in $LAYERS ; do 
    383430                        conf_commit $layer $msg || return $? 
     
    482529 
    483530function remove { 
    484         local module=$1 
    485         local file=$2 
     531        local file=`abspath "$1"` 
    486532        local response 
    487         if [ -z $2 ] ; then print_usage 1 ; fi 
    488         echo "Are you sure you want to delete this file from revision control?" 
    489         while read response ; do 
    490                 case $response in 
    491                         Y|y|yes ) 
    492                                 break 
    493                                 ;; 
    494                         N|n|no ) 
    495                                 return 1 
    496                                 ;; 
    497                         * ) 
    498                                 echo "Please type yes or no." 
    499                                 continue 
    500                                 ;; 
    501                 esac 
    502         done 
    503  
    504         conf_rm_file $module $file 
     533        if [ -z $1 ] ; then print_usage 1 ; fi 
     534        conf_rm_file $file 
    505535} 
    506536 
    507537function newdir { 
    508         local module=$1 
    509         local dir=$2 
    510         local response usefile  
     538        local dir=$1 
     539        local response  
    511540        local mode=$DEFAULT_MODE 
    512541        local owner=$DEFAULT_OWNER 
    513542        local group=$DEFAULT_GROUP 
    514543        local comment="dir" 
    515         if [ -z $2 ] ; then 
    516                 print_usage 1 
    517         fi 
    518  
    519         echo  
    520         echo "Creating the directory $dir" 
    521         echo 
    522  
    523         if [ -d $dir ] ; then 
    524                 eval `stat -f "mode=%Mp%Lp owner=%Su group=%Sg" $dir` 
     544        local workdir=`abspath .` 
     545        if [ -z $1 ] ; then 
     546                print_usage 1 
     547        fi 
     548 
     549        # Find the "real" directory's path 
     550        dir="${workdir}/${dir}" 
     551        local module=`echo ${workdir#$WORK_PATH/} | sed -E 's:/([^/]+)/.*:\1:'` 
     552        echo $module 
     553        local realpath=${dir#${WORK_PATH}/${module}} 
     554        echo $realpath 
     555 
     556        if [ -d $realpath ] ; then 
     557                eval `stat -f "mode=%Mp%Lp owner=%Su group=%Sg" $realpath` 
    525558 
    526559                # Convert mode string to base 10: 
     
    555588 
    556589        # Time to create the directory. 
    557         echo "Making $dir in $module with ${owner}:${group}, $mode" 
    558         conf_mkdir $module $dir $owner $group $mode  
     590        echo "Making directory $dir with ${owner}:${group}, $mode" 
     591        conf_mkdir $dir $owner $group $mode  
    559592} 
    560593 
     
    708741} 
    709742 
     743function diff { 
     744        conf_diff $* 
     745} 
     746 
     747function log { 
     748        conf_log $* 
     749} 
     750 
     751function copy { 
     752        local src=$1 
     753        local dest=$2 
     754 
     755        if [ -z $2 ] ; then print_usage 1 ; fi 
     756 
     757        conf_cp $src $dest 
     758} 
     759 
     760function move { 
     761        local src=$1 
     762        local dest=$2 
     763 
     764        if [ -z $2 ] ; then print_usage 1 ; fi 
     765 
     766        conf_mv $src $dest 
     767} 
     768 
    710769function absdir { 
    711770  local file="$1" 
     
    770829                list $* 
    771830                ;; 
     831        move|mv ) 
     832                move $* 
     833                ;; 
     834        copy|cp ) 
     835                copy $* 
     836                ;; 
     837        diff ) 
     838                diff $* 
     839                ;; 
     840        log ) 
     841                log $* 
     842                ;; 
    772843        chmod ) 
    773844                chmode $* 
Note: See TracChangeset for help on using the changeset viewer.