#!/bin/sh ######################################################################### # # FILE : cvsadd # DATE : 10.07.2001 # AUTHOR : Patrick Meier / patrick.meier@profidatagroup.com # DESCRIPTION : add files to the cvs # # Copyrigth (C) 2001 by Patrick Meier, Switzerland # ######################################################################### PN=`basename "$0"` CVS=/usr/local/bin/cvs-1.11.1p1-SUNOS-5.6 CVSPARAMETER= STARTSTRING="==>" export CVS ######################################################################### # Usage ######################################################################### Usage() { echo "$PN - add files to the cvs" echo "usage: $PN [-d cvs-root] [-b] file..." echo "" echo "(use parameter -b to add binary files)" exit 1 } ######################################################################### # ParameterFailed ######################################################################### ParameterFailed() { echo "${STARTSTRING}Parameter faild: $1 ..."; echo "" Usage } ######################################################################### # main ######################################################################### BINARY="" while [ $# -gt 0 ] do case "$1" in -b) BINARY="-kb";; -d) if [ $# -gt 1 ] ; then CVSROOT="$2"; shift; else ParameterFailed $1; fi;; -h) Usage; exit 1;; -*) Usage; exit 1;; *) break;; esac shift done if [ $# -lt 1 ] then Usage else for i in $@ do comment="" if [ -r $i ] && [ -f $i ] then if [ -z "$BINARY" ] then echo "${STARTSTRING}Add the ascii file $i to cvs:" else echo "${STARTSTRING}Add the binary file $i to cvs:" fi cmd="$CVS add $BINARY $i >/dev/null 2>&1" if( eval $cmd ) then $CVS commit -m "added file $i" $i else echo "${STARTSTRING}ERROR: Coudl not add file $i to cvs!" fi else if [ -d $i ] then echo "${STARTSTRING}Add the directory $i to cvs:" cmd="$CVS add $i >/dev/null 2>&1" if( eval $cmd ) then $CVS commit -m "added directory $i" $i else echo "${STARTSTRING}ERROR: Could not add directory $i to cvs!" fi else echo "${STARTSTRING}ERROR: Could not access file $i!" fi fi done fi ######################################################################### # EOF #########################################################################