Changeset 37 for confman/confman
- Timestamp:
- 03/29/2006 02:29:23 (6 years ago)
- File:
-
- 1 edited
-
confman/confman (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
confman/confman
r36 r37 1 1 #! /usr/local/bin/bash 2 2 3 # $Rev$ 4 # $Author$ 5 # $Date$ 3 # $Id$ 6 4 7 5 # Some global definitions. Defaults that can be overriden by options. 8 GCONF="/ home/ccowart/src/confman/confman.conf"6 GCONF="/usr/local/rescomp/etc/confman.conf" 9 7 UCONF="${HOME}/.confmanrc" 10 8 MYNAME=`basename $0` … … 54 52 $MYNAME setup 55 53 $MYNAME update 54 $MYNAME commit 55 $MYNAME diff [ working_copy ] 56 $MYNAME log [ working_copy ] 56 57 $MYNAME create module 57 $MYNAME commit58 58 $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 ] 67 69 $MYNAME checklook module 68 70 $MYNAME checknew module name 69 71 $MYNAME checkclear module name 70 $MYNAME rollback module name72 $MYNAME rollback module [ checkpoint | YYYYMMDD [HHMM] ] 71 73 72 74 For specific information on a particular $MYNAME subcommand, please run … … 132 134 the repository. 133 135 136 EOF 137 ;; 138 diff ) 139 cat <<EOF 140 $MYNAME provides a command-line interface to Rescomp's server 141 configuration management system. 142 143 Usage: 144 $MYNAME diff [ working_copy ] 145 146 Look at the changes you've made to your working copy of a file or directory. 147 EOF 148 ;; 149 log ) 150 cat <<EOF 151 $MYNAME provides a command-line interface to Rescomp's server 152 configuration management system. 153 154 Usage: 155 $MYNAME log [ working_copy ] 156 157 Look at the log entries for the file or directory specified by working_copy. 158 EOF 159 ;; 160 cp ) 161 cat <<EOF 162 $MYNAME provides a command-line interface to Rescomp's server 163 configuration management system. 164 165 Usage: 166 $MYNAME cp src_working_copy dest_working_copy 167 168 Copy source to destination. Arguments must be working copies. 169 EOF 170 ;; 171 mv ) 172 cat <<EOF 173 $MYNAME provides a command-line interface to Rescomp's server 174 configuration management system. 175 176 Usage: 177 $MYNAME mv src_working_copy dest_working_copy 178 179 Move source to destination. Arguments must be working copies. 134 180 EOF 135 181 ;; … … 328 374 ;; 329 375 esac 376 exit $2 330 377 } 331 378 … … 378 425 update || return $? 379 426 echo "Change this file to your log message." > $msg 380 ${EDITOR} msg381 local msg="${msg} --`whoami`"427 ${EDITOR} $msg 428 #local msg="${msg} --`whoami`" 382 429 for layer in $LAYERS ; do 383 430 conf_commit $layer $msg || return $? … … 482 529 483 530 function remove { 484 local module=$1 485 local file=$2 531 local file=`abspath "$1"` 486 532 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 505 535 } 506 536 507 537 function newdir { 508 local module=$1 509 local dir=$2 510 local response usefile 538 local dir=$1 539 local response 511 540 local mode=$DEFAULT_MODE 512 541 local owner=$DEFAULT_OWNER 513 542 local group=$DEFAULT_GROUP 514 543 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` 525 558 526 559 # Convert mode string to base 10: … … 555 588 556 589 # Time to create the directory. 557 echo "Making $dir in $modulewith ${owner}:${group}, $mode"558 conf_mkdir $ module $dir $owner $group $mode590 echo "Making directory $dir with ${owner}:${group}, $mode" 591 conf_mkdir $dir $owner $group $mode 559 592 } 560 593 … … 708 741 } 709 742 743 function diff { 744 conf_diff $* 745 } 746 747 function log { 748 conf_log $* 749 } 750 751 function 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 760 function 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 710 769 function absdir { 711 770 local file="$1" … … 770 829 list $* 771 830 ;; 831 move|mv ) 832 move $* 833 ;; 834 copy|cp ) 835 copy $* 836 ;; 837 diff ) 838 diff $* 839 ;; 840 log ) 841 log $* 842 ;; 772 843 chmod ) 773 844 chmode $*
Note: See TracChangeset
for help on using the changeset viewer.
